/** * Validate payment method information object * * @return Mage_Payment_Model_Method_Abstract */ public function validate() { parent::validate(); $paymentInfo = $this->getInfoInstance(); $paymentStoredCardId = $paymentInfo->getAdditionalInformation('stored_card_id'); $isError = true; // Check if customer ID is available if (!$this->_callerMethod->getCustomerId()) { if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) { $customerId = $paymentInfo->getOrder()->getCustomerId(); } else { $customerId = $paymentInfo->getQuote()->getCustomerId(); } $this->_callerMethod->setCustomerId($customerId); } // Check stored card ID for validity if ($paymentStoredCardId) { $storedCards = $this->getStoredCards(); if ($storedCards && $storedCards->count() > 0) { foreach ($storedCards as $storedCard) { if ($storedCard->getStoredCardId() == $paymentStoredCardId) { // Also keep stored card transaction ID $paymentInfo->setAdditionalInformation('stored_card_transaction_id', $storedCard->getTransactionId()); $isError = false; break; } } } } if ($isError) { Mage::throwException(Mage::helper('cls_paypal')->__('Please select valid saved card')); } return $this->_callerMethod; }
/** * Validate payment method information object * * @return Mage_Payment_Model_Method_Abstract */ public function validate() { parent::validate(); if (!($originalOrderData = $this->_getOriginalOrderData())) { Mage::throwException(Mage::helper('cls_paypal')->__('Unable to get the transaction data')); } else { // Keep payment-specific data $paymentInfo = $this->getInfoInstance(); $paymentInfo->setAdditionalInformation('orderstored_original_order_id', $originalOrderData['order_id']); $paymentInfo->setAdditionalInformation('orderstored_transaction_id', $originalOrderData['transaction_id']); } return $this->_callerMethod; }
/** * Validate payment method information object * * @return Mage_Payment_Model_Method_Cc */ public function validate() { return $this->_commonMethod->validate(); }