Begin order saving transaction (processing)

Method Description

An operation for the start of distributing transactions when creating or changing an order in processing mode.

The operation accepts an orders full composition with a pre-calculated price through the order calculation operation.

If discounts have changed since the calculation moment (the deal or coupon is no longer valid, not enough points, etc), the following processing status will be returned: PriceHasBeenChanged.
In this case, it is necessary to recalculate the order using the order calculation operation.

If the “Processed” status returns, then the request was successful. After completion, the operation fixates the transaction creation date, points, coupons, and gift cards used in the order are considered to be used.
After successful payment at the POS or online order creation on the website, it is necessary to commit the transaction with the help of a separate method.
In the case of a transaction rollback, funds return to the Customer.

{
    "customer": {
        "mobilePhone": "<Mobile phone>",
        "ids": {
            "mindboxId": "<Customer ID in Mindbox>"
        },
        "discountCard": {
            "ids": {
                "number": "<Discount card number>"
            }
        }
    },
    "pointOfContact": "<External point of contact identifier>",
    "order": {
        "ids": {
            "externalSystemId": "<Order identifier in external system>"
        },
        "transaction": {
            "ids": {
                "externalId": "<Order save transaction identifier>"
            }
        },
        "area": {
            "ids": {
                "externalId": "<External area identifier>"
            }
        },
        "deliveryCost": "<Delivery cost>",
        "lines": [
            {
                "product": {
                    "ids": {
                        "testExternalSystem": "<Item position ID in TestExternalSystem1>"
                    }
                },
                "lineId": "<Order item identifier>",
                "lineNumber": "<Sequence number of order item>",
                "quantity": "<Quantity of items>",
                "basePricePerItem": "<Base price of item per itemа>",
                "minPricePerItem": "<Minimal item price per item>",
                "costPricePerItem": "<Cost of item per item>",
                "customFields": {
                    "lineField1": "<Additional field1>",
                    "lineField2": "<Additional field2>"
                },
                "status": {
                    "ids": {
                        "externalId": "<Purchase status>"
                    }
                },
                "giftCard": {
                    "ids": {
                        "number": "<Gift card number>"
                    },
                    "getFromPool": "<Select an available gift card from the pool>"
                },
                "requestedPromotions": [
                    {
                        "type": "discount",
                        "promotion": {
                            "ids": {
                                "externalId": "<External promotion identifier>"
                            }
                        },
                        "amount": "<Discount size>"
                    },
                    {
                        "type": "earnedBonusPoints",
                        "promotion": {
                            "ids": {
                                "externalId": "<External promotion identifier>"
                            }
                        },
                        "balanceType": {
                            "ids": {
                                "systemName": "<Points account system name>"
                            }
                        },
                        "amount": "<Amount of accrued points>",
                        "expirationDateTimeUtc": "<Points expiration date>"
                    },
                    {
                        "type": "spentBonusPoints",
                        "promotion": {
                            "ids": {
                                "externalId": "<External promotion identifier>"
                            }
                        },
                        "balanceType": {
                            "ids": {
                                "systemName": "<System name of points account>"
                            }
                        },
                        "amount": "<Amount spent>"
                    }
                ]
            }
        ],
        "requestedPromotions": [
            {
                "type": "deliveryDiscount",
                "promotion": {
                    "ids": {
                        "externalId": "<External promotion identifier>"
                    }
                },
                "amount": "<Discount size>"
            }
        ],
        "coupons": [
            {
                "ids": {
                    "code": "<Code>"
                }
            }
        ],
        "bonusPoints": [
            {
                "amount": "<Amount of points for order discount>"
            }
        ],
        "totalPrice": "<Total order price together with all discounts, cancellations and returns>",
        "payments": [
            {
                "type": "<Payment type>",
                "amount": "<Payment size>"
            },
            {
                "type": "giftCard",
                "giftCard": {
                    "ids": {
                        "number": "<Gift card number>"
                    }
                },
                "amount": "Payment size"
            }
        ],
        "customFields": {
            "orderField1": "<Additional field1>",
            "orderField2": "<Additional field2>"
        },
        "cashdesk": {
            "ids": {
                "externalId": "<Cashdesk identifier>"
            }
        }
    }
}

