当前位置: 首页>>代码示例>>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;未经允许,请勿转载。