コード例 #1
0
ファイル: Alias.php プロジェクト: roshu1980/add-computers
 /**
  * saves the alias and if given the cvc to the payment information
  *
  * @param Mage_Payment_Model_Info $payment - the payment which should be updated
  * @param array                   $aliasData - the data we will update
  * @param boolean                 $userIsRegistering - is registering method in checkout
  * @param boolean                 $paymentSave - is it necessary to save the payment afterwards
  */
 public function setAliasToPayment(Mage_Payment_Model_Info $payment, array $aliasData, $userIsRegistering = false, $paymentSave = false)
 {
     if (array_key_exists('alias', $aliasData) && 0 < strlen(trim($aliasData['alias']))) {
         $payment->setAdditionalInformation('alias', trim($aliasData['alias']));
         $payment->setAdditionalInformation('userIsRegistering', $userIsRegistering);
         if (array_key_exists('CVC', $aliasData)) {
             $payment->setAdditionalInformation('cvc', $aliasData['CVC']);
             $this->setCardHolderToAlias($payment->getQuote(), $aliasData);
         }
         $payment->setDataChanges(true);
         if ($paymentSave === true) {
             $payment->save();
         }
     } else {
         Mage::helper('ops/data')->log('did not save alias due to empty alias');
         Mage::helper('ops/data')->log($aliasData);
     }
 }
コード例 #2
0
 /**
  * Validate payment method is allowed for the customer's billing address country.
  * @param Mage_Payment_Model_Info $info
  * @return self
  */
 protected function _validateCountry(Mage_Payment_Model_Info $info)
 {
     /**
      * Get the order when dealing with an order payment, quote otherwise.
      * @see Mage_Payment_Model_Method_Abstract
      */
     if ($info instanceof Mage_Sales_Model_Order_Payment) {
         $billingCountry = $info->getOrder()->getBillingAddress()->getCountryId();
     } else {
         $billingCountry = $info->getQuote()->getBillingAddress()->getCountryId();
     }
     if (!$this->canUseForCountry($billingCountry)) {
         throw Mage::exception('EbayEnterprise_CreditCard', $this->_helper->__(self::METHOD_NOT_ALLOWED_FOR_COUNTRY));
     }
     return $this;
 }