Я создал учетную запись разработчика на authorize.net и пытаюсь создать профиль клиента через activemerchant.
> GATEWAY.create_customer_profile(:profile => { :merchant_customer_id => "123foobar", :email => "[email protected]" })
#<ActiveMerchant::Billing::Response:0x007fc3a2663e20 @params={"messages"=>
{"result_code"=>"Error", "message"=>{"code"=>"E00007", "text"=>"User authentication failed
due to invalid authentication values."}}}, @message="User authentication failed due to
invalid authentication values.", @success=false, @test=false, @authorization=nil,
@fraud_review=nil,
@avs_result={"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil},
@cvv_result={"code"=>nil, "message"=>nil}>
Я посмотрел этот код ошибки, и он говорит:
API Error Code: E00007
Error Code Text: User authentication failed due to invalid authentication values.
Description: The name/and or transaction key is invalid.
Other Tips: Try switching between production and developer test URL's. The test URL
requires a separate developer test account, which can be set up by filling out the following form: http://developer.authorize.net/testaccount.
На всякий случай я проверил ключ входа в API. Когда я проверяю объект шлюза, я вижу логин (ключ входа в API), пароль (ключ транзакции) и :test => true
Кто-нибудь может сказать мне, в чем дело?
ОБНОВИТЬ
Поэтому я решил, что лучше всего абсолютно убедиться, что проблема связана с authorize.net --- Оказывается, это не так. Если я делаю запрос через curl, он выполняется успешно:
curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X POST -d '<?xml version="1.0" encoding="utf-8"?>
<createCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>myTestLogin</name>
<transactionKey>myTransactionKey</transactionKey>
</merchantAuthentication>
<profile>
<merchantCustomerId>custId123</merchantCustomerId>
<description>some description</description>
<email>[email protected]</email>
</profile>
</createCustomerProfileRequest>' https://apitest.authorize.net/xml/v1/request.api
<?xml version="1.0" encoding="utf-8"?><createCustomerProfileResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><customerProfileId>10521778</customerProfileId><customerPaymentProfileIdList /><customerShippingAddressIdList /><validationDirectResponseList /></createCustomerProfileResponse>
...
Итак, это означает, что проблема связана с ActiveMerchant......... Я могу прекрасно создавать профили клиентов с моей реальной учетной записью через activemerchant, но по какой-то причине я не могу сделать это с тестовой учетной записью разработчика. ..
Есть одна вещь, которая вызывает у меня подозрения:
Несмотря на то, что шлюз говорит, что находится в тестовом режиме: 1.9.3p194 :007 > GATEWAY => #, :password=>, :test=>true}>
на самом деле запрос, находится ли он в тестовом режиме, возвращает неожиданный ответ........
1.9.3p194 :008 > GATEWAY.test?
=> false
хммммммммм...