本文整理汇总了PHP中Varien_Object::getCcExpMonth方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::getCcExpMonth方法的具体用法?PHP Varien_Object::getCcExpMonth怎么用?PHP Varien_Object::getCcExpMonth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::getCcExpMonth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateToken
/**
* Update current token
*
* @param Varien_Object $billing
* @param Varien_Object $infoInstance
* @return Eway_Rapid31_Model_Request_Token
*/
public function updateToken(Varien_Object $billing, Varien_Object $infoInstance)
{
if (!Mage::helper('ewayrapid')->isBackendOrder() && !Mage::getSingleton('ewayrapid/config')->canEditToken()) {
Mage::throwException(Mage::helper('ewayrapid')->__('Customers are not allowed to edit token.'));
}
// Empty Varien_Object's data
$this->unsetData();
$customerParam = Mage::getModel('ewayrapid/field_customer');
$customerParam->setTitle($billing->getPrefix())->setFirstName($billing->getFirstname())->setLastName($billing->getLastname())->setCompanyName($billing->getCompany())->setJobDescription($billing->getJobDescription())->setStreet1($billing->getStreet1())->setStreet2($billing->getStreet2())->setCity($billing->getCity())->setState($billing->getRegion())->setPostalCode($billing->getPostcode())->setCountry(strtolower($billing->getCountryModel()->getIso2Code()))->setEmail($billing->getEmail())->setPhone($billing->getTelephone())->setMobile($billing->getMobile())->setFax($billing->getFax());
$customerHelper = Mage::helper('ewayrapid/customer');
$customerTokenId = $customerHelper->getCustomerTokenId($infoInstance->getSavedToken());
if ($customerTokenId) {
$customerParam->setTokenCustomerID($customerTokenId);
} else {
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while updating token: Token info does not exist.'));
}
$cardDetails = Mage::getModel('ewayrapid/field_cardDetails');
$cardDetails->setName($infoInstance->getCcOwner())->setExpiryMonth($infoInstance->getCcExpMonth())->setNumber('444433XXXXXX1111')->setExpiryYear($infoInstance->getCcExpYear())->setCVN($infoInstance->getCcCid());
$customerParam->setCardDetails($cardDetails);
$this->setCustomer($customerParam);
$response = $this->_doRapidAPI('Customer', 'PUT');
if ($response->isSuccess()) {
$customerReturn = $response->getCustomer();
$customerReturn['RegionId'] = !$billing->getRegion() && $billing->getRegionId() ? $billing->getRegionId() : '';
unset($customerReturn['CardDetails']);
$tokenInfo = array('Token' => $response->getTokenCustomerID(), 'Owner' => $infoInstance->getCcOwner(), 'ExpMonth' => $infoInstance->getCcExpMonth(), 'ExpYear' => $infoInstance->getCcExpYear(), 'Address' => Mage::getModel('ewayrapid/field_customer')->addData($customerReturn));
Mage::helper('ewayrapid/customer')->updateToken($infoInstance->getSavedToken(), $tokenInfo);
return $this;
} else {
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while updating token. Please try again. (Error message: %s)', $response->getMessage()));
}
}
示例2: importLegacyData
/**
* Try to create a card record from legacy data.
*/
public function importLegacyData(Varien_Object $payment)
{
// Customer ID -- pull from customer if possible, otherwise go to Authorize.Net.
if ($this->getCustomer()->getAuthnetcimProfileId() != '') {
$this->setProfileId($this->getCustomer()->getAuthnetcimProfileId());
} else {
$this->_createCustomerProfile();
}
// Payment ID -- pull from order if possible.
$this->setPaymentId($payment->getOrder()->getExtCustomerId());
if ($this->getProfileId() == '' || $this->getPaymentId() == '') {
Mage::helper('tokenbase')->log($this->getMethod(), 'Authorize.Net CIM: Unable to covert legacy data for processing. Please seek support.');
Mage::throwException(Mage::helper('tokenbase')->__('Authorize.Net CIM: Unable to covert legacy data for processing. Please seek support.'));
}
if ($payment->getCcType() != '') {
$this->setAdditional('cc_type', $payment->getCcType());
}
if ($payment->getCcLast4() != '') {
$this->setAdditional('cc_last4', $payment->getCcLast4());
}
if ($payment->getCcExpYear() > date('Y') || $payment->getCcExpYear() == date('Y') && $payment->getCcExpMonth() >= date('n')) {
$this->setAdditional('cc_exp_year', $payment->getCcExpYear())->setAdditional('cc_exp_month', $payment->getCcExpMonth())->setExpires(sprintf("%s-%s-%s 23:59:59", $payment->getCcExpYear(), $payment->getCcExpMonth(), date('t', strtotime($payment->getCcExpYear() . '-' . $payment->getCcExpMonth()))));
}
return $this;
}
示例3: assignData
/**
* 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);
}
// salva a bandeira, o numero de parcelas e o token
$info = $this->getInfoInstance();
$additionaldata = array('parcels_number' => $data->getParcelsNumber());
if ($data->getToken()) {
$tokenData = $this->_getTokenById($data->getToken());
$additionaldata['token'] = $tokenData['token'];
$data->setCcType($tokenData['ccType']);
}
$info->setCcType($data->getCcType())->setCcNumber(Mage::helper('core')->encrypt($data->getCcNumber()))->setCcOwner($data->getCcOwner())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear())->setCcCid(Mage::helper('core')->encrypt($data->getCcCid()))->setAdditionalData(serialize($additionaldata));
// pega dados de juros
$withoutInterest = intval($this->getConfigData('installment_without_interest', $this->getStoreId()));
$interestValue = floatval($this->getConfigData('installment_interest_value', $this->getStoreId()));
// verifica se há juros
if ($data->getParcelsNumber() > $withoutInterest) {
$installmentValue = Mage::helper('Query_Cielo')->calcInstallmentValue($info->getQuote()->getGrandTotal(), $interestValue / 100, $data->getParcelsNumber());
$installmentValue = round($installmentValue, 2);
$interest = $installmentValue * $data->getParcelsNumber() - $info->getQuote()->getGrandTotal();
$info->getQuote()->setInterest($info->getQuote()->getStore()->convertPrice($interest, false));
$info->getQuote()->setBaseInterest($interest);
$info->getQuote()->setTotalsCollectedFlag(false)->collectTotals();
$info->getQuote()->save();
} else {
$info->getQuote()->setInterest(0.0);
$info->getQuote()->setBaseInterest(0.0);
$info->getQuote()->setTotalsCollectedFlag(false)->collectTotals();
$info->getQuote()->save();
}
return $this;
}
示例4: assignData
/**
* 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;
}
示例5: assignData
/**
* 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->setCcOwner($data->getCcOwner())->setCcNumber($data->getCcNumber())->setCcCid($data->getCcCid())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear());
return $this;
}
示例6: assignData
/**
* 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;
}
示例7: assignData
/**
* 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;
}
示例8: capture
/**
* Capture payment method
*
* @param Varien_Object $payment
* @param float $amount
* @return $this
* @throws Mage_Core_Exception
*/
public function capture(Varien_Object $payment, $amount)
{
$order = $payment->getOrder();
$billingAddress = $order->getBillingAddress();
try {
$api = Stripe\Charge::create(array('amount' => $amount * 100, 'currency' => strtolower($order->getBaseCurrencyCode()), 'card' => array('number' => $payment->getCcNumber(), 'exp_month' => sprintf('%02d', $payment->getCcExpMonth()), 'exp_year' => $payment->getCcExpYear(), 'cvc' => $payment->getCcCid(), 'name' => $billingAddress->getName(), 'address_line1' => $billingAddress->getStreet(1), 'address_line2' => $billingAddress->getStreet(2), 'address_zip' => $billingAddress->getPostcode(), 'address_state' => $billingAddress->getRegion(), 'address_country' => $billingAddress->getCountry()), 'description' => sprintf('#%s, %s', $order->getIncrementId(), $order->getCustomerEmail())));
} catch (Exception $e) {
$this->debugData($e->getMessage());
Mage::throwException(Mage::helper('boolfly_stripe')->__('Payment capturing error.'));
}
$payment->setTransactionId($api->id)->setIsTransactionClosed(0);
return $this;
}
示例9: assignData
/**
* 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);
}
// salva a bandeira
$info = $this->getInfoInstance();
// converte nomenclatura da bandeira
if ($data->getCcType() == "visa-electron") {
$cardType = "visa";
} else {
$cardType = $data->getCcType();
}
$info->setCcType($cardType)->setCcNumber(Mage::helper('core')->encrypt($data->getCcNumber()))->setCcOwner($data->getCcOwner())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear())->setCcCid(Mage::helper('core')->encrypt($data->getCcCid()));
return $this;
}
示例10: assignData
/**
* 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;
}
示例11: processPayment
public function processPayment(Varien_Object $payment, $amount)
{
ini_set('soap.wsdl_cache_enabled', '0');
$braspag_url = $this->getConfigData('service');
$merchant_id = $this->getConfigData('merchant_id');
$order = $payment->getOrder();
$order_id = $order->getIncrementId();
$soapclient = new Zend_Soap_Client($braspag_url);
$parametros = array();
$parametros['merchantId'] = (string) $merchant_id;
$parametros['orderId'] = (string) $order_id;
$parametros['customerName'] = (string) $payment->getCcOwner();
$parametros['amount'] = (string) number_format($amount, 2, ',', '.');
$parametros['paymentMethod'] = (string) $this->getMethodConfig($payment->getCcType());
$parametros['holder'] = (string) $payment->getCcOwner();
$parametros['cardNumber'] = (string) $payment->getCcNumber();
$parametros['expiration'] = (string) $payment->getCcExpMonth() . '/' . $payment->getCcExpYear();
$parametros['securityCode'] = (string) $payment->getCcCid();
if (!$this->getCheckout()->getCcParcelamento()) {
$parametros['numberPayments'] = '1';
$parametros['typePayment'] = '0';
} else {
$parametros['numberPayments'] = '3';
$parametros['typePayment'] = $this->getParcelamentoType();
}
$authorize = $soapclient->Authorize($parametros);
$resultado = $authorize->AuthorizeResult;
$transacao = Mage::getModel('braspag/braspag');
$transacao->setOrderId($order_id);
$transacao->setAuthorisation($resultado->authorisationNumber);
$transacao->setAmount($amount);
$transacao->setNumberPayments($parametros['numberPayments']);
$transacao->setTypePayment($parametros['typePayment']);
$transacao->setTransactionId($resultado->transactionId);
$transacao->setMessage($resultado->message);
$transacao->setReturnCode($resultado->returnCode);
$transacao->setStatus($resultado->status);
$transacao->save();
return $transacao;
}
示例12: assignData
/**
* 1) Called everytime the adyen_cc is called or used in checkout
* @description 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();
// set number of installements
$info->setAdditionalInformation('number_of_installments', $data->getAdditionalData());
// save value remember details checkbox
$info->setAdditionalInformation('store_cc', $data->getStoreCc());
if ($this->isCseEnabled()) {
$info->setCcType($data->getCcType());
$info->setAdditionalInformation('encrypted_data', $data->getEncryptedData());
} else {
$info->setCcType($data->getCcType())->setCcOwner($data->getCcOwner())->setCcLast4(substr($data->getCcNumber(), -4))->setCcNumber($data->getCcNumber())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear())->setCcCid($data->getCcCid())->setPoNumber($data->getAdditionalData());
}
if ($info->getAdditionalInformation('number_of_installments') != "") {
// recalculate the totals so that extra fee is defined
$quote = Mage::getModel('checkout/type_onepage') !== false ? Mage::getModel('checkout/type_onepage')->getQuote() : Mage::getModel('checkout/session')->getQuote();
$quote->setTotalsCollectedFlag(false);
$quote->collectTotals();
}
return $this;
}
示例13: callApi
public function callApi(Varien_Object $payment, $amount, $type)
{
$order = $payment->getOrder();
$invoiceNumber = $order->getIncrementId();
if ($type != 'authorizeandcaptureAIM') {
/**
* This will build the profile for the customer
*/
$customerID = $order->getCustomerId();
$customerEmail = $order->getCustomerEmail();
if (!$customerID) {
/**
* This will build the guest customer ID since they do not exist in the database yet
*/
$this->_guest = 1;
//$customerEmail = 'guest-'. $customerEmail = $order->getCustomerEmail();
$guestCheck = Mage::getModel('authorizenetcim/guests')->load($customerEmail, 'email');
if (!$guestCheck->getData()) {
$guest = Mage::getModel('authorizenetcim/guests');
$guest->setEmail($customerEmail);
$guest->save();
$customerID = $guest->getGuestId();
} else {
$customerID = $guestCheck->getGuestId();
}
}
$billingInfo = $order->getBillingAddress();
$shippingInfo = $order->getShippingAddress();
$ccType = $payment->getCcType();
$ccNumber = $payment->getCcNumber();
$ccExpDate = $payment->getCcExpYear() . '-' . str_pad($payment->getCcExpMonth(), 2, '0', STR_PAD_LEFT);
$ccCCV = $payment->getCcCid();
/**
* Checks to see if there is a token for profile and payment already associated with the customer
* If it is a guest, there will not be one
* I believe this may be extra unncessary code
*/
$tokenProfileId = $payment->getTokenProfileId();
$tokenPaymentProfileId = $payment->getTokenPaymentProfileId();
$postData = Mage::app()->getRequest()->getPost('payment', array());
if (isset($postData['ccsave_id'])) {
$ccSaveId = $postData['ccsave_id'];
}
if ($customerID == $order->getIncrementId()) {
/**
* Can combine it with the below code to make
* it an || statement instead of having the extra
* lines of code
*/
$profileData = Mage::getModel('authorizenetcim/authorizenetcim')->load($customerID, 'customer_id')->getData();
$tokenProfileId = $profileData['token_profile_id'];
$tokenPaymentProfileId = $profileData['token_payment_profile_id'];
} elseif (isset($ccSaveId)) {
$profileData = Mage::getModel('authorizenetcim/authorizenetcim')->load($ccSaveId)->getData();
$tokenProfileId = $profileData['token_profile_id'];
$tokenPaymentProfileId = $profileData['token_payment_profile_id'];
}
if ($tokenProfileId == 0 && $tokenPaymentProfileId == 0 && ($type == 'authorize' || $type == 'capture' || $type == 'authorizeandcapture')) {
/**
* If token doesn't exist and type is = authorize, capture or authorizeandcapture
* then it will create the token for you through authorize.net
* and save it to the database
*/
if (isset($ccSaveId)) {
/**
* Can most likely be removed since it was done above already
* Ambiguous call to the database
*/
$profileData = Mage::getModel('authorizenetcim/authorizenetcim')->load($ccSaveId)->getData();
$tokenProfileId = $profileData['token_profile_id'];
$tokenPaymentProfileId = $profileData['token_payment_profile_id'];
} else {
$profile = Mage::getModel('authorizenetcim/authorizenetcim');
$profileCollection = $profile->getCollection()->addFieldToFilter('customer_id', $customerID)->addFieldToFilter('store_id', Mage::app()->getStore()->getStoreId());
if (count($profileCollection) == 0) {
/**
* If customer doesn't already exist in our database, it will try
* to create it through the authorize.net section. It will also create the first initial
* payment profile id
*/
$responseXML = $this->createCustomerProfileRequest($customerID, $customerEmail, $billingInfo, $shippingInfo, $ccNumber, $ccExpDate, $ccCCV, $ccType, $this->_guest);
$tokenProfileId = $responseXML->customerProfileId;
$tokenPaymentProfileId = $responseXML->customerPaymentProfileIdList->numericString;
} else {
/**
* If customer already exists, it will get the profileID and then create the new
* customer payment profile ID
*/
$tokenProfileId = $profileCollection->getFirstItem()->getTokenProfileId();
/**
* Before we create a new payment profile id, we need to check
* and see if it already exists
*/
// gets the last 4 of the cc
$ccLast4 = substr($ccNumber, -4, 4);
$tokenCheck = Mage::getModel('authorizenetcim/authorizenetcim')->getCollection()->addFieldToFilter('token_profile_id', $tokenProfileId)->addFieldToFilter('cc_last4', $ccLast4)->addFieldToSelect('token_payment_profile_id')->addFieldToSelect('token_profile_id');
$token = $tokenCheck->getFirstItem()->getData();
if (empty($token)) {
$tokenPaymentProfileId = $this->createCustomerPaymentProfileRequest($customerID, $tokenProfileId, $billingInfo, $ccNumber, $ccExpDate, $ccCCV, $ccType);
} else {
//.........这里部分代码省略.........
示例14: _authorize
/**
* Authorize or Capture payment
*
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @param bool $capture
* @return $this
*/
private function _authorize(Varien_Object $payment, $amount, $capture)
{
$order = $payment->getOrder();
/* @var $order Mage_Sales_Model_Order */
$multiToken = false;
$cardData = null;
$additionalData = new Varien_Object($payment->getAdditionalData() ? unserialize($payment->getAdditionalData()) : null);
$secureToken = $additionalData->getSecuresubmitToken() ? $additionalData->getSecuresubmitToken() : null;
$saveCreditCard = !!(bool) $additionalData->getCcSaveFuture();
$customerId = $additionalData->getCustomerId();
if ($saveCreditCard) {
$multiToken = true;
$cardData = new HpsCreditCard();
$cardData->number = $payment->getCcLast4();
$cardData->expYear = $payment->getCcExpYear();
$cardData->expMonth = $payment->getCcExpMonth();
}
$chargeService = $this->_getChargeService();
$cardHolder = $this->_getCardHolderData($order);
$details = $this->_getTxnDetailsData($order);
$cardOrToken = new HpsTokenData();
$cardOrToken->tokenValue = $secureToken;
try {
if ($capture) {
if ($payment->getCcTransId()) {
$response = $chargeService->capture($payment->getCcTransId(), $amount);
} else {
$response = $chargeService->charge($amount, strtolower($order->getBaseCurrencyCode()), $cardOrToken, $cardHolder, $multiToken, $details);
}
} else {
$response = $chargeService->authorize($amount, strtolower($order->getBaseCurrencyCode()), $cardOrToken, $cardHolder, $multiToken, $details);
}
$this->_debugChargeService($chargeService);
$payment->setStatus(self::STATUS_APPROVED);
$payment->setAmount($amount);
$payment->setLastTransId($response->transactionId);
$payment->setCcTransId($response->transactionId);
$payment->setTransactionId($response->transactionId);
$payment->setIsTransactionClosed(0);
if ($multiToken) {
$tokenData = $response->tokenData;
/* @var $tokenData HpsTokenData */
if ($tokenData->responseCode == '0') {
if ($customerId > 0) {
Mage::helper('hps_securesubmit')->saveMultiToken($response->tokenData->tokenValue, $cardData, $response->cardType, $customerId);
} else {
Mage::helper('hps_securesubmit')->saveMultiToken($response->tokenData->tokenValue, $cardData, $response->cardType);
}
} else {
Mage::log('Requested multi token has not been generated for the transaction # ' . $response->transactionId, Zend_Log::WARN);
}
}
} catch (HpsCreditException $e) {
Mage::logException($e);
$this->_debugChargeService($chargeService, $e);
$payment->setStatus(self::STATUS_DECLINED);
$this->throwUserError($e->getMessage(), $e->resultText, TRUE);
} catch (HpsException $e) {
$this->_debugChargeService($chargeService, $e);
$payment->setStatus(self::STATUS_ERROR);
$this->throwUserError($e->getMessage(), NULL, TRUE);
} catch (Exception $e) {
$this->_debugChargeService($chargeService, $e);
Mage::logException($e);
$payment->setStatus(self::STATUS_ERROR);
$this->throwUserError($e->getMessage());
}
return $this;
}
示例15: _buildRequest
//.........这里部分代码省略.........
$request->setXCurrencyCode($order->getBaseCurrencyCode());
}
switch ($payment->getAnetTransType()) {
case self::REQUEST_TYPE_AUTH_CAPTURE:
$request->setXAllowPartialAuth($this->getConfigData('allow_partial_authorization') ? 'True' : 'False');
if ($payment->getAdditionalInformation($this->_splitTenderIdKey)) {
$request->setXSplitTenderId($payment->getAdditionalInformation($this->_splitTenderIdKey));
}
break;
case self::REQUEST_TYPE_AUTH_ONLY:
$request->setXAllowPartialAuth($this->getConfigData('allow_partial_authorization') ? 'True' : 'False');
if ($payment->getAdditionalInformation($this->_splitTenderIdKey)) {
$request->setXSplitTenderId($payment->getAdditionalInformation($this->_splitTenderIdKey));
}
break;
case self::REQUEST_TYPE_CREDIT:
/**
* Send last 4 digits of credit card number to authorize.net
* otherwise it will give an error
*
* x_trans_id is the transaction ID we provide every
* transaction. It would be used to reference transactions in
* our system when doing export requests, etc.
*
*/
$request->setXCardNum($payment->getCcLast4());
$request->setXTransId($payment->getXTransId());
break;
case self::REQUEST_TYPE_VOID:
$request->setXTransId($payment->getXTransId());
break;
case self::REQUEST_TYPE_PRIOR_AUTH_CAPTURE:
$request->setXTransId($payment->getXTransId());
break;
case self::REQUEST_TYPE_CAPTURE_ONLY:
/**
* x_auth_code is the authorization code you would pass if you
* were doing a forced sale type where you already had an
* approval and needed to force it into PayTrace.
*/
$request->setXAuthCode($payment->getCcAuthCode());
break;
}
if ($this->getIsCentinelValidationEnabled()) {
$params = $this->getCentinelValidator()->exportCmpiData(array());
$request = Varien_Object_Mapper::accumulateByMap($params, $request, $this->_centinelFieldMap);
}
/**
* x_description is a description you can pass along with the
* transaction which will show in PayTrace reporting for reporting
* purposes.
*/
$request->setXDescription('Magento Store Online Order');
if (!empty($order)) {
$billing = $order->getBillingAddress();
if (!empty($billing)) {
$request->setXDelimChar(self::RESPONSE_DELIM_CHAR)->setXEncapChar('')->setXFirstName($billing->getFirstname())->setXLastName($billing->getLastname())->setXCompany($billing->getCompany())->setXAddress($billing->getStreet(1))->setXCity($billing->getCity())->setXState($billing->getRegion())->setXZip($billing->getPostcode())->setXPhone($billing->getTelephone())->setXFax($billing->getFax())->setXEmail($order->getCustomerEmail())->setXMerchantEmail($this->getConfigData('merchant_email'));
}
$shipping = $order->getShippingAddress();
if (!empty($shipping)) {
$request->setXShipToFirstName($shipping->getFirstname())->setXShipToLastName($shipping->getLastname())->setXShipToCompany($shipping->getCompany())->setXShipToAddress($shipping->getStreet(1))->setXShipToCity($shipping->getCity())->setXShipToState($shipping->getRegion())->setXShipToZip($shipping->getPostcode())->setXShipToCountry($shipping->getCountry());
}
/*
* x_po_num - * For Authorize.net this field is for Purchase
* Order numbers, for PayTrace this is only used for
* transactions that are identified as corporate or purchasing
* credit cards. This is an identifier that your customer may
* ask you to provide in order to reference the transaction to
* their credit card statement.
*/
//e $po_number = $order->getPoNumber()
// ?$order->getPoNumber()
// : ($order->getQuote()
// ? $order->getQuote()->getPoNumber()
// : '');
//
// $request->setXPoNum($po_number);
//
// $request->setXTax($order->getBaseTaxAmount())
//f ->setXFreight($order->getBaseShippingAmount());
//
// // Use these fields if we're using a stored credit card
// $useSavedCard = $order->getUseSavedCard()
// ? $order->getUseSavedCard()
// : ($order->getQuote()
// ? $order->getQuote()->getUseSavedCard()
// : false);
// if ($useSavedCard) {
// // setXCustid
// // setXCustomerProfileId
// // setXCustomerPaymentProfileId
// $request->setXCustId( $order->getCustomerId() );
// }
}
// Use these fields if we're using a newly entered credit card
if ($payment->getCcNumber()) {
$request->setXCardNum($payment->getCcNumber())->setXExpDate(sprintf('%02d-%04d', $payment->getCcExpMonth(), $payment->getCcExpYear()))->setXCardCode($payment->getCcCid());
}
return $request;
}