Я получаю следующую ошибку при попытке использовать SagePay Server (при распечатке ответа):
["data":protected]=>array(3) {
["VPSProtocol"]=>
string(4) "2.23"
["Status"]=>
string(7) "INVALID"
["StatusDetail"]=>
string(107) "The data in the BillingCountry field you supplied is an invalid length. Must be an ISO 3166-1 country code."
}
но я передаю значение «GB» в качестве BillingCountry, что является правильным (SagePay ожидает, что billingCountry будет в алфавитном порядке и не более 2 символов)
["card"]=>
object(Omnipay\Common\CreditCard)#46 (1) {
["parameters":protected]=>
object(Symfony\Component\HttpFoundation\ParameterBag)#48 (1) {
["parameters":protected]=>
array(11) {
["email"]=>
string(17) "[email protected]"
["billingFirstName"]=>
string(3) "Joe"
["shippingFirstName"]=>
string(3) "Joe"
["billingLastName"]=>
string(6) "Bloggs"
["shippingLastName"]=>
string(6) "Bloggs"
["billingAddress1"]=>
string(9) "Address 1"
["billingAddress2"]=>
string(9) "Address 2"
["billingCity"]=>
string(4) "City"
["billingPostcode"]=>
string(7) "AB1 1BA"
["billingCountry"]=>
string(2) "GB"
["billingPhone"]=>
string(13) "01234 567 890"
}
}
И это мой код:
$response = $this->gateway->Purchase(array(
'description'=> 'Online order',
'currency'=> 'GBP',
'transactionId'=> mt_rand(99, 9999),
'transactionReference' => 'test order',
'amount'=> '1.00',
'returnUrl' => 'http://www.test.com/returnURL/',
'cancelUrl' => 'http://www.test.com/cancelURL/',
'card' => array(
'email' => '[email protected]',
'clientIp' => '123.123.123.123',
'firstName' => 'Joe',
'LastName' => 'Bloggs',
'billingAddress1' => 'Address 1',
'billingAddress2' => 'Address 2',
'billingCity' => 'City',
'billingPostcode' => 'AB1 1BA',
'billingCountry' => 'GB',
'billingPhone' => '01234 567 890'
)))->send();
Не могу разобраться, вроде все правильно. Кажется, я немного схожу с ума! Я упускаю совершенно очевидное?
Обновлено 28.07.2014: я пробовал разные вещи, включая отправку данных в разных форматах:
$formInputData = array(
'firstName' => 'Joe',
'lastName' => 'Bloggs',
'billingAddress1' => '88',
'billingAddress2' => 'Address 2',
'billingCity' => 'City',
'billingPostcode' => '412',
'billingCountry' => 'GB',
'billingPhone' => '01234 567 890',
'email' => '[email protected]',
'clientIp' => '123.123.123.123'
);
$card = new CreditCard($formInputData);
$transactionID = mt_rand(99, 9999);
$response = $this->gateway->purchase(['amount' => '1.00', 'returnUrl' => 'http://www.example.com/return/', 'transactionId'=> $transactionID, 'description'=> 'Online order', 'transactionReference' => 'test order', 'currency'=> 'GBP', 'card' => $card])->send();
и это не имеет никакого значения.
Я также пытался отправить одни и те же данные (но с добавлением данных тестовой кредитной карты в параметр карты) как в SagePay Direct, так и в CardSave.
С SagePay Direct я получаю сообщение «Поле BillingCountry отсутствует в POST».
С CardSave транзакция проходит успешно, но я замечаю, что в поле страны указано «Н/Д», когда я смотрю на историю транзакций в своем CardSave.