當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Call::refundTransaction方法代碼示例

本文整理匯總了PHP中Call::refundTransaction方法的典型用法代碼示例。如果您正苦於以下問題:PHP Call::refundTransaction方法的具體用法?PHP Call::refundTransaction怎麽用?PHP Call::refundTransaction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Call的用法示例。


在下文中一共展示了Call::refundTransaction方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: hookadminOrder

 /**
  * @brief The merchant can cancel the order or refund the customer
  */
 public function hookadminOrder($params)
 {
     if (!$this->active) {
         return false;
     }
     $order = new Order($params['id_order']);
     $cart = new Cart($order->id_cart);
     $tokenTransaction = new TokenTransaction($cart->id);
     $token = $tokenTransaction->getToken();
     if ($token == null) {
         return false;
     }
     if ($order->getCurrentState() == Configuration::get('PS_OS_CANCELED') && $tokenTransaction->getStatus() != 'CANCEL') {
         $call = new Call();
         try {
             $result = $call->voidTransaction($token);
         } catch (Exception $e) {
             $this->context->smarty->assign('error', Tools::safeOutput($e->getMessage()));
         }
         if (isset($result->VoidResult->ApprovalStatus) && strrpos($result->VoidResult->ApprovalStatus, 'APPROVED') !== false) {
             $tokenTransaction->setStatus('CANCEL');
             $this->context->smarty->assign('message', $this->l('Action succeded.'));
         } else {
             $this->context->smarty->assign('error', isset($result->VoidResult->ApprovalStatus) ? Tools::safeOutput($result->VoidResult->ApprovalStatus) : $this->l('ERROR, please contact MerchantWare for Support assistance.'));
         }
     }
     if ($order->getCurrentState() == Configuration::get('PS_OS_REFUND') && $tokenTransaction->getStatus() != 'REFUND') {
         $call = new Call();
         try {
             $result = $call->refundTransaction($token, $order->total_paid_real);
         } catch (Exception $e) {
             $this->context->smarty->assign('error', Tools::safeOutput($e->getMessage()));
         }
         if (isset($result->RefundResult->ApprovalStatus) && strrpos($result->RefundResult->ApprovalStatus, 'APPROVED') !== false) {
             $tokenTransaction->setStatus('REFUND');
             $this->context->smarty->assign('message', $this->l('Action succeded.'));
         } else {
             $this->context->smarty->assign('error', isset($result->RefundResult->ApprovalStatus) ? Tools::safeOutput($result->RefundResult->ApprovalStatus) : $this->l('ERROR, please contact Merchant Warehouse for Support assistance.'));
         }
     }
     return $this->display(__FILE__, 'tpl/adminOrder.tpl');
 }
開發者ID:juniorhq88,項目名稱:PrestaShop-modules,代碼行數:45,代碼來源:merchantware.php


注:本文中的Call::refundTransaction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。