Пример #1
0
 /**
  * Saves payment information in session
  * This workaround is used for correct functionality at Magento 1.4+
  * @param object $observer
  */
 public function savePaymentInfoInSession($observer)
 {
     try {
         if (!AW_Sarp_Model_Subscription::isIterating()) {
             $quote = $observer->getEvent()->getQuote();
             if (!$quote->getPaymentsCollection()->count()) {
                 return;
             }
             $Payment = $quote->getPayment();
             if ($Payment && $Payment->getMethod()) {
                 if ($Payment->getMethodInstance() instanceof Mage_Payment_Model_Method_Cc) {
                     // Credit Card number
                     if ($Payment->getMethodInstance()->getInfoInstance() && ($ccNumber = $Payment->getMethodInstance()->getInfoInstance()->getCcNumber())) {
                         $ccCid = $Payment->getMethodInstance()->getInfoInstance()->getCcCid();
                         $ccType = $Payment->getMethodInstance()->getInfoInstance()->getCcType();
                         $ccExpMonth = $Payment->getMethodInstance()->getInfoInstance()->getCcExpMonth();
                         $ccExpYear = $Payment->getMethodInstance()->getInfoInstance()->getCcExpYear();
                         Mage::getSingleton('customer/session')->setSarpCcNumber($ccNumber);
                         Mage::getSingleton('customer/session')->setSarpCcCid($ccCid);
                     }
                 }
             }
         }
     } catch (Exception $e) {
         //throw($e);
     }
 }
Пример #2
0
 public function authorize(Varien_Object $payment, $amount)
 {
     if (AW_Sarp_Model_Subscription::isIterating()) {
         $Subscription = AW_Sarp_Model_Subscription::getInstance()->processPayment($payment->getOrder());
         return $this;
     }
     return parent::authorize($payment, $amount);
 }
Пример #3
0
 public function authorize(Varien_Object $payment, $amount)
 {
     if (AW_Sarp_Model_Subscription::isIterating()) {
         $Subscription = AW_Sarp_Model_Subscription::getInstance()->processPayment($payment->getOrder());
         return $this;
     }
     $result = parent::authorize($payment, $amount);
     $verify_result = Mage::getModel('sarp/payment_method_paypaluk_direct')->getPnref($payment, $amount, $payment->getOrder()->getBaseCurrencyCode());
     Mage::dispatchEvent(self::EVENT_NAME_AUTH_AFTER, array('verification' => $verify_result));
     return $result;
 }
Пример #4
0
 public function authorize(Varien_Object $payment, $amount)
 {
     if (AW_Sarp_Model_Subscription::isIterating()) {
         AW_Sarp_Model_Subscription::getInstance()->processPayment($payment->getOrder());
         if (Mage::helper('sarp')->checkVersion('1.5.0.0')) {
             $this->_copyDataFromLastPayment($payment, $amount, parent::REQUEST_TYPE_AUTH_ONLY);
             $this->_placeTransaction($payment, $amount, parent::REQUEST_TYPE_AUTH_ONLY);
             $payment->setSkipTransactionCreation(1);
         }
         return $this;
     }
     return parent::authorize($payment, $amount);
 }
Пример #5
0
 /**
  * Validate payment method information object
  *
  * @param   Mage_Payment_Model_Info $info
  * @return  Mage_Payment_Model_Abstract
  */
 public function validate()
 {
     if (AW_Sarp_Model_Subscription::isIterating()) {
         if (!self::$poIsset) {
             $info = $this->getInfoInstance();
             if ($info) {
                 $poNumber = $info->getData('po_number');
                 if ($poNumber) {
                     $info->setPoNumber($poNumber . '-' . Mage::getModel('core/date')->date('dmy'));
                     self::$poIsset = true;
                 }
             }
         }
         return $this;
     } else {
         return parent::validate();
     }
 }