/
Selling Price Error

Selling Price Error

Order Details received from Unicommerce contains selling price key which is used as customer Price while creating order at our end. For some orders we get '0' value in this key.

Sample order details received from the response of getting sale order API of Unicommerce with channelData:

{ "integrationType": "11", "externalChannelId": "CH1267", "accountSlug": "mplsports", "connectionId": "437", "location": { "ESHOPBOX_GURGAON": "MJPAT_109" }, "Uniware_workspaceToken_mplsports": "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1UaERRamxDUlRJelJVUTRRVU0wUVRJNU1FSkVOVGszUVVFeU5qVXdSa1JDTmpBeU16WTROQSJ9.eyJodHRwczovL2FwcERhdGEiOnsiYXBwQ2xpZW50SWQiOiIzMTc2NGU1ZTZlNWZkYTRlM2JmMWQ5Y2UxOGYxYmYxOCJ9LCJodHRwczovL2FjY291bnRTbHVnIjoibXBsc3BvcnRzIiwiaHR0cHM6Ly91c2VyRGV0YWlscyI6eyJpZCI6MTY1OSwidXNlclR5cGUiOiJkZWZhdWx0IiwiZW1haWwiOiJhcHB1c2VyNjJAZXNob3Bib3guY29tIn0sImh0dHBzOi8vYWNjb3VudHMiOlsibXBsc3BvcnRzIl0sImh0dHBzOi8vd2FyZWhvdXNlV29ya3NwYWNlcyI6W10sImh0dHBzOi8vd2FyZWhvdXNlcyI6W10sImh0dHBzOi8vcGFydG5lcnMiOltdLCJpc3MiOiJodHRwczovL2VzaG9wYm94LmF1dGgwLmNvbS8iLCJzdWIiOiJhdXRoMHw2MTNiNmNhNDhkNTVhNDAwNmE4ZmU0MjEiLCJhdWQiOiJodHRwczovL3dtcy5teWVzaG9wYm94LmNvbSIsImlhdCI6MTYzNDAzOTgyNywiZXhwIjoxNjM2NjMxODI3LCJhenAiOiJRelZPN2ZIazJIWXgyWTViM1dEb2lEdUdlNHZDd2pIUCIsInNjb3BlIjoicmVhZDpwcm9kdWN0cyByZWFkOmludmVudG9yeSByZWFkOnByb2R1Y3RfbGlzdGluZ3Mgd3JpdGU6cHJvZHVjdF9saXN0aW5ncyByZWFkOm9yZGVycyB3cml0ZTpvcmRlcnMgcmVhZDpyZXR1cm5zIHdyaXRlOnJldHVybnMgcmVhZDpwYXlhYmxlcyB3cml0ZTpwYXlvdXRzIHdyaXRlOnRyYW5zYWN0aW9uX3J1bGVzIHJlYWQ6Y3VzdG9tX2ZpZWxkcyB3cml0ZTpjdXN0b21fZmllbGRzIHJlYWQ6bG9jYXRpb25zIHdyaXRlOmxvY2F0aW9ucyByZWFkOnBvcnRhbCB3cml0ZTpwb3J0YWwgcmVhZDp3b3Jrc3BhY2UgcmVhZDpzYWxlc19jaGFubmVsIHJlYWQ6ZnVsZmlsbG1lbnRfY2VudGVyIiwiZ3R5IjoicGFzc3dvcmQifQ.SHZeNvCp57XKE_LFfIqZ3NRDMAmZuZbnVlj1sIhwFush9aHeLwrp7rzICFZOJbOQ12kIjIj3b3It-L2_8RYkfKFD2A_Pjx4cipyPfqMEQ0IuaUmIc_WYh6j5Z5nlE1OJvJjdk_gXjOrVjsRHlDZ9YQ9BjxkK-guf5lchAR3dFiD6mazV-yaqd3HKzkjvtK9qE_SeoDNqE0VnsCVS9c--I_sq7cz9o6bBKORRo3NQluEqYHwPc_09asvrXC4YmhbI6_zWBImTm4tPN9HLWdrvBbi4RqvJ4jnijkJAunuDTYnoWOPx_NebNrL5pKP9BAnO3yN_gVtoLKE2ePRdEWC1nQ", "accessToken": "81d7dc4f-ff4f-44da-b65f-42f55da2468e", "isActive": "active", "refreshToken": "967ae65d-3103-4eb8-956b-910b9e32e1b1", "inputFields": "{\"Unicommerce_accountName\":\"mplsports\",\"API_key\":\"unicommerce12@\",\"username\":\"divyansh@mplgaming.com\"}", "ESHOPBOX": [ "ESHO00354", "ESHO00356", "ESHO00357", "ESHO00358", "ESHO00359" ], "ESHOPBOX_GURGAON": [ "MPLAGGN00036", "MPLAGGN00037", "MPLAGGN00038", "MPLAGGN00039", "MPLAGGN00040", "MPLAGGN00041", "MPLAGGN00042", "MPLAGGN00043", "MPLAGGN00044", "MPLAGGN00045", "MPLAGGN00046", "MPLAGGN00047", "MPLAGGN00048", "MPLAGGN00049", "MPLAGGN00050", "MPLAGGN00051", "MPLAGGN00052", "MPLAGGN00053", "MPLAGGN00054", "MPLAGGN00055", "MPLAGGN00056", "MPLAGGN00057", "MPLAGGN00058", "MPLAGGN00059", "MPLAGGN00060", "MPLAGGN00061", "MPLAGGN00062", "MPLAGGN00063", "MPLAGGN00064", "MPLAGGN00065" ], "getShippingPackageDetails": { "Success": { "shippingPackageDetailDTO": { "saleOrderCode": "4090289127609", "boxLength": 120.0, "code": "MPLAGGN00054", "saleOrderDetails": { "addresses": [ { "country": "IN", "pincode": "410206", "city": "Old Panvel", "phone": "96198 09471", "name": "Niranjan Bhutkar .", "addressLine1": "Niranjan Bhutkar 06,B-Wing,Shree sadan indira complex line ali,old panvel. 410206 Old panvel. MH", "addressLine2": "", "id": "6338", "state": "MH" } ], "code": "4090289127609", "created": 1.634111298E12, "displayOrderCode": "MPL Sports12837", "channel": "SHOPIFY", "source": "SHOPIFY", "priority": 0.0, "notificationEmail": "niranjanbhutkar10@gmail.com", "notificationMobile": "9619809471", "cod": false, "displayOrderDateTime": 1.634034578E12, "fulfillmentTat": 1.634207378E12, "billingAddress": { "country": "IN", "pincode": "410206", "city": "Old Panvel", "phone": "96198 09471", "name": "Niranjan Bhutkar .", "addressLine1": "Niranjan Bhutkar 06,B-Wing,Shree sadan indira complex line ali,old panvel. 410206 Old panvel. MH", "addressLine2": "", "id": "6338", "state": "MH" }, "updated": 1.634111702E12, "currencyCode": "INR", "status": "PROCESSING" }, "boxHeight": 20.0, "actualWeight": 500.0, "boxWidth": 160.0, "saleOrderItems": [ { "cashOnDeliveryCharges": 0.0, "prepaidAmount": 0.0, "sellingPriceWithoutTaxesAndDiscount": 0.0, "discount": 1799.0, "centralGstPercentage": 0.0, "shippingAddressId": 6338.0, "channelProductId": "6963022561465-40976385245369", "type": "NORMAL", "itemDetailFields": {}, "shippingPackageStatus": "CREATED", "cancellable": true, "shippingMethodCode": "STD", "itemName": "Official Team India Fan Jersey- Men", "id": 8378.0, "brand": "MPL Sports", "facilityCode": "ESHOPBOX_GURGAON", "shippingMethodCharges": 0.0, "packetConfigurable": false, "hsnCode": "61099010", "giftMessage": "[{\"name\":\"_is_preorder\",\"value\":\"Note: Pre-order item\"}]{\"name\":\"_is_preorder\",\"value\":\"Note: Pre-order item\"} ", "onHold": false, "shippingCharges": 0.0, "created": 1.634111298E12, "itemSku": "S221FEJERS", "totalCentralGst": 0.0, "reversePickable": false, "storeCredit": 0.0, "shippingChargeTaxPercentage": 0.0, "size": "S", "totalUnionTerritoryGst": 0.0, "voucherValue": 0.0, "packetNumber": 1.0, "updated": 1.634111702E12, "maxRetailPrice": 1799.0, "totalStateGst": 0.0, "statusCode": "FULFILLABLE", "code": "10450803228857", "color": "Navy", "totalPrice": 0.0, "totalIntegratedGst": 0.0, "sellerSkuCode": "S221FEJERS", "itemDetailFieldDTOList": [], "sellingPrice": 0.0, "giftWrapCharges": 0.0, "shippingPackageCode": "MPLAGGN00054", "unionTerritoryGstPercentage": 0.0, "facilityName": "Eshopbox Gurgaon", "voucherCode": "Winner100", "editAddress": false, "tcs": 0.0, "integratedGstPercentage": 0.0, "stateGstPercentage": 0.0, "channelSaleOrderItemCode": "10450803228857" } ], "statusCode": "CREATED" }, "errors": [], "successful": true } }, "getSaleOrder": { "Success": { "saleOrderDTO": { "addresses": [ { "country": "IN", "pincode": "410206", "city": "Old Panvel", "phone": "96198 09471", "name": "Niranjan Bhutkar .", "addressLine1": "Niranjan Bhutkar 06,B-Wing,Shree sadan indira complex line ali,old panvel. 410206 Old panvel. MH", "addressLine2": "", "id": "6338", "state": "MH" } ], "code": "4090289127609", "channel": "SHOPIFY", "source": "SHOPIFY", "cancellable": true, "notificationMobile": "9619809471", "shippingPackages": [ { "code": "MPLAGGN00054", "city": "Old Panvel", "channel": "SHOPIFY", "shippingPackageType": "DEFAULT", "paymentReconciled": false, "saleOrderCode": "4090289127609", "created": 1.634111702E12, "shippingMethod": "Standard-Prepaid", "collectableAmount": 0.0, "customFieldValues": [], "noOfItems": 1.0, "invoice": 0.0, "updated": 1.634111702E12, "items": { "S221FEJERS": { "itemName": "Official Team India Fan Jersey- Men", "quantity": 1.0, "itemSku": "S221FEJERS", "itemTypeImageUrl": "https://cdn.shopify.com/s/files/1/0553/4793/7465/files/S2-1-PE-JER.jpg", "itemTypePageUrl": "" } }, "status": "CREATED", "customer": "niranjanbhutkar10@gmail.com" } ], "displayOrderDateTime": 1.634034578E12, "fulfillmentTat": 1.634207378E12, "thirdPartyShipping": false, "saleOrderItems": [ { "cashOnDeliveryCharges": 0.0, "prepaidAmount": 0.0, "sellingPriceWithoutTaxesAndDiscount": 1799.0, "discount": 1799.0, "centralGstPercentage": 0.0, "shippingAddressId": 6338.0, "channelProductId": "6963022561465-40976385245369", "type": "NORMAL", "shippingPackageStatus": "CREATED", "cancellable": true, "shippingMethodCode": "STD", "itemName": "Official Team India Fan Jersey- Men", "id": 8378.0, "brand": "MPL Sports", "facilityCode": "ESHOPBOX_GURGAON", "shippingMethodCharges": 0.0, "shelfCode": "DEFAULT", "packetConfigurable": false, "hsnCode": "61099010", "giftMessage": "[{\"name\":\"_is_preorder\",\"value\":\"Note: Pre-order item\"}]{\"name\":\"_is_preorder\",\"value\":\"Note: Pre-order item\"} ", "onHold": false, "shippingCharges": 0.0, "created": 1.634111298E12, "itemSku": "S221FEJERS", "totalCentralGst": 0.0, "reversePickable": false, "storeCredit": 0.0, "shippingChargeTaxPercentage": 0.0, "size": "S", "customFieldValues": [], "totalUnionTerritoryGst": 0.0, "voucherValue": 0.0, "packetNumber": 1.0, "updated": 1.634111702E12, "maxRetailPrice": 1799.0, "totalStateGst": 0.0, "statusCode": "FULFILLABLE", "code": "10450803228857", "color": "Navy", "totalPrice": 0.0, "totalIntegratedGst": 0.0, "alternateFacilityCode": "AGGN", "sellerSkuCode": "S221FEJERS", "itemDetailFieldDTOList": [], "sellingPrice": 0.0, "giftWrapCharges": 0.0, "shippingPackageCode": "MPLAGGN00054", "unionTerritoryGstPercentage": 0.0, "imageUrl": "https://cdn.shopify.com/s/files/1/0553/4793/7465/files/S2-1-PE-JER.jpg", "facilityName": "Eshopbox Gurgaon", "voucherCode": "Winner100", "editAddress": true, "tcs": 0.0, "integratedGstPercentage": 0.0, "stateGstPercentage": 0.0, "channelSaleOrderItemCode": "10450803228857", "pageUrl": "" } ], "packetConfigurable": false, "created": 1.634111298E12, "displayOrderCode": "MPL Sports12837", "priority": 0.0, "notificationEmail": "niranjanbhutkar10@gmail.com", "reversePickable": false, "customFieldValues": [], "cFormProvided": false, "cod": false, "returns": [], "billingAddress": { "country": "IN", "pincode": "410206", "city": "Old Panvel", "phone": "96198 09471", "name": "Niranjan Bhutkar .", "addressLine1": "Niranjan Bhutkar 06,B-Wing,Shree sadan indira complex line ali,old panvel. 410206 Old panvel. MH", "addressLine2": "", "id": "6338", "state": "MH" }, "updated": 1.634111702E12, "currencyCode": "INR", "status": "PROCESSING" }, "failedOrderFetch": false, "refreshEnabled": false, "errors": [], "successful": true } } }

