ItsPerfect Create Orders
Summary of Changes: (The purpose of this table is to keep traceability and Product team to highlight the things that were changed into the scope, based on comments or discussions)
Version | Date | Created / Updated | Notes |
---|---|---|---|
v1.0 | N/A | Hristiyan | First publish |
v1.1 | 01/04/2024 | Hristiyan | Added clarification about some Billing fields |
v1.2 | 29/05/2024 | Hristiyan | Added new object in the payload + mapping |
ItsPerfect allow us to create orders into their system direclty via API.
API Docs : https://www.itsperfect-solutions.com/api-v2/orders&method=actie_post
API Call : POST /api/v2/orders
We want to create order in ItsPerfect when we have the following statuses/flags :
Orders > Splitted Shipping Cost
= Yes
Product on Order > Check For Bundle
= Yes
Order > Order Status
= Ready For Shipping
Order > Connector Order ID
= ""
Product on Order > Connector Order ID
= ""
Product on Order > Connector Exported
= No
Order > Connector Error
= ""
Product on Order > Seller != ''
The request will be in a JSON format where we need to put all the information in the body.
Example request :
{
"orderType": "2",
"date": "2024-02-12 13:25:04",
"reference": "test1235test",
"orderNumber": "123test",
"customerId": "test",
"currency": "USD",
"warehouseId": "3",
"shippingCosts": "0",
"comment": "Test order2",
"internalComment": "Internal comment",
"channel": {
"orderNumber": "12345678",
"orderId": "gb943626472_ee7c646f8046475f953a73dfe980500d-A"
},
"shippingAddress": {
"addressId": "",
"name": "Test customer",
"street": "Invoice street",
"housenumber": "1",
"housenumberExtension": "a",
"postalCode": "1234 AB",
"city": "Amsterdam",
"countryId": "1",
"email": "email@customer.nl",
"phone": "+31.12345678"
},
"invoiceAddress": {
"addressId": "",
"name": "Test customer",
"street": "Billing street",
"housenumber": "3",
"housenumberExtension": "b",
"postalCode": "125 AB",
"city": "London",
"countryId": "1",
"email": "email@customer.nl",
"phone": "+31.12345678"
},
"items": [
{
"barcode": "8718192021544",
"quantity": "1"
}
]
}
Request mapping (please note all non-required nodes should be excluded from the payload if we don’t have data for them):
ItsPerfect Field | Required | Notes | Hemi Field | Notes | |
---|---|---|---|---|---|
orderType |
Yes | N/A | Hardcoded as “2” | ||
date |
Yes | Orders > Order Created Time |
Should be in ISO 8601 format: YYYY-MM-DD hh:mm:ss | ||
reference |
Yes | Orders > Marketplace Order ID |
|||
orderNumber |
Yes | Orders > ID |
|||
customerId |
No | Orders > Buyer User ID |
|||
currency |
No | Orders > Order Currency |
|||
warehouseId |
Yes | Account ItsPerfect Connector > Warehouse |
We need to send the ID | ||
shippingCosts |
No | Orders > Shipping Service Cost |
|||
comment |
No | Orders > Note |
|||
internalComment |
No | N/A | |||
<v1.2>channel |
|||||
orderNumber |
Orders > Marketplace Order ID |
||||
orderId |
Orders > ID </v1.2> |
||||
shippingAddress |
|||||
addressId |
N/A | ||||
name |
No | Orders > Shipping Buyer Name |
|||
street |
Yes | Orders > Shipping Street 1 |
|||
Orders > Shipping Street2 |
We need to check and if we have both streets filled to send them both in the same street node separated with an empty space |
||||
housenumber |
No | N/A | |||
housenumberExtension |
No | N/A | |||
postalCode |
Yes | Orders > Shipping Postal Code |
|||
city |
Yes | Orders > Shipping City |
|||
countryId |
Yes | ItsPerfect Countries > ID |
Needs to be the ID that corresponds to the Order > Shipping Country Name |
OR
Orders
> Shipping Country Code
We want to check for the country name and if it is not filled we check for the country code.
If after the validation if there is no match in the countries (for example the Order
> Shipping Country Name
or Shipping Country Code
does not match to any country in ItsPerfect) we want to store an error in Order Error
table with type Connector
stating the country could not be found. |
| | email
| No | | Orders
> Buyer Mail
| |
| | phone
| No | | Orders
> Shipping Phone
| |
| invoiceAddress
| | | | | |
| | addressId
| | | N/A | |
| | name
| No | | Orders
> Billing Name
| |
| | street
| No | <v1.1>The node is not required by default, but if we are sending any Billing information then it becomes required.</v1.1> | Orders
> Billing treet 1
Orders
> Billing Street2
| We need to check and if we have both streets filled, to send them both in the same street
node
separated with an empty space |
| | housenumber
| No | | N/A | |
| | housenumberExtension
| No | | N/A | |
| | postalCode
| No | <v1.1>The node is not required by default, but if we are sending any Billing information then it becomes required.</v1.1> | Orders
> Billing Postal Code
| |
| | city
| No | <v1.1>The node is not required by default, but if we are sending any Billing information then it becomes required.</v1.1> | Orders
> Billing CIty Name
| |
| | countryId
| No | <v1.1>The node is not required by default, but if we are sending any Billing information then it becomes required.</v1.1> | ItsPerfect Countries
> ID
| Needs to be the ID that corresponds to the Order
> Billing Country Name
OR
Orders
> Billing
Country Code
We want to heck for the country name and if it is not filled we check for the country code.
If after the validation if there is no match in the countries (for example the Order
> Billing
Country Name
or Shipping Country Code
does not match to any country in ItsPerfect) we want to store an error in Order Error
table with type Connector
stating the country could not be found. |
| | email
| No | | Orders
> Buyer Mail
| |
| | phone
| No | | Orders
> Billing Phone
| |
| items
| | | | | |
| | barcode
| Yes | | Product in Order
> EAN
OR
Product
> EAN
| Product in Order
is with priority. We want to pick it from Product
only if it is missing in the Product in Order
|
| | quantity
| Yes | | Product in Order
> Quantity
| |
Example response :
{
"affectedRows": "1",
"insertId": "862",
"customerId": "1931",
"shippingAddressId": "4409",
"invoiceAddressId": "4408"
}
Response mapping :
ItsPerfect field | Hemi Field | Notes |
---|---|---|
affectedRows |
N/A | |
insertId |
Orders > Connector Order ID |
AND
Product In Order
> Connector ID
| |
| customerId
| N/A | |
| shippingAddressId
| N/A | |
| invoiceAddressId
| N/A | |
When creating an order in ItsPerfect we need to validate the country
with Orders
> Shipping Country Name
and send the respective ID in the create orders payload.
Example : If we have Orders
> Shipping Country Name
= United Kingdom, we need to validate this and send countryId
= 28 in the Create Orders payload.
If a warehouse that we are using (is selected in the Account ItsPerfect
> Warehouse
has become inactive, we should have an internal validation and store an error in Order Error
with type Connector
stating that there is no warehouse selected when trying to export an order.
After successful order creation we will need to update also Product In Order
> Connector Exported
= Yes
Any errors we want to store in both Orders
> Connector Error
and Order Error
with type Connector
field. If there is an error, the response will be similar :
{
"error": "shippingAddress: The variable countryId ('15556') is unknown in the system"
}