getTransactionId(); $checkout->saveTransactionId($transactionId); $returnUrl = BASE_URL . '/' . CURRENT_PAGE . '?type=' . $this->_paymentService . '&id=' . $orderData['invoice'] . '&action='; $data = array( 'invoice' => $orderData['invoice'], 'amount' => Zend_Locale_Math::round($orderData['total'], 2), 'subtotal' => Zend_Locale_Math::round($orderData['subtotal'], 2), 'custom' => array( 'no_note' => true, 'custom' => $transactionId, 'cancel_return' => $returnUrl . 'cancelOrder', 'return' => $returnUrl . 'completeOrder', ), 'itemList' => array() ); if ($orderData[$shippingSection . 'Address']) { $data['custom'] = $data['custom'] + [ 'address1' => $orderData[$shippingSection . 'Address'], 'city' => $orderData[$shippingSection . 'City'], 'first_name' => $orderData[$shippingSection . 'FirstName'], 'last_name' => $orderData[$shippingSection . 'LastName'], 'state' => $orderData[$shippingSection . 'State'], 'country' => 'US', 'zip' => $orderData[$shippingSection . 'Zip'], ]; } if (!empty($orderData['shippingRate'])) { $data['shipping'] = Zend_Locale_Math::Add($orderData['shippingRate'], $orderData['shippingHandling'], 2); $data['shipping'] = Zend_Locale_Math::round($data['shipping'], 2); } if (!empty($orderData['tax'])) { $data['tax'] = Zend_Locale_Math::round($orderData['tax'], 2); } if (!empty($orderData['promo'])) { $data['promo'] = Zend_Locale_Math::round($orderData['promo'], 2); } if (!empty($orderData['giftCard'])) { $data['giftCard'] = Zend_Locale_Math::round($orderData['giftCard'], 2); } } foreach ($cartData as $cartItem) { $data['itemList'][] = array( 'amount' => Zend_Locale_Math::round($cartItem['price'], 2), 'item_name' => $cartItem['title'], 'quantity' => $cartItem['quantity'] ); if (!empty($cartItem['promoValuePrice'])) { $data['promo'] = Zend_Locale_Math::round($cartItem['promoValuePrice'], 2); } } return $data; } public function process() { parent::process(); $form = $this->getPayment()->getPaymentForm(); $form->setAttrib('name', 'payPalForm'); $form->removeDecorator('HtmlTag'); foreach($form->getElements() as $element) { /** @var Zend_Form_Element $element */ $element->removeDecorator('HtmlTag'); $element->removeDecorator('Label'); } $checkoutData = $this->getData(); $transactionId = $checkoutData['custom']['custom']; $cart = new App_ECommerce_Cart_Obj(); $cart->setPrimaryKey($cart->getCartId()); $cart->updateTransactionId($transactionId); $html = '' . '
' . 'You can not be automatically forwarded. To continue, press the "Proceed to Checkout" button
' . ' ' . $form->render() . ' ' . '' . ''; die($html); } }