/** * @param PayqrInvoice $invoice * @param $diafan */ public function __construct(PayqrInvoice &$invoice, $diafan) { $this->invoice = $invoice; $this->customerData = $invoice->getCustomer(); $this->diafan = $diafan; $this->deliveryData = $invoice->getDelivery(); }
/** * Создание XML-файда в формате InSales для создания заказа * @param PayqrInvoice $invoice * @return string */ public static function getOrderXML($invoice) { $customer = $invoice->getCustomer(); $shipping = $invoice->getDeliveryCasesSelected(); return '<?xml version="1.0" encoding="UTF-8"?> <order> <force type="boolean">true</force> <shipping-address> <address>' . (isset($shipping->city) ? $shipping->l . ' ' : '') . (isset($shipping->street) ? 'Ул. ' . $shipping->street . ' ' : '') . (isset($shipping->house) ? 'Д. ' . $shipping->house . ' ' : '') . (isset($shipping->unit) ? 'Корп. ' . $shipping->unit . ' ' : '') . (isset($shipping->building) ? 'Стр. ' . $shipping->building . ' ' : '') . (isset($shipping->flat) ? 'Кв. ' . $shipping->flat . ' ' : '') . (isset($shipping->hallway) ? 'Под. ' . $shipping->hallway . ' ' : '') . (isset($shipping->floor) ? 'Эт. ' . $shipping->floor . ' ' : '') . (isset($shipping->intercom) ? 'Дмфн.' . $shipping->intercom . ' ' : '') . (isset($shipping->comment) ? $shipping->comment . ' ' : '') . '</address> <country>RU</country> ' . (isset($shipping->city) ? '<city>' . $shipping->city . '</city>' : '') . ' ' . (isset($shipping->zip) ? '<zip>' . $shipping->zip . '</zip>' : '<zip nil="true"/>') . ' ' . (isset($customer->firstName) ? '<name>' . $customer->firstName . '</name>' : '<name nil="true"/>') . ' ' . (isset($customer->phone) ? '<phone>' . $customer->phone . '</phone>' : '<phone nil="true"/>') . ' <state nil="true"/> </shipping-address> <client> ' . (isset($customer->email) ? '<email>' . $customer->email . '</email>' : '') . ' ' . (isset($customer->phone) ? '<phone>' . $customer->phone . '</phone>' : '') . ' ' . (isset($customer->firstName) ? '<name>' . $customer->firstName . '</name>' : '') . ' ' . (isset($customer->middleName) ? '<middlename>' . $customer->middleName . '</middlename>' : '') . ' ' . (isset($customer->lastName) ? '<surname>' . $customer->lastName . '</surname>' : '') . ' </client> <order-lines-attributes type="array"> ' . self::getXmlProduct($invoice) . ' </order-lines-attributes> </order>'; }