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);
}
(パラメータのすべての値が有効であり、正しい値が渡されていることを確認しました。ベンダー名はここでマスクされています)