Hi!
I would like to create a simple plugin-connector with OTTO marketplace.
The Idea is to post the products from a stream with the special name in to OTTO Markeplace via API and then get orders from OTTO into Shopware.
Actually, I am getting the orders data from OTTO sandbox (Demo orders) via API with Curl.
The response with one order looks like this:
{
{
"salesOrderId":"e439b68e-0e27-4475-8f6f-b2ffaf5529f8",
"orderNumber":"bk22dvtvdm",
"orderDate":"2020-07-23T08:29:54.711+0000",
"lastModifiedDate":"2020-07-23T10:29:55.557+0000",
"positionItems":{
0:{
"positionItemId":"ccfd90cd-cf9d-4991-b758-bff29afc1992",
"fulfillmentStatus":"ANNOUNCED",
"itemValueGrossPrice":{
"amount":"499.99",
"currency":"EUR"
},
"product":{
"sku":"SmartCM1000-schwarz-1",
"productTitle":"Smartphone »CallMe 1000«",
"articleNumber":"S0A000SP28AP2",
"ean":"4851278936452",
"vatRate":"19.0"
},
"trackingInfo":"",
"sentDate":""
},
1:{
"positionItemId":"38109946-15ca-4c9e-828d-9c8de1c091ed",
"fulfillmentStatus":"ANNOUNCED",
"itemValueGrossPrice":{
"amount":"499.99",
"currency":"EUR"
},
"product":{
"sku":"SmartCM1000-schwarz-1",
"productTitle":"Smartphone »CallMe 1000«",
"articleNumber":"S0A000SP28AP2",
"ean":"4851278936452",
"vatRate":"19.0"
},
"trackingInfo":"",
"sentDate":""
},
2:{
"positionItemId":"808053a1-89e1-4775-84bb-8f608fad2912",
"fulfillmentStatus":"ANNOUNCED",
"itemValueGrossPrice":{
"amount":"250",
"currency":"EUR"
},
"product":{
"sku":"0440-Rasen-T-V1",
"productTitle":"Rasenmaeher »Turbo V1«",
"articleNumber":"S0C456SP44CP2",
"ean":"9821393948573",
"vatRate":"19.0"
},
"trackingInfo":"",
"sentDate":""
},
3:{
"positionItemId":"492de58d-7c09-4daf-89d6-a7fc1fffeb3c",
"fulfillmentStatus":"ANNOUNCED",
"itemValueGrossPrice":{
"amount":"250",
"currency":"EUR"
},
"product":{
"sku":"0440-Rasen-T-V1",
"productTitle":"Rasenmaeher »Turbo V1«",
"articleNumber":"S0C456SP44CP2",
"ean":"9821393948573",
"vatRate":"19.0"
},
"trackingInfo":"",
"sentDate":""
}
},
"orderLifecycleInformation":{
"lifecycleChangeDate":"2020-07-23T10:29:55.555+0000"
},
"initialServiceFees":{
0:{
"name":"DELIVERY_FEE_STANDARD",
"amount":"5.95",
"currency":"EUR",
"positionItemIds":{
0:"ccfd90cd-cf9d-4991-b758-bff29afc1992",
1:"38109946-15ca-4c9e-828d-9c8de1c091ed",
2:"808053a1-89e1-4775-84bb-8f608fad2912",
3:"492de58d-7c09-4daf-89d6-a7fc1fffeb3c"
},
"vatRate":"19"
}
},
"deliveryAddress":{
"salutation":"MS",
"title":"",
"lastName":"Sanbox",
"firstName":"Kundin",
"street":"Werner-Otto-Straße",
"addition":"3. Stock",
"houseNumber":"7",
"city":"Hamburg",
"zipCode":"22179",
"countryCode":"DEU"
},
"invoiceAddress":{
"salutation":"MR",
"title":"Dr.",
"lastName":"Sandbox",
"firstName":"Kunde",
"street":"Werner-Otto-Straße",
"addition":"Testkunde",
"houseNumber":"1",
"city":"Hamburg",
"zipCode":"22179",
"countryCode":"DEU"
},
"links":{
0:{
"rel":"self",
"href":"/v3/orders/e439b68e-0e27-4475-8f6f-b2ffaf5529f8"
}
}
},
}
My Idea was to insert orders from OTTO in s_orders table on Shopware. Then after status change to update the order data in OTTO…
When the order is created in Shopware, first is created a new user and the order is attached to this user.
How should I do with OTTO orders? Should I first extract from API response the new user data and insert in SW s_user then insert order data connected to this user? And what to do with data which are requested in SW for an order but are missing in OTTO response? The SW table does not accept empty values.