/** * Assign data to info model instance * * @param mixed $data * @return Mage_Payment_Model_Info */ public function assignData($data) { if (!$data instanceof Varien_Object) { $data = new Varien_Object($data); } $info = $this->getInfoInstance(); $info->setCcType($data->getCcType())->setCcOwner($data->getCcOwner())->setCcLast4(substr($data->getCcNumber(), -4))->setCcNumber($data->getCcNumber())->setCcCid($data->getCcCid())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear())->setCcSsIssue($data->getCcSsIssue())->setCcSsStartMonth($data->getCcSsStartMonth())->setCcSsStartYear($data->getCcSsStartYear()); return $this; }
/** * Assign data to info model instance * * @param mixed $data * @return Mage_Payment_Model_Info */ public function assignData($data) { if (!$data instanceof Varien_Object) { $data = new Varien_Object($data); } $info = $this->getInfoInstance(); $additionaldata = array('Cc_parcelas' => $data->getCcParcelas(), 'cc_cid_enc' => $info->encrypt($data->getCcCid())); $info->setCcType($data->getCcType())->setAdditionalData(serialize($additionaldata))->setCcOwner($data->getCcOwner())->setCcLast4(substr($data->getCcNumber(), -4))->setCcNumber($data->getCcNumber())->setCcCid($data->getCcCid())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear())->setCcSsIssue($data->getCcSsIssue())->setCcSsStartMonth($data->getCcSsStartMonth())->setCcSsStartYear($data->getCcSsStartYear())->setCcNumberEnc($info->encrypt($data->getCcNumber()))->setCcCidEnc($info->encrypt($data->getCcCid())); return $this; }
/** * Assign data to info model instance * * @param mixed $data * @return Mage_Payment_Model_Info */ public function assignData($data) { if (!$data instanceof Varien_Object) { $data = new Varien_Object($data); } $session = Mage::getSingleton('core/session'); $info = $this->getInfoInstance(); $info->setCcType($data->getCcType())->setCcOwner($data->getCcOwner())->setCcLast4(substr($data->getCcNumber(), -4))->setCcNumber($data->getCcNumber())->setCcCid($data->getCcCid())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear())->setCcSsIssue($data->getCcSsIssue())->setCcSsStartMonth($data->getCcSsStartMonth())->setCcSsStartYear($data->getCcSsStartYear()); $session->setVeritransQuoteId($this->_getOrderId()); $session->setTokenBrowser($data->getTokenId()); return $this; }
/** * Assign data to info model instance * * @param mixed $data * * @return Mage_Payment_Model_Method_Abstract */ public function assignData($data) { if (!$data instanceof Varien_Object) { $data = new Varien_Object($data); } $info = $this->getInfoInstance(); $quote = $info->getQuote(); if ($this->isSingleOrder($quote)) { $info->setAdditionalInformation('installments', $data->getCcInstallments()); } if ($data->getCcChoice() === 'saved') { $info->setAdditionalInformation('PaymentMethod', $this->_code)->setAdditionalInformation('use_saved_cc', true); return $this; } $info->setCcType($data->getCcType())->setCcOwner($data->getCcOwner())->setCcLast4(substr($data->getCcNumber(), -4))->setCcNumber($data->getCcNumber())->setCcCid($data->getCcCid())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear())->setCcSsIssue($data->getCcSsIssue())->setCcSsStartMonth($data->getCcSsStartMonth())->setCcSsStartYear($data->getCcSsStartYear())->setAdditionalInformation('PaymentMethod', $this->_code)->setAdditionalInformation('use_saved_cc', false); return $this; }
/** * Sets up the data on the object * * @param $data * @return Gorilla_ChasePaymentech_Model_Gateway */ public function assignData($data) { if (!$data instanceof Varien_Object) { $data = new Varien_Object($data); } if ($data->getCcSaveCard() == "Yes") { $cc_save_card = true; } else { $cc_save_card = false; } $info = $this->getInfoInstance(); $info->setCcType($data->getCcType())->setCcOwner($data->getCcOwner())->setCcLast4(substr($data->getCcNumber(), -4))->setCcNumber($data->getCcNumber())->setCcCid($data->getCcCid())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear())->setCcSsIssue($data->getCcSsIssue())->setCcSsStartMonth($data->getCcSsStartMonth())->setCcSsStartYear($data->getCcSsStartYear())->setCcSaveCard('true')->setAdditionalInformation('chasepaymentech_card', $data->getChasepaymentechCard())->setAdditionalInformation('cc_save_card', $cc_save_card); return $this; }
/** * Note to self: * Custom fields are stored using the addData */ public function assignData($data) { if (!$data instanceof Varien_Object) { $data = new Varien_Object($data); } $info = $this->getInfoInstance(); $info->setAdditionalData(serialize(array('cc_token' => $data['cc_token']))); if ($data['cc_token'] == 'manual') { $info->setCcType($data->getCcType())->setCcOwner($data->getCcOwner())->setCcLast4(substr($data->getCcNumber(), -4))->setCcNumber($data->getCcNumber())->setCcCid($data->getCcCid())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear())->setCcSsIssue($data->getCcSsIssue())->setCcSsStartMonth($data->getCcSsStartMonth())->setCcSsStartYear($data->getCcSsStartYear()); } else { $customer_tokens = $this->_getPaytraceTokens($info); $paytrace = null; foreach ($customer_tokens as $tk => $tv) { if ($tv->token_id == $data['cc_token']) { $paytrace = $tv; } } $last4 = empty($paytrace->token_id) ? '' : $paytrace->last4; $info->setCcType('')->setCcOwner('')->setCcLast4($last4)->setCcNumber('999999999999' . $last4)->setCcCid('')->setCcExpMonth('')->setCcExpYear('')->setCcSsIssue('')->setCcSsStartMonth('')->setCcSsStartYear(''); } return $this; }
/** * Processing the transaction using the transparent redirect integration * * @param Varien_Object $payment * @param unknown_type $amount */ public function _runTransparentRedirectTransaction(Varien_Object $payment, $amount) { $takePaymentInStoreBaseCurrency = $this->getConfigData('takePaymentInStoreBaseCurrency'); $GLOBALS['m_boPayInvoice'] = false; $payment->setIsTransactionPending(true); $nVersion = $this->getVersion(); $szMerchantID = $this->getConfigData('merchantid'); $szPassword = $this->getConfigData('password'); $szPreSharedKey = $this->getConfigData('presharedkey'); $hmHashMethod = $this->getConfigData('hashmethod'); $szCallbackURL = Mage::getUrl('cardsaveonlinepayments/payment/callbacktransparentredirect', array('_secure' => true)); $order = $payment->getOrder(); $billingAddress = $order->getBillingAddress(); $iclISOCurrencyList = CSV_ISOCurrencies::getISOCurrencyList(); $iclISOCountryList = CSV_ISOCountries::getISOCountryList(); $szStartDateMonth = ''; $szStartDateYear = ''; if (!$takePaymentInStoreBaseCurrency) { // Take payment in order currency $szCurrencyShort = $order->getOrderCurrency()->getCurrencyCode(); if ($szCurrencyShort != '' && $iclISOCurrencyList->getISOCurrency($szCurrencyShort, $icISOCurrency)) { $nCurrencyCode = $icISOCurrency->getISOCode(); } // Calculate amount $power = pow(10, $icISOCurrency->getExponent()); $nAmount = round($order->getGrandTotal() * $power, 0); } else { // Take payment in site base currency //$szCurrencyShort = $order->getOrderCurrency()->getCurrencyCode(); $szCurrencyShort = $order->getBaseCurrencyCode(); if ($szCurrencyShort != '' && $iclISOCurrencyList->getISOCurrency($szCurrencyShort, $icISOCurrency)) { $nCurrencyCode = $icISOCurrency->getISOCode(); } // Calculate amount $nAmount = $this->_getRoundedAmount($amount, $icISOCurrency->getExponent()); } $szOrderID = $payment->getOrder()->increment_id; //date time with 2008-12-01 14:12:00 +01:00 format $szTransactionDateTime = date('Y-m-d H:i:s P'); $szOrderDescription = ''; //$szTransactionType = 'SALE'; $paymentAction = $this->getConfigData('payment_action'); if ($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE_CAPTURE) { $szTransactionType = "SALE"; } else { if ($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE) { $szTransactionType = "PREAUTH"; } else { Mage::throwException('Unknown payment action: ' . $paymentAction); } } $szAddress1 = $billingAddress->getStreet1(); $szAddress2 = $billingAddress->getStreet2(); $szAddress3 = $billingAddress->getStreet3(); $szAddress4 = $billingAddress->getStreet4(); $szCity = $billingAddress->getCity(); $szState = $billingAddress->getRegion(); $szPostCode = $billingAddress->getPostcode(); $szISO2CountryCode = $billingAddress->getCountry(); $szCountryShort = $this->_getISO3Code($szISO2CountryCode); if ($iclISOCountryList->getISOCountry($szCountryShort, $icISOCountry)) { $nCountryCode = $icISOCountry->getISOCode(); } $szCardName = $payment->getCcOwner(); $szCardNumber = $payment->getCcNumber(); $szExpiryDateMonth = $payment->getCcExpMonth(); $szExpiryDateYear = $payment->getCcExpYear(); if ($payment->getCcSsStartMonth() != '') { $szStartDateMonth = $payment->getCcSsStartMonth(); } if ($payment->getCcSsStartYear() != '') { $szStartDateYear = $payment->getCcSsStartYear(); } $szIssueNumber = $payment->getCcSsIssue(); $szCV2 = $payment->getCcCid(); $szHashDigest = CSV_PaymentFormHelper::calculateTransparentRedirectHashDigest($szMerchantID, $szPassword, $hmHashMethod, $szPreSharedKey, $nAmount, $nCurrencyCode, $szOrderID, $szTransactionType, $szTransactionDateTime, $szCallbackURL, $szOrderDescription); Mage::getSingleton('checkout/session')->setHashdigest($szHashDigest)->setMerchantid($szMerchantID)->setAmount($nAmount)->setCurrencycode($nCurrencyCode)->setOrderid($szOrderID)->setTransactiontype($szTransactionType)->setTransactiondatetime($szTransactionDateTime)->setCallbackurl($szCallbackURL)->setOrderdescription($szOrderDescription)->setAddress1($szAddress1)->setAddress2($szAddress2)->setAddress3($szAddress3)->setAddress4($szAddress4)->setCity($szCity)->setState($szState)->setPostcode($szPostCode)->setCountrycode($nCountryCode)->setCardname($szCardName)->setCardnumber($szCardNumber)->setExpirydatemonth($szExpiryDateMonth)->setExpirydateyear($szExpiryDateYear)->setStartdatemonth($szStartDateMonth)->setStartdateyear($szStartDateYear)->setIssuenumber($szIssueNumber)->setCv2($szCV2); Mage::getSingleton('checkout/session')->setRedirectionmethod('_runRedirectedPaymentComplete'); $payment->getOrder()->setIsHostedPaymentPending(true); /* serve out a dummy CrossReference as the TransactionId - this need to be done to enable the "Refund" button in the Magento CreditMemo internal refund mechanism */ $payment->setTransactionId($szOrderID . "_" . date('YmdHis')); }