0

我正在做一些测试以在 cscart 中开发自定义支付网关插件

开发非常简单直观,但有一件事我要疯了 1 周。交易完成后,用户被重定向到 index.php?dispatch=checkout.complete&order_id=20036 但绿色弹出通知不会出现在其他付款上....

代码看起来很正常..我查看所有其他付款脚本,一切都很正常

/core/fn.cart.php fn_order_placement_routines 中的最后一个函数使用通知数据 fn_set_notification('N',.....

这是代码

if (!defined('AREA') ) { die('Access denied'); }
if (defined('PAYMENT_NOTIFICATION')) {
if ($mode == 'notify' && !empty($_REQUEST['order_id'])) {
  if (fn_check_payment_script('gateway.php', $_REQUEST['order_id'], $processor_data)) {
   $order_id = $_REQUEST['order_id'];
   $order_info = fn_get_order_info($order_id);
   $pp_response = array(
    'reason_text' => '',
    'order_status' => 'F'
   );
   if (empty($processor_data)) {
    $processor_data = fn_get_processor_data($order_info['payment_id']);
   }
   $returnvalue = $_POST['PROCESSING_RESULT'];
   if ($returnvalue && strstr($returnvalue,"ACK")) {
    $pp_response['order_status'] = "E";
    $pp_response['reason_text'] .= "Status: OK";
   }else {
    $pp_response['order_status'] = "N";
    $pp_response["reason_text"] = fn_get_lang_var('text_transaction_cancelled');
   }
   if (isSet($_REQUEST['IDENTIFICATION_UNIQUEID'])) {
    $pp_response['transaction_id'] = $_REQUEST['IDENTIFICATION_UNIQUEID'];
   }
[b]   fn_finish_payment($_REQUEST['order_id'], $pp_response, false);
   fn_order_placement_routines($_REQUEST['order_id'], true);[/b]
  }
}
} else {
    if ($mode == 'place_order') {
    //call the gateway, assign response url etc
    // $current_location."/".$index_script."?dispatch=payment_notification.notify&payment=gateway.php&order_id=".$order_id;
    }
}

默认情况下,fn_order_place_routine 应该根据订单状态显示绿色或红色弹出窗口......什么都没有......不会出现

提前致谢

4

1 回答 1

1

正如我所看到的,您正在使用自定义订单状态进行成功交易:

$pp_response['order_status'] = "E";

因此,要显示通知,此状态的'inventory'选项应设置为'Decreased'。在这种情况下,E 状态将包含在fn_get_order_paid_statuses()函数的结果中,并且fn_order_placement_routines函数中的以下代码将起作用:

if (in_array($status, fn_get_order_paid_statuses())) {
    if ($action == 'repay') {
        fn_set_notification('N', __('congratulations'), __('text_order_repayed_successfully'));
    } else {
        fn_set_notification('N', __('order_placed'), __('text_order_placed_successfully'));
    }
}

此致。

于 2014-03-19T11:00:30.453 回答