2

有没有人在 CI-Merchant 中使用 SagePay Direct?到目前为止,我得到的唯一回应是:

Merchant_response Object
(
    [_status:protected] => failed
    [_message:protected] => 
    [_reference:protected] => 
    [_data:protected] => 
    [_redirect_url:protected] => 
    [_redirect_method:protected] => GET
    [_redirect_message:protected] => 
    [_redirect_data:protected] => 
)

我以前没有使用过 SagePay,需要尽快完成这项工作。我已将我的 IP 地址添加到 SagePay 测试区域,但目前并未像在我的本地主机上那样在 https 上进行测试。

我的代码如下所示:

public function process_payment()
    {

        $settings = array (
            'vendor' => 'XXX',
            'test_mode' => TRUE,
            'simulator_mode' => FALSE,
        );

        $this->merchant->initialize($settings);

        //get customer details
        $this->load->library('custom_cart');
        $customer = $this->custom_cart->get_customer_invoice_info();
        $customer_name = '';
            if ( ! empty($customer['title'])) $customer_name .= $customer['title'] .' ';
        $customer_name .= $customer['forename'];
        $customer_name .= $customer['surname'];

        $customer_street = $customer['address1'];
        $customer_street2 = $customer['address2'];
            if ( ! empty($customer['address3'])) $customer_street2 .= $customer['address3'];

        //order details
        $amt = $this->custom_cart->order_total();

        $get_curr = $this->custom_cart->get_currency();
        $currencycode = $get_curr['name'];

        $shippingamt = $this->custom_cart->shipping_cost();

        $itemamt = $this->custom_cart->order_subtotal();
        $taxamt = '0';
        $invnum = $this->custom_cart->customer_order_no();

         $params = array(
            'description'=> 'Online order',
            'currency'=> $currencycode,
            'transaction_id'=> $invnum,
            'email'=> $customer['email_address'],
            'first_name'=> $customer['forename'],
            'last_name'=> $customer['surname'],
            'address1'=> $customer_street,
            'address2'=> $customer_street2,
            'city'=> $customer['town_city'],
            'postcode'=> $customer['postcode'],
            'country'=> $customer['country'],
            'region'=> $customer['county'],
            'phone'=> $customer['phone'],

            'Amount'=> $amt,
            'card_no'=> $this->input->post('creditcard'), 
            'name'=> $customer_name, 
            'card_type' => $this->input->post('creditcardtype'), 
            'exp_month'=> $this->input->post('cardmonth'),
            'exp_year' => $this->input->post('cardyear'), 
            'csc'=> $this->input->post('cardsecurecode')
        );


        $response = $this->merchant->purchase($params);

        echo '<pre>';
        print_r($response);


    }

(参数的所有值都是有效的,我已经检查了正确的值是否传递给它们。供应商名称在此处被屏蔽)

4

1 回答 1

1

终于找到了问题所在 - 我今年通过了两位数,这就是它失败的地方(我忘记了我之前添加了 20 前缀的商家)!谢谢您的帮助。(如果有人有类似的问题,我会通过回显函数跟踪中每个函数的响应来追踪它)

于 2013-01-30T14:47:27.780 回答