0

我无法解决这个问题,我被困在这里试图弄清楚发生了什么,我安装了支付扩展,当我尝试用信用卡支付产品时,一切正常,我的支付服务器确认交易和OpenCart 向卖家和客户发送电子邮件,问题是,完成交易后,OpenCart 没有向卖家和客户添加订单历史记录,我尝试查看扩展源代码,但对我来说一切都很好. 我问其他人,没有人对这个扩展有问题。日志文件只是输出:

2017-08-19 4:50:29 - FEE5D6-AF8F438F43BD-F004C9EFA444-E7BD05

这是付款扩展中的一段js,它调用该函数来确认付款:

PagSeguroDirectPayment.createCardToken({
            cardNumber: $('input#numero-cartao').val(),
            brand: $('input#bandeira').val(),
            cvv: $('input#cvv').val(),
            expirationMonth: expiration[0],
            expirationYear: expiration[1],
            success: function(data) {
                $.ajax({
                    url: 'index.php?route=extension/payment/pagseguro_cartao/transition',
                    data: 'creditCardToken=' + data.card.token + '&senderHash=' + PagSeguroDirectPayment.getSenderHash() + '&installmentQuantity=' + $('select#parcelas option:selected').attr('data-value') + '&installmentValue=' + $('select#parcelas').val() + '&creditCardHolderName=' + $('input#nome').val() + '&creditCardHolderCPF=' + $('input#cpf').val() + '&creditCardHolderBirthDate=' + $('input#data-nascimento').val() + '&creditCardHolderPhone=' + $('input#telefone').val(),
                    type: 'POST',
                    dataType: 'JSON',
                    success: function(data){
                        if (data.error) {
                            $('#warning').html( getError(data.error.code, data.error.message) ).show();
                        } else {
                            $('#button-confirm').attr('disabled');

                            $.ajax({
                                url: 'index.php?route=extension/payment/pagseguro_cartao/confirm',
                                data: 'status=' + data.status,
                                type: 'POST',
                                success: function() {
                                    /*location.href = '{{ continue }}'*/
                                }
                            });
                        }
                    },
                    complete: function(data) {
                        $('#button-confirm').button('reset');
                    }
                });
            },
            error: function(data) {
                console.log(data);
                var html = '<ul>';
                $.each(data.errors, function(i,e){
                    html += '<li>' + getError(i,e) + '</li>';
                });
                html += '</ul>';

                $('#warning').html(html).show();

                $('#button-confirm').button('reset');
            }
        });
    });

和目录/控制器/扩展/付款处的控制器:

public function confirm() {
        $this->load->model('checkout/order');

        switch ($this->request->post['status']) {
            case 1:
                $status = $this->config->get('payment_pagseguro_aguardando_pagamento');
                break;
            case 2:
                $status = $this->config->get('payment_pagseguro_analise');
                break;
            case 3:
                $status = $this->config->get('payment_pagseguro_paga');
                break;
            case 4:
                $status = $this->config->get('payment_pagseguro_disponivel');
                break;
            case 5:
                $status = $this->config->get('payment_pagseguro_disputa');
                break;
            case 6:
                $status = $this->config->get('payment_pagseguro_devolvida');
                break;
            case 7:
                $status = $this->config->get('payment_pagseguro_cancelada');
                break;
            default: 
                $status = $this->config->get('payment_pagseguro_aguardando_pagamento');
                break;
        }

        $this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $status);

        if (isset($this->session->data['order_id'])) {
            $this->cart->clear();
            unset($this->session->data['shipping_method']);
            unset($this->session->data['shipping_methods']);
            unset($this->session->data['payment_method']);
            unset($this->session->data['payment_methods']);
            unset($this->session->data['comment']);
            unset($this->session->data['coupon']);
            unset($this->session->data['pagseguro_desconto']);
            unset($this->session->data['pagseguro_acrescimo']);
        }
    }
}
4

1 回答 1

0

显然,来自管理区域的所有订单历史记录 ajax 调用都通过 API 运行。哪个 API 控制器位于目录文件夹中。因此,如果您在 .htaccess 文件中设置了重定向规则,那么整个 ajax 请求将不起作用。

我建议您从 Google Chrome 或 Firefox 运行控制台并打开“网络”选项卡。添加新订单历史记录时,请检查服务器的响应。你会发现问题。

于 2017-08-22T10:27:21.243 回答