diff --git a/examples/110_CreateAndSubmitOrder.php b/examples/110_CreateAndSubmitOrder.php index 422dd71..ce988a4 100644 --- a/examples/110_CreateAndSubmitOrder.php +++ b/examples/110_CreateAndSubmitOrder.php @@ -77,7 +77,7 @@ $request->to->location = 'Новосибирск, ул. Державина, 5'; -$request->dimensions->length = 10; +$request->dimensions->length = $length = 10; $request->dimensions->width = 20; $request->dimensions->height = 30; $request->dimensions->weight = 1.25; @@ -146,13 +146,18 @@ $place = $request->addPlace($dimensions); // $place->externalId = '427'; $item = $place->addItem(); +$item->dimensions->length = $length / 2; $item->externalId = '428'; -$item->name = '2 товар'; -$item->count = 1; +$item->name = 'HELP'; +$item->count = 2; $item->price = 500; $item->assessedValue = 500; // $item->tax = $item::TAX_NO_VAT; +$request->cost->assessedValue = 1000; +$request->cost->fullyPrepaid = true; +$request->cost->paymentMethod = $request->cost::PAYMENT_METHOD_PREPAID; + $contact = $request->addContact(); $contact->phone = '+79266056128'; diff --git a/src/Common/Cost.php b/src/Common/Cost.php index 38b2891..7979fe6 100644 --- a/src/Common/Cost.php +++ b/src/Common/Cost.php @@ -47,6 +47,13 @@ */ abstract class Cost { + /** наличными курьеру */ + public const PAYMENT_METHOD_CASH = 'CASH'; + /** картой курьеру */ + public const PAYMENT_METHOD_CARD = 'CARD'; + /** предоплата */ + public const PAYMENT_METHOD_PREPAID = 'PREPAID'; + /** * @JMS\Type("float") * diff --git a/src/Requests/CreateOrderRequest/Builder.php b/src/Requests/CreateOrderRequest/Builder.php index f6a8e92..142bcd7 100644 --- a/src/Requests/CreateOrderRequest/Builder.php +++ b/src/Requests/CreateOrderRequest/Builder.php @@ -85,8 +85,9 @@ public function build(): CreateOrderRequest $this->request->deliveryOption->tariffId = $this->deliveryOption->tariffId; $this->request->deliveryOption->delivery = $this->deliveryOption->cost->delivery; - // $this->request->deliveryOption->deliveryForCustomer = ... ? - // $this->request->deliveryOption->type = 'PICKUP' ...? + $this->request->deliveryOption->deliveryForCustomer = $this->deliveryOption->cost->deliveryForCustomer; + + // $this->request->deliveryOption->type = 'PICKUP'; $this->request->deliveryOption->partnerId = $this->deliveryOption->delivery->partner->id; $this->request->deliveryOption->calculatedDeliveryDateMin = $this->deliveryOption->delivery->calculatedDeliveryDateMin; $this->request->deliveryOption->calculatedDeliveryDateMax = $this->deliveryOption->delivery->calculatedDeliveryDateMax;