使用ActiveMerchant :: Billing :: AuthorizeNetCimGateway与Authorize.Net的opaqueData

时间:2018-02-08 10:51:32

标签: ruby-on-rails ruby authorize.net activemerchant accept.js

2018年2月8日

我的Ruby on Rails应用程序已成功使用ActiveMerchant::Billing::AuthorizeNetCimGateway付款类型:credit_card来创建具有嵌入式付款资料的客户资料。

我现在正在迁移到Authorize.Net的Accept.js,它接受从托管付款表单直接发送的信用卡信息,并返回可以使用一次的COMMON.ACCEPT.INAPP.PAYMENT类型的付款。创建支付交易,客户档案等

我使用payment_profile构建:opaque_data哈希代替:credit_card。例如:

> payment_profile
=> {:payment=>
  {:opaque_data=>
    {:data_descriptor=>"COMMON.ACCEPT.INAPP.PAYMENT",
     :data_value=> "eyJjb2RlIjoiNTBfMl8wNjAwMDUzNjBDMzAwOUQ3OEUzOUQ1MDk4QTYxMjFGNzlCQ0Y3RDRGQUE4NTNCMEU3MkYyMUJBNTI3NUE0NjQ2Q0ZFQTVFNzMxMDI2Qjg5ODJGNjBFRUE2RDZFMTZCMUY5NzQ4NUJFIiwidG9rZW4iOiI5NTE4MDc3Njg5NDA4MTAwOTAzNTAyIiwidiI6IjEuMSJ9"}},
 :bill_to=>{:first_name=>"Firstname", :last_name=>"Lastname", :address=>nil, :city=>nil, :state=>nil, :zip=>nil, :country=>nil, :phone_number=>"(012) 234-5678"}}

然后我尝试使用类似于以下内容的现有代码创建客户资料:

response = @gateway.create_customer_profile profile: {
  email: client.email,
  description: client.name,
  merchant_customer_id: client.id,
  payment_profiles: payment_profile
}

但是,我收到的回复中有result_code Error,并抱怨元素payment的“内容不完整”,如下所示:

> response
=> #<ActiveMerchant::Billing::Response:0x007f9827d14900
 @authorization=nil,
 @avs_result={"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil},
 @cvv_result={"code"=>nil, "message"=>nil},
 @emv_authorization=nil,
 @error_code="E00003",
 @fraud_review=nil,
 @message=
  "The element 'payment' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'creditCard, bankAccount, trackData, encryptedTrackData, payPal, opaqueData, emv' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.",
 @params=
  {"messages"=>
    {"result_code"=>"Error",
     "message"=>
      {"code"=>"E00003",
       "text"=>
    "The element 'payment' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'creditCard, bankAccount, trackData, encryptedTrackData, payPal, opaqueData, emv' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."}}},
 @success=false,
 @test=true>

我脑子里有几个问题:

  1. ActiveMerchant::Billing::AuthorizeNetCimGateway是否支持Accept.js':opaque_data代替:credit_card

  2. 如果ActiveMerchant::Billing::AuthorizeNetCimGateway支持:opaque_data,则上述payment_profile可能出现问题,以及我需要为payment元素提供的其他内容

  3. 我很感激您解决此问题的任何帮助。

0 个答案:

没有答案