コード例 #1
0
 /**
  * @param Enlight_Hook_HookArgs $args
  */
 public function onBeforeRenderDocument(Enlight_Hook_HookArgs $args)
 {
     /* @var Shopware_Components_Document $document */
     $document = $args->getSubject();
     $order = $document->_order;
     if ($order->payment['name'] != 'paypal') {
         return;
     }
     $orderNumber = $order->order->ordernumber;
     $puiOrderNumber = $this->getPuiOrderNumbers(array($orderNumber));
     if (empty($puiOrderNumber)) {
         return;
     }
     /* @var Smarty_Data $view */
     $view = $document->_view;
     $orderData = $view->getTemplateVars('Order');
     $containers = $view->getTemplateVars('Containers');
     if (!isset($containers['Paypal_Content_Info'])) {
         return;
     }
     $invoiceContentProvider = new InvoiceContentProvider($this->get('db'));
     $rawFooter = $invoiceContentProvider->getPayPalInvoiceContentInfo($containers, $orderData);
     $containers['Paypal_Content_Info']['value'] = $rawFooter['value'];
     // is necessary to get the data in the invoice template
     $view->assign('Containers', $containers);
     $transactionId = $orderData['_order']['transactionID'];
     $orderNumber = $orderData['_order']['ordernumber'];
     $paymentInstructionProvider = new PaymentInstructionProvider($this->get('db'));
     $paymentInstruction = $paymentInstructionProvider->getInstructionsByOrderNumberAndTransactionId($orderNumber, $transactionId);
     $document->_template->addTemplateDir(dirname(__FILE__) . '/Views/');
     $document->_template->assign('instruction', (array) $paymentInstruction);
     $containerData = $view->getTemplateVars('Containers');
     $containerData['Footer'] = $containerData['Paypal_Footer'];
     $containerData['Content_Info'] = $containerData['Paypal_Content_Info'];
     $containerData['Content_Info']['value'] = $document->_template->fetch('string:' . $containerData['Content_Info']['value']);
     $containerData['Content_Info']['style'] = '}' . $containerData['Content_Info']['style'] . ' #info {';
     $view->assign('Containers', $containerData);
 }
コード例 #2
0
 /**
  * save the invoice instructions from paypal
  *
  * @param string $orderNumber
  * @param array $payment
  */
 private function saveInvoiceInstructions($orderNumber, array $payment)
 {
     $paymentInstructionProvider = new PaymentInstructionProvider($this->paypalBootstrap->get('db'));
     $paymentInstructionProvider->saveInstructionByOrderNumber($orderNumber, $payment['payment_instruction']);
 }
コード例 #3
0
 /**
  * @param \Enlight_View_Default $view
  * @param int $templateVersion
  */
 private function addInvoiceInstructionsToView($view, $templateVersion)
 {
     $paymentInstructionProvider = new PaymentInstructionProvider($this->bootstrap->get('db'));
     $orderData = $view->getAssign();
     $instruction = $paymentInstructionProvider->getInstructionsByOrderNumberAndTransactionId($orderData['sOrderNumber'], $orderData['sTransactionumber']);
     $view->assign('payPalPlusInvoiceInstruction', $instruction);
     $payment = $orderData['sPayment'];
     if ($payment['name'] !== 'paypal') {
         return;
     }
     $validator = new APIValidator($this->restClient);
     if ($validator->isAPIAvailable()) {
         $payment['description'] = $this->bootstrap->Config()->get('paypalPlusDescription', '');
         $view->assign('sPayment', $payment);
     }
     $this->bootstrap->registerMyTemplateDir();
     if ($templateVersion < 3) {
         $view->extendsTemplate('frontend/checkout/emotion/finish.tpl');
     }
 }