Due to this, the calculations for orderTotal and subTotal are done wrong(negative values) and the order is created in failed state on Unicommerce(Eshopbox).

Sample request body for create order API:

{ "vendorOrderNumber": "MPL Sports12837", "balanceDue": 0, "externalChannelID": "CH1267", "orderSiteID": "SHOPIFY", "customerOrderNumber": "MPLAGGN00054", "orderTotal": -1799.0, "paymentType": "Prepaid", "isCOD": "0", "subtotal": -1799.0, "shipMethod": "STD", "shippingAddress": { "customerName": "Niranjan Bhutkar .", "addressLine1": "Niranjan Bhutkar 06,B-Wing,Shree sadan indira complex line ali,old panvel. 410206 Old panvel. MH", "addressLine2": "", "city": "Old Panvel", "state": "MH", "postalCode": "410206", "countryCode": "IN", "countryName": "IN", "contactPhone": "9619809471", "email": "niranjanbhutkar10@gmail.com" }, "thirdPartyShipping": false, "billingAddress": { "customerName": "Niranjan Bhutkar .", "addressLine1": "Niranjan Bhutkar 06,B-Wing,Shree sadan indira complex line ali,old panvel. 410206 Old panvel. MH", "addressLine2": "", "city": "Old Panvel", "state": "MH", "postalCode": "410206", "countryCode": "IN", "countryName": "IN", "contactPhone": "9619809471", "email": "niranjanbhutkar10@gmail.com" }, "taxAmount": 0, "orderDate": "2021-10-13 07:48:18", "items": [ { "productImageUrl": "https://cdn.shopify.com/s/files/1/0553/4793/7465/files/S2-1-PE-JER.jpg", "itemID": "S221FEJERS", "quantity": 1, "lineItemSequenceNumber": "8378", "orderItemID": "10450803228857", "discount": 1799.0, "lineItemTotal": -1799.0, "productUrl": "https://cdn.shopify.com/s/files/1/0553/4793/7465/files/S2-1-PE-JER.jpg", "customerPrice": 0.0, "externalWarehouseID": "MJPAT_109", "productName": "Official Team India Fan Jersey- Men" } ], "shipChargeAmount": 0 }

OrderTotal and subTotal calculated for this order: -1799

 

Possible resolution:

If the get '0' value in the selling price key, we can check for the selling price in another key - sellingPriceWithoutTaxesAndDiscount and proceed further.