/** * Returns prepared request * @return WebServiceSoap\SveaRequest */ public function prepareRequest($priceIncludingVat = NULL) { $errors = $this->validateRequest(); $sveaDeliverOrder = new WebServiceSoap\SveaDeliverOrder(); $sveaDeliverOrder->Auth = $this->getStoreAuthorization(); $orderInformation = new WebServiceSoap\SveaDeliverOrderInformation($this->orderBuilder->orderType); $orderInformation->SveaOrderId = $this->orderBuilder->orderId; $orderInformation->OrderType = $this->orderBuilder->orderType; if ($this->orderBuilder->orderType == \ConfigurationProvider::INVOICE_TYPE) { $invoiceDetails = new WebServiceSoap\SveaDeliverInvoiceDetails(); $invoiceDetails->InvoiceDistributionType = $this->orderBuilder->distributionType; $invoiceDetails->IsCreditInvoice = isset($this->orderBuilder->invoiceIdToCredit) ? TRUE : FALSE; // required if (isset($this->orderBuilder->invoiceIdToCredit)) { $invoiceDetails->InvoiceIdToCredit = $this->orderBuilder->invoiceIdToCredit; // optional } $invoiceDetails->NumberOfCreditDays = isset($this->orderBuilder->numberOfCreditDays) ? $this->orderBuilder->numberOfCreditDays : 0; $formatter = new WebServiceRowFormatter($this->orderBuilder, $priceIncludingVat); $orderRow['OrderRow'] = $formatter->formatRows(); $invoiceDetails->OrderRows = $orderRow; $orderInformation->DeliverInvoiceDetails = $invoiceDetails; } $sveaDeliverOrder->DeliverOrderInformation = $orderInformation; $object = new WebServiceSoap\SveaRequest(); $object->request = $sveaDeliverOrder; return $object; }
/** * Format Order row with svea_soap package and calculate vat * @param type $rows * @return \SveaCreateOrderInformation */ protected function formatOrderInformationWithOrderRows($rows) { $orderInformation = new WebServiceSoap\SveaCreateOrderInformation(isset($this->order->campaignCode) ? $this->order->campaignCode : "", isset($this->order->sendAutomaticGiroPaymentForm) ? $this->order->sendAutomaticGiroPaymentForm : 0); // rewrite order rows to soap_class order rows $formatter = new WebServiceRowFormatter($this->order); $formattedOrderRows = $formatter->formatRows(); foreach ($formattedOrderRows as $formattedOrderRow) { $orderInformation->addOrderRow($formattedOrderRow); } return $orderInformation; }