本文整理汇总了PHP中Mage_Sales_Model_Order_Payment::getCcType方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Payment::getCcType方法的具体用法?PHP Mage_Sales_Model_Order_Payment::getCcType怎么用?PHP Mage_Sales_Model_Order_Payment::getCcType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Payment
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Payment::getCcType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: paymentToQuotePayment
/**
* Convert order payment to quote payment
*
* @param Mage_Sales_Model_Order_Payment $payment
* @return Mage_Sales_Model_Quote_Payment
*/
public function paymentToQuotePayment(Mage_Sales_Model_Order_Payment $payment, $quotePayment = null)
{
if (!$quotePayment instanceof Mage_Sales_Model_Quote_Payment) {
$quotePayment = Mage::getModel('sales/quote_payment');
}
$quotePayment->setStoreId($payment->getStoreId())->setCustomerPaymentId($payment->getCustomerPaymentId())->setMethod($payment->getMethod())->setAdditionalData($payment->getAdditionalData())->setPoNumber($payment->getPoNumber())->setCcType($payment->getCcType())->setCcNumberEnc($payment->getCcNumberEnc())->setCcLast4($payment->getCcLast4())->setCcOwner($payment->getCcOwner())->setCcCidEnc($payment->getCcCidEnc())->setCcExpMonth($payment->getCcExpMonth())->setCcExpYear($payment->getCcExpYear());
return $quotePayment;
}
示例2: _placeOrder
/**
* Place an order with authorization or capture action
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @return Mage_Paypal_Model_Direct
*/
protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
{
$order = $payment->getOrder();
$api = $this->_pro->getApi()->setPaymentAction($this->_pro->getConfig()->paymentAction)->setIpAddress(Mage::app()->getRequest()->getClientIp(false))->setAmount($amount)->setCurrencyCode($order->getBaseCurrencyCode())->setInvNum($order->getIncrementId())->setEmail($order->getCustomerEmail())->setNotifyUrl(Mage::getUrl('paypal/ipn/'))->setCreditCardType($payment->getCcType())->setCreditCardNumber($payment->getCcNumber())->setCreditCardExpirationDate($this->_getFormattedCcExpirationDate($payment->getCcExpMonth(), $payment->getCcExpYear()))->setCreditCardCvv2($payment->getCcCid())->setMaestroSoloIssueNumber($payment->getCcSsIssue());
if ($payment->getCcSsStartMonth() && $payment->getCcSsStartYear()) {
$year = sprintf('%02d', substr($payment->getCcSsStartYear(), -2, 2));
$api->setMaestroSoloIssueDate($this->_getFormattedCcExpirationDate($payment->getCcSsStartMonth(), $year));
}
if ($this->getIsCentinelValidationEnabled()) {
$this->getCentinelValidator()->exportCmpiData($api);
}
// add shipping and billing addresses
if ($order->getIsVirtual()) {
$api->setAddress($order->getBillingAddress())->setSuppressShipping(true);
} else {
$api->setAddress($order->getShippingAddress());
$api->setBillingAddress($order->getBillingAddress());
}
// add line items
$api->setPaypalCart(Mage::getModel('paypal/cart', array($order)))->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled);
// call api and import transaction and other payment information
$api->callDoDirectPayment();
$this->_importResultToPayment($api, $payment);
try {
$api->callGetTransactionDetails();
} catch (Mage_Core_Exception $e) {
// if we recieve errors, but DoDirectPayment response is Success, then set Pending status for transaction
$payment->setIsTransactionPending(true);
}
$this->_importResultToPayment($api, $payment);
return $this;
}
示例3: _placeOrder
/**
* Place an order with authorization or capture action
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @return Mage_Paypal_Model_Direct
*/
protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
{
$order = $payment->getOrder();
$api = $this->_pro->getApi()->setPaymentAction($this->_pro->getConfig()->paymentAction)->setIpAddress(Mage::app()->getRequest()->getClientIp(false))->setAmount($amount)->setCurrencyCode($order->getBaseCurrencyCode())->setInvNum($order->getIncrementId())->setEmail($order->getCustomerEmail())->setNotifyUrl(Mage::getUrl('paypal/ipn/direct'))->setCreditCardType($payment->getCcType())->setCreditCardNumber($payment->getCcNumber())->setCreditCardExpirationDate(sprintf('%02d%02d', $payment->getCcExpMonth(), $payment->getCcExpYear()))->setCreditCardCvv2($payment->getCcCid());
// add shipping address
if ($order->getIsVirtual()) {
$api->setAddress($order->getBillingAddress())->setSuppressShipping(true);
} else {
$api->setAddress($order->getShippingAddress());
}
// add line items
if ($this->_pro->getConfig()->lineItemsEnabled) {
list($items, $totals) = Mage::helper('paypal')->prepareLineItems($order);
$api->setLineItems($items)->setLineItemTotals($totals);
}
// call api and import transaction and other payment information
$api->callDoDirectPayment();
$payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0)->setIsPaid($api->isPaid($api->getPaymentStatus()));
Mage::getModel('paypal/info')->importToPayment($api, $payment);
return $this;
}
示例4: _placeOrder
/**
* Place an order with authorization or capture action
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @return Mage_Paypal_Model_Direct
*/
protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
{
$order = $payment->getOrder();
$api = $this->_pro->getApi()->setPaymentAction($this->_pro->getConfig()->paymentAction)->setIpAddress(Mage::app()->getRequest()->getClientIp(false))->setAmount($amount)->setCurrencyCode($order->getBaseCurrencyCode())->setInvNum($order->getIncrementId())->setEmail($order->getCustomerEmail())->setNotifyUrl(Mage::getUrl($this->_notifyAction))->setCreditCardType($payment->getCcType())->setCreditCardNumber($payment->getCcNumber())->setCreditCardExpirationDate(sprintf('%02d%02d', $payment->getCcExpMonth(), $payment->getCcExpYear()))->setCreditCardCvv2($payment->getCcCid())->setMaestroSoloIssueNumber($payment->getCcSsIssue());
if ($payment->getCcSsStartMonth() && $payment->getCcSsStartYear()) {
$api->setMaestroSoloIssueDate(sprintf('%02d%02d', $payment->getCcSsStartMonth(), preg_replace('~\\d\\d(\\d\\d)~', '$1', $payment->getCcSsStartYear())));
}
if ($this->getIsCentinelValidationEnabled()) {
$this->getCentinelValidator()->exportCmpiData($api);
}
// add shipping address
if ($order->getIsVirtual()) {
$api->setAddress($order->getBillingAddress())->setSuppressShipping(true);
} else {
$api->setAddress($order->getShippingAddress());
}
// add line items
if ($this->_pro->getConfig()->lineItemsEnabled && Mage::helper('paypal')->doLineItemsMatchAmount($order, $amount)) {
//For transfering line items order amount must be equal to cart total amount
list($items, $totals) = Mage::helper('paypal')->prepareLineItems($order);
$api->setLineItems($items)->setLineItemTotals($totals);
}
// call api and import transaction and other payment information
$api->callDoDirectPayment();
$this->_importResultToPayment($api, $payment);
return $this;
}
示例5: processResponse
/**
*
* @param Allopass_Hipay_Model_Api_Response_Gateway $gatewayResponse
* @param Mage_Sales_Model_Order_Payment $payment
* @param float $amount
*/
public function processResponse($gatewayResponse, $payment, $amount)
{
$order = $payment->getOrder();
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
//$defaultExceptionMessage = Mage::helper('hipay')->__('Error in process response!');
switch ($this->getConfigPaymentAction()) {
case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
$requestType = self::OPERATION_AUTHORIZATION;
$newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH;
$defaultExceptionMessage = Mage::helper('hipay')->__('Payment authorization error.');
break;
case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE:
$requestType = self::OPERATION_SALE;
$newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE;
$defaultExceptionMessage = Mage::helper('hipay')->__('Payment capturing error.');
break;
}
//add data to payment object
if ($payment->getCcType() == "") {
$payment->setCcType($gatewayResponse->getPaymentProduct());
}
switch ($gatewayResponse->getState()) {
case self::STATE_COMPLETED:
case self::STATE_PENDING:
switch ((int) $gatewayResponse->getStatus()) {
case 111:
//denied
$this->addTransaction($payment, $gatewayResponse->getTransactionReference(), $newTransactionType, array('is_transaction_closed' => 0), array(), Mage::helper('hipay')->getTransactionMessage($payment, $requestType, null, $amount));
if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) {
$order->unhold();
}
if (!($status = $this->getConfigData('order_status_payment_refused'))) {
$status = $order->getStatus();
}
if ($status == Mage_Sales_Model_Order::STATE_HOLDED && $order->canHold()) {
$order->hold();
} elseif ($status == Mage_Sales_Model_Order::STATE_CANCELED && $order->canCancel()) {
$order->cancel();
}
$order->addStatusToHistory($status, Mage::helper('hipay')->getTransactionMessage($payment, self::OPERATION_AUTHORIZATION, null, $amount, true, $gatewayResponse->getMessage()));
$order->save();
break;
case 112:
//Authorized and pending
$this->addTransaction($payment, $gatewayResponse->getTransactionReference(), Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $gatewayResponse->getTransactionReference()), Mage::helper('hipay')->getTransactionMessage($payment, self::OPERATION_AUTHORIZATION, $gatewayResponse->getTransactionReference(), $amount, true));
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
$status = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
if (defined('Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW')) {
$state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
$status = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
}
$this->_setFraudDetected($gatewayResponse, $customer, $payment, $amount);
$order->setState($state, $status, $gatewayResponse->getMessage());
$payment->setAmountAuthorized($gatewayResponse->getAuthorizedAmount());
$payment->setBaseAmountAuthorized($gatewayResponse->getAuthorizedAmount());
$order->save();
break;
case 142:
//Authorized Requested
if ($order->getStatus() == self::STATUS_CAPTURE_REQUESTED || $order->getStatus() == Mage_Sales_Model_Order::STATE_PROCESSING || $order->getStatus() == Mage_Sales_Model_Order::STATE_COMPLETE || $order->getStatus() == Mage_Sales_Model_Order::STATE_CLOSED || $order->getStatus() == self::STATUS_PENDING_CAPTURE) {
// for logic process
break;
}
$this->addTransaction($payment, $gatewayResponse->getTransactionReference(), Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $gatewayResponse->getTransactionReference()), Mage::helper('hipay')->getTransactionMessage($payment, self::OPERATION_AUTHORIZATION, $gatewayResponse->getTransactionReference(), $amount, true));
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
if (defined('Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW')) {
$state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
}
$status = self::STATUS_AUTHORIZATION_REQUESTED;
$order->setState($state, $status, $gatewayResponse->getMessage());
$payment->setAmountAuthorized($gatewayResponse->getAuthorizedAmount());
$payment->setBaseAmountAuthorized($gatewayResponse->getAuthorizedAmount());
$order->save();
break;
case 114:
//Expired
if ($order->getStatus() != self::STATUS_PENDING_CAPTURE) {
// for logic process
break;
}
$this->addTransaction($payment, $gatewayResponse->getTransactionReference(), Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $gatewayResponse->getTransactionReference()), Mage::helper('hipay')->getTransactionMessage($payment, self::OPERATION_AUTHORIZATION, $gatewayResponse->getTransactionReference(), $amount, true));
/**
* We change status to expired and state to holded
* So the administrator can try to capture transaction even if
* the auhorization was expired
*
*/
$state = Mage_Sales_Model_Order::STATE_HOLDED;
$status = self::STATUS_EXPIRED;
$order->setState($state, $status, $gatewayResponse->getMessage());
$order->save();
break;
case 115:
//Canceled
//.........这里部分代码省略.........