Example #1
0
 protected function _getBuildPaymentObject($quoteObj, $params = array('payment' => array()))
 {
     $payment = new Varien_Object();
     if (isset($params['payment']) && !empty($params['payment'])) {
         $payment->addData($params['payment']);
     }
     if (Mage::helper('sagepaysuite')->creatingAdminOrder()) {
         $payment->addData($quoteObj->getPayment()->toArray());
     }
     //nit payment
     if (array_key_exists('nit_card_identifier', $params)) {
         $payment->setNitCardIdentifier($params['nit_card_identifier']);
     }
     $payment->setTransactionType(strtoupper($this->getConfigData('payment_action')));
     $payment->setAmountOrdered($this->formatAmount($quoteObj->getGrandTotal(), $quoteObj->getQuoteCurrencyCode()));
     $payment->setRealCapture(true);
     //To difference invoice from capture
     $payment->setOrder(clone $quoteObj);
     $payment->setAnetTransType(strtoupper($this->getConfigData('payment_action')));
     $payment->getOrder()->setOrderCurrencyCode($quoteObj->getQuoteCurrencyCode());
     $payment->getOrder()->setBillingAddress($quoteObj->getBillingAddress());
     if ($quoteObj->isVirtual()) {
         $payment->getOrder()->setShippingAddress($quoteObj->getBillingAddress());
     } else {
         $payment->getOrder()->setShippingAddress($quoteObj->getShippingAddress());
     }
     return $payment;
 }