本文整理汇总了PHP中Mage_Payment_Model_Info::getChasePaymentechTransType方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Info::getChasePaymentechTransType方法的具体用法?PHP Mage_Payment_Model_Info::getChasePaymentechTransType怎么用?PHP Mage_Payment_Model_Info::getChasePaymentechTransType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Payment_Model_Info
的用法示例。
在下文中一共展示了Mage_Payment_Model_Info::getChasePaymentechTransType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _postRequest
/**
* Post the request to the Soap Client in the Profile Model
*
* @param Mage_Payment_Model_Info $payment
* @return Gorilla_ChasePaymentech_Model_Gateway_Result
*/
public function _postRequest($payment)
{
$payment->setAmount($this->_formatAmount($payment->getAmount()));
/** @var $model Gorilla_ChasePaymentech_Model_Profile */
$model = Mage::getModel('chasepaymentech/profile');
switch ($payment->getChasePaymentechTransType()) {
case Gorilla_ChasePaymentech_Model_Profile::TRANS_TYPE_AUTH_ONLY:
case Gorilla_ChasePaymentech_Model_Profile::TRANS_TYPE_AUTH_CAPTURE:
$response = $model->createOrderTransaction($payment, $this->isSavingCc());
break;
case Gorilla_ChasePaymentech_Model_Profile::TRANS_TYPE_REFUND:
$response = $model->createOrderTransaction($payment);
// should be merged with other requests since all are same.
break;
case Gorilla_ChasePaymentech_Model_Profile::TRANS_TYPE_VOID:
$response = $model->createReversalTransaction($payment);
break;
case Gorilla_ChasePaymentech_Model_Profile::TRANS_TYPE_CAPTURE:
$response = $model->createMarkForCaptureTransaction($payment);
break;
default:
$response = false;
break;
}
/** @var $result Gorilla_ChasePaymentech_Model_Gateway_Result */
$result = Mage::getModel('chasepaymentech/gateway_result');
// Parse the direct response
if ($response) {
$r = (array) $response;
} else {
$r = false;
}
if ($r) {
$result->setResponseCode((int) str_replace('"', '', isset($r['respCode']) ? $r['respCode'] : null))->setProcStatusCode((int) str_replace('"', '', $r['procStatus']))->setResponseReasonCode((int) str_replace('"', '', $r['procStatus']))->setResponseReasonText($r['procStatusMessage'])->setApprovalCode($r['approvalStatus'])->setAvsResultCode(isset($r['avsRespCode']) ? $r['avsRespCode'] : null)->setTransactionId($r['txRefNum'])->setTransactionRefIdx(isset($r['txRefIdx']) ? $r['txRefIdx'] : null)->setSplitTransactionId(isset($r['splitTxRefIdx']) ? $r['splitTxRefIdx'] : null)->setInvoiceNumber($r['orderID'])->setAmount($payment->getAmount())->setTransactionType(isset($r['transType']) ? $r['transType'] : null)->setCardCodeResponseCode($r['respCode'])->setCAVVResponseCode(isset($r['cvvRespCode']) ? $r['cvvRespCode'] : null)->setCardType(isset($r['cardBrand']) ? $r['cardBrand'] : null)->setRequestedAmount($payment->getAmount())->setAuthorizationCode(isset($r['authorizationCode']) ? $r['authorizationCode'] : null)->setCcLast4(substr($payment->getCcNumber(), -4))->setCustomerId($this->getCustomer()->getId())->setCustomerRefNum(isset($r['customerRefNum']) ? $r['customerRefNum'] : null);
// if we used a stored credit card we need to set the customer ref number and the last 4 of the cc
if ($payment->getChasePaymentechCustomerRefNum()) {
$cardObj = $model->getCustomerPaymentProfile($payment->getChasePaymentechCustomerRefNum());
$result->setCustomerRefNum($cardObj->customerRefNum)->setCcLast4(substr($cardObj->ccAccountNum, -4));
}
} else {
if ($model->getErrorMessages()) {
//Mage::log($model->getErrorMessages());
Mage::throwException(Mage::helper('paygate')->convertMessagesToMessage($model->getErrorMessages()));
} else {
Mage::throwException($this->_getHelper()->__('Error in payment gateway.'));
}
}
return $result;
}
示例2: createOrderTransaction
/**
* Perform transaction (auth, capture, etc.)
*
* @param Mage_Payment_Model_Info $payment
* @param bool $addCustomerProfile
* @return string $directResponse|bool
*/
public function createOrderTransaction($payment, $addCustomerProfile = false)
{
/**
* Set the order in its own object
*/
$order = $payment->getOrder();
$amount = $payment->getAmount() * 100;
// Must set 100.00 to 10000 per api
$customerName = $order->getBillingAddress()->getFirstname() . " " . $order->getBillingAddress()->getLastname();
$street = $order->getBillingAddress()->getStreet();
$addy1 = $street[0];
$addy2 = isset($street[1]) ? $street[1] : "";
/**
* Paymentech uses specific cent values to trigger specific error codes.
* This can get annoying.
* If we're in test mode and want to strip cents, let's get rid of them.
*/
$testmode = Mage::getStoreConfig(self::XML_PATH_TESTMODE);
$stripcents = Mage::getStoreConfig(self::XML_PATH_STRIPCENTS);
if ($testmode == 1 && $stripcents == 1) {
$amount = floor($payment->getAmount()) * 100;
}
/**
* Create the transaction request data
*/
/**
* For split requests where we auth the second request
*/
/*if ($payment->getChasePaymentechTransType() == self::TRANS_TYPE_AUTH_ONLY && $payment->getSplitAuthTransId()) {
$data = array(
'transType' => $payment->getChasePaymentechTransType(),
'ccAccountNum' => null,
'orderID' => $this->_getUniqueOrderId($payment, $order),
'amount' => $amount,
'txRefNum' => $payment->getSplitAuthTransId(),
'partialAuthInd' => 'Y',
'comments' => "New Order Auth"
);
} else*/
if ($payment->getChasePaymentechTransType() == self::TRANS_TYPE_REFUND) {
$data = array('transType' => $payment->getChasePaymentechTransType(), 'ccAccountNum' => null, 'orderID' => $this->_getUniqueOrderId($payment, $order), 'amount' => $amount > 0 ? $amount : null, 'txRefNum' => $payment->getTransId(), 'comments' => "New Order Refund");
} else {
$data = array('transType' => $payment->getChasePaymentechTransType(), 'amount' => $amount, 'orderID' => $this->_getUniqueOrderId($payment, $order), 'customerRefNum' => $payment->getChasePaymentechCustomerRefNum(), 'customerName' => substr($customerName, 0, 30), 'avsName' => substr($customerName, 0, 30), 'avsAddress1' => substr($addy1, 0, 30), 'avsAddress2' => substr($addy2, 0, 30), 'avsCity' => $order->getBillingAddress()->getCity(), 'avsState' => Mage::helper('chasepaymentech')->convertStateNameToCode($order->getBillingAddress()->getRegion()), 'avsZip' => $order->getBillingAddress()->getPostcode(), 'avsCountryCode' => $order->getBillingAddress()->getCountryId(), 'avsPhone' => substr($order->getBillingAddress()->getTelephone(), 0, 14), 'customerRefNum' => "");
// Saved account - send ref num instead of card data
if ($payment->getChasePaymentechCustomerRefNum()) {
$additionalData = array('customerRefNum' => $payment->getChasePaymentechCustomerRefNum());
} else {
$additionalData = array('ccAccountNum' => $payment->getCcNumber(), 'ccExp' => sprintf('%04d%02d', $payment->getCcExpYear(), $payment->getCcExpMonth()), 'cardBrand' => $payment->getCcType() == self::AMERICAN_EXPRESS ? self::AMERICAN_EXPRESS_VALUE : $payment->getCcType(), 'ccCardVerifyNum' => $payment->getCcCid(), 'ccCardVerifyPresenceInd' => in_array($payment->getCcType(), array('DI', 'VI')) ? 1 : null, 'addProfileFromOrder' => $addCustomerProfile ? "A" : "", 'profileOrderOverideInd' => $addCustomerProfile ? "NO" : "");
}
// Merge data arrays
$data = array_merge($data, $additionalData);
/**
* If this is a prior auth capture, void, or refund add the transaction id
*/
if ($payment->getChasePaymentechTransType() == self::TRANS_TYPE_CAPTURE || $payment->getChasePaymentechTransType() == self::TRANS_TYPE_REFUND) {
$data['txRefNum'] = $payment->getTransId();
}
/**
* Send Minimum Auth Amount request, parse the response to check cvv, then send secondary, full, request.
*
* $0.00 Auth verification can only be used for MC and Visa so there is no $ being held - does not seem to be working
* $0.01 Authorization is the least amount you can send in for all other CC.
*/
$true = false;
if ($true && !$payment->getChasePaymentechCustomerRefNum()) {
$data['transType'] = self::TRANS_TYPE_AUTH_ONLY;
if (in_array($payment->getCcType(), array('MC', 'VI'))) {
$data['amount'] = '000';
} else {
$data['amount'] = '001';
}
$soap_env = array(self::TRANS_CREATE_TRANS_REQUEST => array_merge($this->_getAuthentication(), $data));
if (!($response = $this->doCall(self::TRANS_CREATE_TRANS, $soap_env))) {
return false;
}
$response = $response->return;
//Mage::log('minimum response:');
//Mage::log($response);
if ($this->_checkErrors()) {
// For CLI testing
//Mage::log($this->getErrorMessages());
return false;
}
if ($response->cvvRespCode != self::RESPONSE_CVV_MATCH) {
//$this->setResponseMessages(array($this->_cvvResponses[$response->cvvRespCode]));
if ($response->cvvRespCode) {
$this->setErrorMessages(array($this->_cvvResponses[$response->cvvRespCode]));
} else {
$this->setErrorMessages(array(Mage::helper('paygate')->__('Error with payment info')));
}
// For CLI testing
//Mage::log($this->getErrorMessages());
return false;
//.........这里部分代码省略.........