Response Description

If everything is correct, information about the customer and his actual balance will return, as well as a list of issued coupons, gift cards, and messages for printing on the check.

If the order sum is no longer relevant (the promotion has ended, there are not enough points), you will receive a PriceHasBeenChanged status as a response with a description of the error in the statusDescription field.

{
    "customer":{
        "processingStatus":"<Customer status, possible variants: Found, NotFound, DiscountCardIsBlocked>",
        "firstName":"<Name>",
        "middleName":"<Middle name>",
        "lastName":"<Last name>",
        "email":"<Email address>",
        "isEmailInvalid":"<Email address invalid>",
        "mobilePhone":"<Mobile phone number>",
        "isMobilePhoneInvalid":"<Is mobile phone number invalid>",
        "isMobilePhoneConfirmed":"<Is mobile phone number confirmed>",
        "pendingMobilePhone":"<Is mobile number awaiting confirmation after number>",
        "area":{
            "ids":{
                "externalId":"<Customer geographic area identifier>"
            },
            "name":"<Name of customer geographic area>"
        },
        "birthDate":"<Date of birth in yyyy-MM-dd format>",
        "sex":"<Sex>",
        "changeDateTimeUtc":"<Registration Date/editing in format yyyy-MM-dd HH:mm:ss.FFF>"
    },
    "order":{
        "processingStatus": "<Order status: Created/Updated/PriceHasBeenChanged>",
        "ids": {
            "mindboxId": "<Mindbox promotion identifier>"
        },
        "transaction": {
            "ids": {
                "externalId": "<Order save transaction identifier>"
            }
        },
        "issuedCoupons": [{
            "promotion": {
                "name": "<Promotion name>",
                "ids": {
                    "externalId": "<External promotion identifier>",
                    "mindboxId": "<Mindbox promotion identifier>",
                },
                "type": "<Promotion type: mindbox/external>"
            },
            "coupon": {
                "ids": {
                    "code": "<Code>"
                },
                "pool":{
                    "ids":{
                        "externalId":"<External coupon pool identifier>",
                        "mindboxId":"<Internal coupon pool identifier>"
                    },
                    "name":"<Pool coupon name>",
                    "description":"<Coupon pool description>"
                }
            }
        }],
        "purchasedGiftCards": [{
            "giftCard": {
                "ids": {
                	"number": "<Gift card identifier>"
                },
                "amount": "<Gift card amount>"
            },
            "line": {
                "lineId": "<Position identifier, for which the gift card has been given out>"
            }
        }],
        "placeholders":[
            {
                "ids":{
                    "externalId":"<identifier of display text area>"
                },
                "content":[
                    {
                        "type":"text",
                        "message":"<Message displayed by the check line>",
                        "promotion":{
                            "ids":{
                                "mindboxId":"<Mindbox promotion identifier>",
                                "externalId":"<Promotion identifier>"
                            },
                            "name":"<Promotion name>",
                            "type":"<Promotion type: mindbox/external>"
                        }
                    }
        ],
        "bonusPointsChanges":[
            {
                "balanceType":{
                    "ids":{
                        "systemName":"<Point account system name>"
                    },
                    "name":"<Point account name>"
                },
                "earnedAmount": "<Quantity of points which will be accrued or used in the form of bonuses for the order>",
                "spentAmount": "<Quantity of points which will be accrued or used in the form of payment for an order>"                
            }
        ]
    }
}
{
    "status": "Success",
    "order": {
        "processingStatus": "PriceHasBeenChanged",
        "statusDescription": "{Error description}"
    },
    "customer": {
        "processingStatus": "Found"
    }
}