Na klar kann ich das hier machen, wobei die Ids für die States und Statemachines aus Eurem System kommen müssen… aber das ist ja eh klar. Ein paar eigene custom fields habe ich im Code, weil ich die halt brauchte… In meiner Schnittstelle erzeuge ich die UUIDs, die ich benötige, einfach selbst… Dazu gehören die für die order selbst, die Adress-Ids, delivery id, transaction id und order customer id. Für die Artikelzeilen dann jeweils ein line item id. Die Rule-IDs müssen ebenfalls angepasst werden (einfach eine bestehende Order über die API auslesen und nachschauen, was da mitgegeben wird).
Anbei mal der JSON Code, den ich verwende, um eine komplette Order mit Status Bezahlt und Versendet zu importieren:
{
"orderNumber":"AB-123456789",
"billingAddressId":"98bc7a7161e948b6a18b8c6117c78d16",
"shippingAddressId":"6c63ee559b2647069be2d91a8ed92d01",
"orderDateTime":"2021-02-03T10:00:00.000+00:00",
"stateId":"147a7d993fc84106b0dd5e601b9f329f",
"currencyId":"b7d2554b0ce847cd82f3ac9bd1c0dfca",
"currencyFactor":1,
"salesChannelId":"8a57c3313cbe4d7b9e4d3bb64a0fd673",
"addresses":[
{
"firstName":"Maxi",
"lastName":"Musterkunde",
"zipcode":"MusterPLZ",
"salutationId":"c11814bbe6b248f88ff9569bbbff447e",
"city":"Musterstadt",
"company":"Musterfirma",
"street":"Musterstrasse 1",
"countryId":"64f8a8b72154499e9f3f27f9d02d7170",
"customFields":{
"external_account_number":"10000"
},
"id":"98bc7a7161e948b6a18b8c6117c78d16"
},
{
"firstName":"Max",
"lastName":"Musterkunde",
"zipcode":"MusterPLZ",
"salutationId":"c11814bbe6b248f88ff9569bbbff447e",
"city":"Musterstadt",
"company":"Musterfirma",
"street":"Musterstrasse 1",
"countryId":"64f8a8b72154499e9f3f27f9d02d7170",
"customFields":{
"external_account_number":"10000-1"
},
"id":"6c63ee559b2647069be2d91a8ed92d01"
}
],
"price":{
"netPrice":100,
"totalPrice":119,
"calculatedTaxes":[
{
"tax":19,
"taxRate":19,
"price":100
}
],
"taxRules":[
{
"taxRate":19,
"percentage":100
}
],
"positionPrice":100,
"taxStatus":"net"
},
"shippingCosts":{
"unitPrice":0,
"quantity":1,
"totalPrice":0,
"calculatedTaxes":[
{
"tax":0,
"taxRate":19,
"price":0
}
],
"taxRules":[
{
"taxRate":19,
"percentage":100
}
]
},
"deliveries":[
{
"orderId":"9eac14428892461ca587e89cd6b53142",
"shippingOrderAddressId":"6c63ee559b2647069be2d91a8ed92d01",
"shippingMethodId":"67762f6d9f73426ab2773c02c5de38d5",
"shippingDateEarliest":"2021-07-15T00:00:00.000+00:00",
"shippingDateLatest":"2021-07-17T00:00:00.000+00:00",
"shippingCosts":{
"unitPrice":0,
"quantity":1,
"totalPrice":0,
"calculatedTaxes":[
{
"tax":0,
"taxRate":19,
"price":0,
"extensions":[
]
}
],
"taxRules":[
{
"taxRate":19,
"percentage":100,
"extensions":[
]
}
]
},
"shippingOrderAddress":{
"countryId":"64f8a8b72154499e9f3f27f9d02d7170",
"salutationId":"c11814bbe6b248f88ff9569bbbff447e",
"firstName":"Max",
"lastName":"Musterkunde",
"street":"Musterstrasse 1",
"zipcode":"MusterPLZ",
"city":"Musterstadt",
"company":"Musterfirma",
"orderId":"9eac14428892461ca587e89cd6b53142",
"id":"6c63ee559b2647069be2d91a8ed92d01"
},
"stateId":"147a7d993fc84106b0dd5e601b9f329f",
"stateMachineState":{
"name":"Versandt",
"technicalName":"shipped",
"stateMachineId":"88bc39326ee2431586a4dbd39cee3843",
"translated":{
"name":"Versandt",
"customFields":[
]
},
"id":"147a7d993fc84106b0dd5e601b9f329f"
},
"id":"bde129b53a484c0cb09b496135ffec9f"
}
],
"lineItems":[
{
"identifier":"f6d7a38eea064818bbba1b8dd0b7328d",
"referencedId":"f6d7a38eea064818bbba1b8dd0b7328d",
"productId":"f6d7a38eea064818bbba1b8dd0b7328d",
"quantity":1,
"unitPrice":100,
"totalPrice":100,
"label":"Testartikel",
"coverId":"1c65c9372a75438a90efa6941dda7a13",
"position":1,
"price":{
"unitPrice":100,
"quantity":1,
"totalPrice":100,
"calculatedTaxes":[
{
"tax":19,
"taxRate":19,
"price":100
}
],
"taxRules":[
{
"taxRate":19,
"percentage":100
}
]
},
"priceDefinition":{
"price":100,
"taxRules":[
{
"taxRate":19,
"percentage":100
}
],
"quantity":1,
"isCalculated":true,
"precision":2,
"type":"quantity"
},
"createdAt":"2021-02-02T10:00:00.000+00:00",
"payload":{
"taxId":"120bdef9627246ae9b50c5db4b6393d8",
"productNumber":"10012345",
"coverId":"1c65c9372a75438a90efa6941dda7a13"
},
"type":"product",
"id":"5d13f2424ec14079887186f22c8671f5"
}
],
"orderCustomer":{
"salutationId":"c11814bbe6b248f88ff9569bbbff447e",
"email":"musterkunde@musterfirma.de",
"firstName":"Vorname",
"lastName":"Nachname",
"company":"Musterfirma",
"customerNumber":"10000",
"customerId":"71341ec3775e40e981e434fd3cf04575",
"id":"c770342d1bd848d5a6c9e6c155bd4c01"
},
"transactions":[
{
"orderId":"9eac14428892461ca587e89cd6b53142",
"paymentMethodId":"d5554d2a810f460c8d9e08aa50c75b6b",
"amount":{
"unitPrice":119,
"quantity":1,
"totalPrice":119,
"calculatedTaxes":[
{
"tax":19,
"taxRate":19,
"price":100,
"extensions":[
]
}
],
"taxRules":[
{
"taxRate":19,
"percentage":100,
"extensions":[
]
}
]
},
"stateMachineState":{
"name":"Bezahlt",
"technicalName":"paid",
"stateMachineId":"6aa46a5e187e400b9e9b61cb4e17ae60",
"translated":{
"name":"Bezahlt",
"customFields":[
]
},
"id":"4a868e791f2045ceab53260c45c8131c"
},
"stateId":"4a868e791f2045ceab53260c45c8131c",
"id":"c00a4d41556f41d8b0a77fff13b5a5c7"
}
],
"stateMachineState":{
"technicalName":"shipped",
"stateMachineId":"88bc39326ee2431586a4dbd39cee3843",
"translated":{
"name":"Versandt",
"customFields":[
]
},
"id":"147a7d993fc84106b0dd5e601b9f329f"
},
"ruleIds":[
"8d031643725b43a8a00b04ad690c4194",
"caa5335322cd46c89b157a77bef57a68",
"cc7d5a475da54270a6aa0b8b6207c248",
"92c24dd21c13419c8275a65f48d19975"
],
"customFields":{
"additional_checkout_fields_partial_delivery":true,
"additional_checkout_fields_desired_delivery_date":"2020-02-24T00:00:00+00:00",
"fair_order":true
},
"id":"9eac14428892461ca587e89cd6b53142"
}
Ich hoffe, es hilft jemandem.
POST über /api/v3/order.
Beste Grüße
Holger