ActiveMerchant를 사용하여 Authorize.net CIM과 통합하고 있습니다. 필자는 자동화 된 테스트를 작성하는 중이고 WebMock 호출을 시작하여 테스트가 실제로 실행될 때마다 Authorize.net을 치는 것이 아닙니다.WebMock을 사용하여 성공적인 ActiveMerchant 응답을 가짜로 만듭니다.
원시 요청 데이터의 응답에서 XML 파일을 만들었으며 대부분 잘 작동합니다. 그러나 성공적인 응답을 조롱 할 때, ActiveMerchant는 어떤 이유로 Response.Success를 알려줍니다. 사실이 아닙니다.
내 기능
if self.cim_customer_profile_id.nil?
ActiveMerchant::Billing::Base.mode = :test
customer_profile_information = {
:profile => {
:merchant_customer_id => self.customer.username.first(20),
:email => self.customer.email
}
}
gateway = ActiveMerchant::Billing::AuthorizeNetCimGateway.new(
:login => AUTHORIZE_NET_API_LOGIN_ID,
:password => AUTHORIZE_NET_API_TRANSACTION_KEY
)
response = gateway.create_customer_profile(customer_profile_information)
if response.success?
self.cim_customer_profile_id = response.authorization
else
raise StandardError, response.message
end
end
그리고 내 스텁 응답은 다음과 같습니다 ActiveMerchant 성공적인, 스텁, 요청과 함께 작동하지 않습니다 어떤 이유는
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
<?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>10793616</customerProfileId>
<customerPaymentProfileIdList/>
<customerShippingAddressIdList/>
<validationDirectResponseList/>
</createCustomerProfileResponse>
있습니까? 아니면 ActiveMerchant가 실제로 응답이 성공적이라는 것을 등록하기 위해 필요한 것을 놓친 것입니까?