Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/54.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Authorize.net(CIM)使用ruby on rails创建客户概要文件_Ruby On Rails_Ruby_Xml_Authorize.net - Fatal编程技术网

Ruby on rails Authorize.net(CIM)使用ruby on rails创建客户概要文件

Ruby on rails Authorize.net(CIM)使用ruby on rails创建客户概要文件,ruby-on-rails,ruby,xml,authorize.net,Ruby On Rails,Ruby,Xml,Authorize.net,使用API创建客户付款配置文件。 获取错误: E00003 命名空间“AnetApi/xml/v1/schema/AnetApiSchema.xsd”中的元素“paymentProfiles”不能包含文本。名单 预期可能的元素:“customerType、billTo、payment、, 命名空间中的driversLicense、taxId、defaultPaymentProfile “AnetApi/xml/v1/schema/AnetApiSchema.xsd” 请求授权.net <A

使用API创建客户付款配置文件。 获取错误:

E00003

命名空间“AnetApi/xml/v1/schema/AnetApiSchema.xsd”中的元素“paymentProfiles”不能包含文本。名单 预期可能的元素:“customerType、billTo、payment、, 命名空间中的driversLicense、taxId、defaultPaymentProfile “AnetApi/xml/v1/schema/AnetApiSchema.xsd”

请求授权.net

<AuthorizeNet::API::CreateCustomerProfileRequest:0x007fc91d9e48a8 @merchantAuthentication=nil, @refId=nil, @profile=#<AuthorizeNet::API::CustomerProfileType:0x007fc91d9e4880 @merchantCustomerId="jdoe6607", @description="John2 Doe", @email="2686@mail.com", @paymentProfiles=[#<AuthorizeNet::API::CustomerPaymentProfileType:0x007fc91d9e4ab0 @customerType="individual", @billTo=#<AuthorizeNet::API::CustomerAddressType:0x007fc91d9e4c68 @firstName="Ellen", @lastName="Johnson", @company="Souveniropolis", @address="14 Main Street", @city="Pecan Springs", @state="TX", @zip="44628", @country="US", @phoneNumber="999-999-9999", @faxNumber="999-999-9999">, @payment=#<AuthorizeNet::API::PaymentType:0x007fc91d9e4d80 @creditCard=#<AuthorizeNet::API::CreditCardType:0x007fc91d9e4da8 @cardNumber="4111111111111111", @expirationDate="2020-05", @cardCode="111", @isPaymentToken=nil, @cryptogram=nil>, @bankAccount=nil, @trackData=nil, @encryptedTrackData=nil, @payPal=nil, @opaqueData=nil>, @driversLicense=nil, @taxId=nil>], @shipToList=[#<AuthorizeNet::API::CustomerAddressType:0x007fc91d9e4a60 @firstName="John", @lastName="Snow", @company="Night's Watch, Inc.", @address="Castle Black", @city="The Wall", @state="North Westeros", @zip="99499", @country="Westeros", @phoneNumber="999-999-9999", @faxNumber="999-999-9999">]>, @validationMode="liveMode">

@约翰诺德:我使用了Authorize.NETAPI。该请求无效。我不确定该代码应该如何工作,但它没有生成对CIM API的有效请求。感谢您的回复。但和我在演示应用程序中使用的请求一样,它也在工作。@johncode我使用了Authorize.NETAPI。该请求无效。我不确定该代码应该如何工作,但它没有生成对CIM API的有效请求。感谢您的回复。但和我在演示应用程序中使用的请求一样,它也在工作。
transaction = Transaction.new(api_login_id, api_transaction_key, :gateway => :sandbox)
payment = PaymentType.new(CreditCardType.new)
payment.creditCard.cardNumber = '4111111111111111'
payment.creditCard.expirationDate = '2020-05'

billTo = CustomerAddressType.new
billTo.firstName = "Ellen"
billTo.lastName = "Johnson"
billTo.company = "Souveniropolis"
billTo.address = "14 Main Street"
billTo.city = "Pecan Springs"
billTo.state = "TX"
billTo.zip = "44628"
billTo.country = "US"
billTo.phoneNumber = "999-999-9999"
billTo.faxNumber = "999-999-9999"

paymentProfile = CustomerPaymentProfileType.new
paymentProfile.payment = payment
paymentProfile.billTo = billTo

shippingAddress = CustomerAddressType.new
shippingAddress.firstName = "John"
shippingAddress.lastName = "Snow"
shippingAddress.company = "Night's Watch, Inc."
shippingAddress.address = "Castle Black"
shippingAddress.city = "The Wall"
shippingAddress.state = "North Westeros"
shippingAddress.zip = "99499"
shippingAddress.country = "Westeros"
shippingAddress.phoneNumber = "999-999-9999"
shippingAddress.faxNumber = "999-999-9999"

request = CreateCustomerProfileRequest.new
request.profile = CustomerProfileType.new
request.profile.merchantCustomerId = 'jdoe' + rand(10000).to_s
request.profile.description = 'John2 Doe'
request.profile.email = rand(10000).to_s + '@mail.com'
request.profile.paymentProfiles = [paymentProfile]
request.profile.shipToList = [shippingAddress]    
request.validationMode = ValidationModeEnum::LiveMode    

response = transaction.create_customer_profile(request)