/** * Prepare shipping data. * * @param array $data * @return array */ protected function prepareShippingData(array $data) { $result = ['order' => ['billing_address' => $data['billing_address']], 'payment' => $this->order->getPaymentAuthExpiration(), 'reset_shipping' => 1, 'shipping_as_billing' => 1]; return $result; }
/** * Set payment method to quote. * * @param OrderInjectable $order * @return void * @throws \Exception */ protected function setPaymentMethod(OrderInjectable $order) { $url = $this->url . '/selected-payment-method'; $data = ["cartId" => $this->quote, "method" => $order->getPaymentAuthExpiration()]; $this->webapiTransport->write($url, $data, WebapiDecorator::PUT); $response = json_decode($this->webapiTransport->read(), true); $this->webapiTransport->close(); if (!is_numeric($response)) { $this->eventManager->dispatchEvent(['webapi_failed'], [$response]); throw new \Exception('Could not set payment method to quote!'); } }