/** * Transforms an order into an invoice * * @param OrderInterface $order * @param InvoiceInterface $invoice */ public function transformFromOrder(OrderInterface $order, InvoiceInterface $invoice) { $event = new OrderTransformEvent($order); $this->eventDispatcher->dispatch(TransformerEvents::PRE_ORDER_TO_INVOICE_TRANSFORM, $event); $invoice->setName($order->getBillingName()); $invoice->setAddress1($order->getBillingAddress1()); $invoice->setAddress2($order->getBillingAddress2()); $invoice->setAddress3($order->getBillingAddress3()); $invoice->setCity($order->getBillingCity()); $invoice->setCountry($order->getBillingCountryCode()); $invoice->setPostcode($order->getBillingPostcode()); $invoice->setEmail($order->getBillingEmail()); $invoice->setFax($order->getBillingFax()); $invoice->setMobile($order->getBillingMobile()); $invoice->setPhone($order->getBillingPhone()); $invoice->setReference($order->getReference()); $invoice->setCurrency($order->getCurrency()); $invoice->setCustomer($order->getCustomer()); $invoice->setTotalExcl($order->getTotalExcl()); $invoice->setTotalInc($order->getTotalInc()); $invoice->setPaymentMethod($order->getPaymentMethod()); $invoice->setLocale($order->getLocale()); foreach ($order->getOrderElements() as $orderElement) { $invoiceElement = $this->createInvoiceElementFromOrderElement($orderElement); $invoiceElement->setInvoice($invoice); $invoice->addInvoiceElement($invoiceElement); } if ($order->getDeliveryCost() > 0) { $this->addDelivery($invoice, $order); } $invoice->setStatus(InvoiceInterface::STATUS_OPEN); $event = new InvoiceTransformEvent($invoice); $this->eventDispatcher->dispatch(TransformerEvents::POST_ORDER_TO_INVOICE_TRANSFORM, $event); }
/** * Returns form parameters for sendbank * * @param OrderInterface $order * @return array */ protected function getFormParameters(OrderInterface $order) { return array('PSPID' => $this->getOption('pspid'), 'orderId' => $order->getReference(), 'amount' => $order->getTotalInc() * 100, 'currency' => $order->getCurrency()->getLabel(), 'language' => $order->getLocale(), 'CN' => $order->getBillingName(), 'EMAIL' => $order->getBillingEmail(), 'ownerZIP' => $order->getBillingPostcode(), 'owneraddress' => $this->getAddress($order), 'ownercty' => $order->getBillingCity(), 'ownertelno' => $order->getBillingPhone() ?: $order->getBillingMobile(), 'homeurl' => $this->getOption('home_url'), 'catalogurl' => $this->getOption('catalog_url'), 'COMPLUS' => "", 'PARAMPLUS' => "bank=" . $this->getCode(), 'PARAMVAR' => "", 'PM' => "CreditCard", 'WIN3DS' => "MAINW", 'PMLIST' => "VISA;MasterCard;CB", "PMListType" => 2, 'accepturl' => $this->generateAbsoluteUrlFromOption('url_callback', $order), 'declineurl' => $this->generateAbsoluteUrlFromOption('url_callback', $order), 'exceptionurl' => $this->generateAbsoluteUrlFromOption('url_return_ko', $order), 'cancelurl' => $this->generateAbsoluteUrlFromOption('url_return_ko', $order), 'operation' => $this->getOperation()); }