本文整理汇总了PHP中Mage_Payment_Model_Method_Abstract::void方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Method_Abstract::void方法的具体用法?PHP Mage_Payment_Model_Method_Abstract::void怎么用?PHP Mage_Payment_Model_Method_Abstract::void使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Payment_Model_Method_Abstract
的用法示例。
在下文中一共展示了Mage_Payment_Model_Method_Abstract::void方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: void
public function void(Varien_Object $payment)
{
parent::void($payment);
try {
$data = array('Merchant_ID' => urlencode($this->getConfigData('merchant')), 'Billnumber' => urlencode($payment->getParentTransactionId()), 'Login' => urlencode($this->getConfigData('api_login')), 'Password' => urlencode($this->getConfigData('api_password')));
$xml = $this->callAssist(self::CANCEL_URL, $data);
if ((int) $xml['firstcode'] || (int) $xml['secondcode']) {
Mage::throwException('error in call');
}
if ('AS000' != (string) $xml->orders->order->responsecode) {
Mage::throwException($this->getAssistErrors((string) $xml->orders->order->responsecode));
}
if (Mage::helper('assist')->isServiceSecured()) {
$y = implode("", array($this->getConfigData('merchant'), (string) $xml->orders->order->ordernumber, (string) $xml->orders->order->orderamount, (string) $xml->orders->order->ordercurrency, (string) $xml->orders->order->orderstate, (string) $xml->orders->order->packetdate));
$keyFile = Mage::getBaseDir('var') . DS . self::PEM_DIR . DS . $this->getConfigData('assist_key');
if ((string) $xml->orders->order->signature != $this->sign($y, $keyFile)) {
Mage::throwException('Incorrect Signature.');
}
}
// success
Mage::helper('assist')->debug($xml);
} catch (Mage_Core_Exception $e) {
Mage::helper('assist')->debug($e->getMessage());
throw $e;
}
Mage::helper('assist')->debug('void');
return $this;
}
示例2: void
/**
* Voids an order
* @param Varien_Object $payment
* @return Mage_Payment_Model_Method_Abstract
*/
public function void(Varien_Object $payment)
{
parent::void($payment);
$hash = $payment->getData('ebanx_hash');
Mage::log('Void order ' . $hash);
$response = \Ebanx\Ebanx::doRefundOrCancel(array('hash' => $hash, 'description' => 'The order has been cancelled.'));
return $this;
}
示例3: void
/**
* Custom void behavior, trigger Barclaycard cancel request
*
* @param Varien_Object $payment
* @return void
* @throws Mage_Core_Exception
*/
public function void(Varien_Object $payment)
{
//Proceed parent void method in case that registry value ops_auto_void is set
if (true === Mage::registry('ops_auto_void')) {
Mage::unregister('ops_auto_void');
return parent::void($payment);
}
//Set initital params
$params = Mage::app()->getRequest()->getParams();
$orderID = $payment->getOrder()->getId();
$order = Mage::getModel("sales/order")->load($orderID);
//Calculate amount which has to be captured
$alreadyCaptured = Mage::helper('ops/order_void')->getCapturedAmount($order);
$grandTotal = Mage::helper('ops/payment')->getBaseGrandTotalFromSalesObject($order);
$voidAmount = $grandTotal - $alreadyCaptured;
$storeId = $order->getStoreId();
//Build void directLink-Request-Params
$requestParams = array('AMOUNT' => $this->getHelper()->getAmount($voidAmount), 'PAYID' => $payment->getAdditionalInformation('paymentId'), 'OPERATION' => self::OPS_DELETE_AUTHORIZE, 'CURRENCY' => Mage::app()->getStore($storeId)->getBaseCurrencyCode());
//Check if there is already a waiting void transaction, if yes: redirect to order view
if (Mage::helper('ops/directlink')->checkExistingTransact(self::OPS_VOID_TRANSACTION_TYPE, $orderID)) {
$this->getHelper()->redirectNoticed($orderID, $this->getHelper()->__('You already sent a void request. Please wait until the void request will be acknowledged.'));
return;
}
//Check if there is already a waiting capture transaction, if yes: redirect to order view
if (Mage::helper('ops/directlink')->checkExistingTransact(self::OPS_CAPTURE_TRANSACTION_TYPE, $orderID)) {
$this->getHelper()->redirectNoticed($orderID, $this->getHelper()->__('There is one capture request waiting. Please wait until this request is acknowledged.'));
return;
}
try {
//perform ops cancel request
$response = Mage::getSingleton('ops/api_directlink')->performRequest($requestParams, Mage::getModel('ops/config')->getDirectLinkGatewayPath($storeId), $order->getStoreId());
//Save ops response to payment transaction
Mage::helper('ops/payment')->saveOpsStatusToPayment($payment, $response);
/*
* If the ops response results in a waiting or uncertain state, create a void transaction which is waiting
* for an asynchron directLink-postback
*/
if ($response['STATUS'] == self::OPS_VOID_WAITING || $response['STATUS'] == self::OPS_VOID_UNCERTAIN) {
Mage::helper('ops/directlink')->directLinkTransact(Mage::getSingleton("sales/order")->loadByIncrementId($payment->getOrder()->getIncrementId()), $response['PAYID'], $response['PAYIDSUB'], array('amount' => $voidAmount, 'void_request' => Mage::app()->getRequest()->getParams(), 'response' => $response), self::OPS_VOID_TRANSACTION_TYPE, Mage::helper('ops')->__('Start Barclaycard void request. Barclaycard status: %s.', $this->getHelper()->getStatusText($response['STATUS'])));
$this->getHelper()->redirectNoticed($orderID, $this->getHelper()->__('The void request is sent. Please wait until the void request will be accepted.'));
/*
* If the ops response results directly in accepted state, create a void transaction and execute parent void method
*/
} elseif ($response['STATUS'] == self::OPS_VOIDED || $response['STATUS'] == self::OPS_VOIDED_ACCEPTED) {
Mage::helper('ops/directlink')->directLinkTransact(Mage::getSingleton("sales/order")->loadByIncrementId($payment->getOrder()->getIncrementId()), $response['PAYID'], $response['PAYIDSUB'], array(), self::OPS_VOID_TRANSACTION_TYPE, $this->getHelper()->__('Void order succeed. Barclaycard status: %s.', $response['STATUS']), 1);
return parent::void($payment);
} else {
Mage::getModel('ops/status_update')->updateStatusFor($payment->getOrder());
Mage::throwException($this->getHelper()->__('Void order failed. Barclaycard status: %s.', $response['STATUS']));
}
} catch (Exception $e) {
Mage::getModel('ops/status_update')->updateStatusFor($payment->getOrder());
Mage::helper('ops')->log("Exception in void request:" . $e->getMessage());
throw new Mage_Core_Exception($e->getMessage());
}
}
示例4: void
/**
* Void payment
*
* @param Varien_Object $invoicePayment
* @return Mage_Payment_Model_Abstract
*/
public function void(Varien_Object $payment)
{
parent::void();
$this->cancel($payment);
return $this;
}
示例5: void
/**
* Cancel authorisation (void payment)
*/
public function void(Varien_Object $payment)
{
parent::void($payment);
// if same amount has already been captured, refund it
if ($amount = $payment->getBaseAmountPaid()) {
return $this->refund($payment, $amount);
}
if ($payment->getLastTransId()) {
$params = $this->_initRequestParams();
$params['PAYMENT.CODE'] = $this->_getPaymentCode(self::PAYMENT_TYPE_REBILL);
$params['IDENTIFICATION.REFERENCEID'] = $payment->getLastTransId();
$response = $this->_getApi()->request($params);
$this->_processResponse($params, $response, $payment);
}
return $this;
}
示例6: void
public function void(Varien_Object $payment)
{
if (true === Mage::registry('postfinance_auto_void')) {
Mage::unregister('postfinance_auto_void');
return parent::void($payment);
}
$params = Mage::app()->getRequest()->getParams();
$order = Mage::getModel("sales/order")->load($params['order_id']);
$orderID = $payment->getOrder()->getId();
$alreadyCaptured = Mage::helper('postfinance/order_void')->getCapturedAmount($order);
$voidAmount = $order->getGrandTotal() - $alreadyCaptured;
$requestParams = array('AMOUNT' => round($voidAmount * 100), 'ORDERID' => $this->getConfig()->getConfigData('devprefix') . $order->getQuoteId(), 'OPERATION' => self::POSTFINANCE_DELETE_AUTHORIZE);
if (Mage::helper('postfinance/directlink')->checkExistingTransact(self::POSTFINANCE_VOID_TRANSACTION_TYPE, $orderID)) {
$this->getHelper()->redirectNoticed($orderID, $this->getHelper()->__('You already sent a void request. Please wait until the void request will be acknowledged.'));
}
if (Mage::helper('postfinance/directlink')->checkExistingTransact(self::POSTFINANCE_CAPTURE_TRANSACTION_TYPE, $orderID)) {
$this->getHelper()->redirectNoticed($orderID, $this->getHelper()->__('There is one capture request waiting. Please wait until this request is acknowledged.'));
}
try {
$url = Mage::getModel('postfinance/config')->getDirectLinkGatewayPath();
$response = Mage::getSingleton('postfinance/api_directlink')->performRequest($requestParams, $url);
Mage::helper('postfinance/payment')->savePostFinanceStatusToPayment($payment, $response);
if ($response['STATUS'] == self::POSTFINANCE_VOID_WAITING || $response['STATUS'] == self::POSTFINANCE_VOID_UNCERTAIN) {
Mage::helper('postfinance/directlink')->directLinkTransact(Mage::getSingleton("sales/order")->loadByIncrementId($payment->getOrder()->getIncrementId()), $response['PAYID'], $response['PAYIDSUB'], array('amount' => $voidAmount, 'void_request' => Mage::app()->getRequest()->getParams(), 'response' => $response), self::POSTFINANCE_VOID_TRANSACTION_TYPE, Mage::helper('postfinance')->__('Start PostFinance void request. PostFinance status: %s.', $this->getHelper()->getStatusText($response['STATUS'])));
$this->getHelper()->redirectNoticed($orderID, $this->getHelper()->__('The void request is sent. Please wait until the void request will be accepted.'));
} elseif ($response['STATUS'] == self::POSTFINANCE_VOIDED || $response['STATUS'] == self::POSTFINANCE_VOIDED_ACCEPTED) {
Mage::helper('postfinance/directlink')->directLinkTransact(Mage::getSingleton("sales/order")->loadByIncrementId($payment->getOrder()->getIncrementId()), $response['PAYID'], $response['PAYIDSUB'], array(), self::POSTFINANCE_VOID_TRANSACTION_TYPE, $this->getHelper()->__('Void order succeed. PostFinance status: %s.', $response['STATUS']), 1);
return parent::void($payment);
} else {
Mage::throwException($this->getHelper()->__('Void order failed. PostFinance status: %s.', $response['STATUS']));
}
} catch (Exception $e) {
Mage::helper('postfinance')->log("Exception in void request:" . $e->getMessage());
throw new Mage_Core_Exception($e->getMessage());
}
}