|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GFG\DTOMarketplace\Context\Partner\Order; |
|
4
|
|
|
|
|
5
|
|
|
use GFG\DTOMarketplace\Context\Base; |
|
6
|
|
|
|
|
7
|
|
|
class Create extends Base |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* {@inheritdoc} |
|
11
|
|
|
*/ |
|
12
|
1 |
|
public function getHttpMethod() |
|
13
|
|
|
{ |
|
14
|
1 |
|
return 'post'; |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* {@inheritdoc} |
|
19
|
|
|
*/ |
|
20
|
1 |
|
public function exportContextData() |
|
21
|
|
|
{ |
|
22
|
1 |
|
$dataWrapper = $this->getDataWrapper(); |
|
23
|
1 |
|
$itemCollection = []; |
|
24
|
1 |
|
$customerData = $dataWrapper->getCustomer(); |
|
25
|
1 |
|
$shippingAddressData = $dataWrapper->getShippingAddress(); |
|
26
|
1 |
|
$billingAddressData = $dataWrapper->getBillingAddress(); |
|
27
|
|
|
|
|
28
|
|
|
$customer = [ |
|
29
|
1 |
|
'email' => $customerData->getEmail(), |
|
30
|
1 |
|
'first_name' => $customerData->getFirstName(), |
|
31
|
1 |
|
'last_name' => $customerData->getLastName(), |
|
32
|
1 |
|
'document' => $customerData->getDocument(), |
|
33
|
1 |
|
'birthday' => $customerData->getBirthday() |
|
34
|
1 |
|
]; |
|
35
|
|
|
|
|
36
|
|
|
$shippingAddress = [ |
|
37
|
1 |
|
'street' => $shippingAddressData->getStreet(), |
|
38
|
1 |
|
'number' => $shippingAddressData->getNumber(), |
|
39
|
1 |
|
'complement' => $shippingAddressData->getComplement(), |
|
40
|
1 |
|
'city' => $shippingAddressData->getCity(), |
|
41
|
1 |
|
'postcode' => $shippingAddressData->getPostcode(), |
|
42
|
1 |
|
'neighborhood' => $shippingAddressData->getNeighborhood(), |
|
43
|
1 |
|
'region_code' => $shippingAddressData->getRegionCode(), |
|
44
|
1 |
|
'phone' => $shippingAddressData->getPhone(), |
|
45
|
1 |
|
'phone2' => $billingAddressData->getPhone2(), |
|
46
|
1 |
|
]; |
|
47
|
|
|
|
|
48
|
|
|
$billingAddress = [ |
|
49
|
1 |
|
'street' => $billingAddressData->getStreet(), |
|
50
|
1 |
|
'number' => $billingAddressData->getNumber(), |
|
51
|
1 |
|
'complement' => $billingAddressData->getComplement(), |
|
52
|
1 |
|
'city' => $billingAddressData->getCity(), |
|
53
|
1 |
|
'postcode' => $billingAddressData->getPostcode(), |
|
54
|
1 |
|
'neighborhood' => $billingAddressData->getNeighborhood(), |
|
55
|
1 |
|
'region_code' => $billingAddressData->getRegionCode(), |
|
56
|
1 |
|
'phone' => $billingAddressData->getPhone(), |
|
57
|
1 |
|
'phone2' => $billingAddressData->getPhone2(), |
|
58
|
1 |
|
]; |
|
59
|
|
|
|
|
60
|
1 |
|
foreach ($dataWrapper->getItemCollection() as $item) { |
|
61
|
1 |
|
$itemCollection[] = [ |
|
62
|
1 |
|
'id' => $item->getId(), |
|
63
|
1 |
|
'sku' => $item->getSku(), |
|
64
|
1 |
|
'price' => $item->getPrice(), |
|
65
|
1 |
|
'unit_price' => $item->getUnitPrice(), |
|
66
|
1 |
|
'tax_amount' => $item->getTaxAmount(), |
|
67
|
1 |
|
'tax_percent' => $item->getTaxPercent(), |
|
68
|
1 |
|
'shipment_type' => $item->getShipmentType(), |
|
69
|
1 |
|
'shipment_date' => $item->getShipmentDate(), |
|
70
|
1 |
|
'shipment_fee' => $item->getShipmentFee(), |
|
71
|
1 |
|
'supplier_delivery_time' => $item->getSupplierDeliveryTime(), |
|
72
|
1 |
|
'seller_id' => $item->getSellerId(), |
|
73
|
1 |
|
'sku_supplier' => $item->getSkuSupplier(), |
|
74
|
|
|
]; |
|
75
|
1 |
|
} |
|
76
|
|
|
|
|
77
|
1 |
|
return $this->prepareExport([ |
|
78
|
1 |
|
'order_nr' => $dataWrapper->getOrderNr(), |
|
79
|
1 |
|
'bob_order_id' => $dataWrapper->getBobOrderId(), |
|
80
|
1 |
|
'payment_method' => $dataWrapper->getPaymentMethod(), |
|
81
|
1 |
|
'voucher_code' => $dataWrapper->getVoucherCode(), |
|
82
|
1 |
|
'gift_option' => $dataWrapper->getGiftOption(), |
|
83
|
1 |
|
'gift_message' => $dataWrapper->getGiftMessage(), |
|
84
|
1 |
|
'created_at' => $dataWrapper->getCreatedAt(), |
|
85
|
1 |
|
'freight_cost' => $dataWrapper->getFreightCost(), |
|
86
|
1 |
|
'installment_count'=> $dataWrapper->getInstallmentCount(), |
|
87
|
1 |
|
'item_collection' => $itemCollection, |
|
88
|
1 |
|
'customer' => $customer, |
|
89
|
1 |
|
'shipping_address' => $shippingAddress, |
|
90
|
|
|
'billing_address' => $billingAddress |
|
91
|
1 |
|
]); |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|