2015-11-03 57 views
3

我一直在使用Authorize.NET的GetCustomerProfile多年,今天突然响应未返回付款资料。它只是返回一组配置文件,但所有重要的字段(如payment)都为空。Authorize.NET GetCustomerProfile不返回数据

(这是他们的CIM特征,其中一个“模糊”的付款资料传回并应该像XXXX1234的一部分)

我使用Visual Studio中生成的代理网址https://api.authorize.net/soap/v1/Service.asmx?WSDL(生成一个参考.cs文件)

+0

你在沙箱里试过了吗?它会给你同样的结果吗? –

+0

其实是的,它的确如此 - 我想出了这个问题,我即将作出回应 - 希望它可以帮助其他人(并希望他们不会像这样再次破坏它)...... –

回答

1

你好,西蒙! 它看起来像Authorize.NET更新他们的服务与新领域,但忘了将它们添加到WSDL。

这是我送的示例请求(截获使用Fiddler):

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Header> 
     <VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo3vYq2eC/5VIuiUcm2hEtw8AABBBJr/dLQF7z02Y7UKwphq24W1n9j0XlQ1MiAlOjy5fO14ACQAA</VsDebuggerCausalityData> 
    </s:Header> 
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
     <GetCustomerProfile xmlns="https://api.authorize.net/soap/v1/"> 
      <merchantAuthentication> 
       <name>95U6bwXXXXX</name> 
       <transactionKey>8tf62gV7XXXXXX</transactionKey> 
      </merchantAuthentication> 
      <customerProfileId>37745529</customerProfileId> 
     </GetCustomerProfile> 
    </s:Body> 
</s:Envelope> 

这是响应:这里

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <soap:Body> 
     <GetCustomerProfileResponse xmlns="https://api.authorize.net/soap/v1/"> 
      <GetCustomerProfileResult> 
       <resultCode>Ok</resultCode> 
       <messages> 
        <MessagesTypeMessage> 
         <code>I00001</code> 
         <text>Successful.</text> 
        </MessagesTypeMessage> 
       </messages> 
       <profile> 
        <merchantCustomerId>33938</merchantCustomerId> 
        <email>[email protected]</email> 
        <customerProfileId>37745529</customerProfileId> 
        <paymentProfiles> 
         <CustomerPaymentProfileMaskedType> 
          <billTo> 
           <firstName>TEST</firstName> 
           <lastName>USER</lastName> 
           <company>Defender Razor</company> 
           <address>1 RODEO DRIVE</address> 
           <city>BEVERLY HILLS</city> 
           <state>CA</state> 
           <zip>90210</zip> 
           <country>UNITED STATES</country> 
          </billTo> 
          <customerProfileId>0</customerProfileId> 
          <customerPaymentProfileId>34313485</customerPaymentProfileId> 
          <payment> 
           <creditCard> 
            <cardNumber>XXXX5108</cardNumber> 
            <expirationDate>XXXX</expirationDate> 
           </creditCard> 
          </payment> 
         </CustomerPaymentProfileMaskedType> 
        </paymentProfiles> 
       </profile> 
      </GetCustomerProfileResult> 
     </GetCustomerProfileResponse> 
    </soap:Body> 
</soap:Envelope> 

一切是正确的 - 因为你可以看到payment节点正确发送。

然而 - 与.NET反序列化属性事项的顺序 - 为所生成的References.cs文件中指定。

[System.Xml.Serialization.XmlElementAttribute(Order=0)] 

事实证明,两个新字段添加到响应billTocustomerProfileId,但他们并没有加入到WSDL。

所以,当试图反序列化领域billTo被发现,但不是什么预期 - 所以一切都结束了空。

如果加上这两行(并谨慎地补充他们的正是这种类型),那么你可以重新生成references.cs文件(通过在服务引用右击并重新生成文件)。

如果您是通过网址https://api.authorize.net/soap/v1/Service.asmx?WSDL生成代理,那么您需要在本地下载此文件作为Service.wsdl并从那里生成代理。

<s:element minOccurs="1" maxOccurs="1" name="billTo" type="tns:CustomerAddressType"/> 
    <s:element minOccurs="1" maxOccurs="1" name="customerProfileId" type="s:long" /> 

<s:complexType name="CustomerPaymentProfileMaskedType"> 
    <s:complexContent mixed="false"> 
     <s:extension base="tns:CustomerPaymentProfileBaseType"> 
     <s:sequence> 
      <s:element minOccurs="1" maxOccurs="1" name="billTo" type="tns:CustomerAddressType"/> 
      <s:element minOccurs="1" maxOccurs="1" name="customerProfileId" type="s:long" /> 
      <s:element minOccurs="1" maxOccurs="1" name="customerPaymentProfileId" type="s:long" /> 
      <s:element minOccurs="0" maxOccurs="1" name="payment" type="tns:PaymentMaskedType" /> 
      <s:element minOccurs="0" maxOccurs="1" name="driversLicense" type="tns:DriversLicenseMaskedType" /> 
      <s:element minOccurs="0" maxOccurs="1" name="taxId" type="s:string" /> 
     </s:sequence> 
     </s:extension> 
    </s:complexContent> 
    </s:complexType> 

在检测到之前,我损失了12个小时的付款。幸运的是我有客户的电子邮件,但这非常糟糕。您不能只将字段添加到订单重要的响应中。甚至更糟糕的是,你不能忘记将它们添加到WSDL中。

这对我来说是速战速决。我可能会转而在某个时候使用适当的API--我已经向Authorize.net报告了这一点,希望他们也能做出回应。

这是References.cs后,我做了我的变化的差异。正如你所看到的Order财产已经增加:

enter image description here

3

我不得不对CreateCustomerPaymentProfile SOAP调用一个类似的问题(通过.NET自动生成的代理)刚刚起步昨天,2015年11月3日,尽管我们已经成功连接了SOAP CIM多年。

我能够通过在Visual Studio中执行“更新服务参考”来“修复”问题,以基于其最新的WSDL重新生成代理类。 WSDL发生了一些变化。

具体来说,在我的结尾,看起来好像响应没有在customerPaymentProfileId成功创建后包含它们的值。事实上,他们实际上仍然在发送这个值,但是在XML响应中有一个新的字段,customerProfileId。正如Simon_Weaver在他的回答中所提到的那样,由Visual Studio生成的代理类具有正确反序列化所需的字段的明确排序。在已知字段上方添加以前的“未知”字段会导致它破坏我的代码。

幸运的是,这个新的customerProfileId包含在他们最新的WSDL中,因此“更新服务参考”并重新编译解决了我的问题。

我非常详细地通知了我的问题的Authorize.net支持,并告诉他们他们需要在WSDL文档的“序列”末尾包含任何新字段,以便不中断客户端并使用旧版本的WSDL。到目前为止,我还没有收到他们的回复,但我会鼓励任何遇到此问题的人,即使您已经制定了解决方案,也可以通过[email protected]向他们报告,以免意外再做一次。

+1

我确实听到了授权。网络支持今天,他们指出我这个论坛:https://community.developer.authorize.net/t5/Integration-and-Testing/CIM-WSDL-Breaking-Change-on-11-3/td-p/ 52828其他人在11/3报告完全相同的问题。现在我们中的许多人已经解决了这个问题,如果他们决定回滚更改,他们将再次破坏我们的界面! –

+0

绝对应该可以使用Update引用来修复它,但问题是他们的WSDL甚至不包含'CustomerPaymentProfileBaseType'下的字段'billTo',我甚至不知道这是可能的。所以我也必须添加它。 –

+0

他们回信给我说,'我们很抱歉给您造成的任何不便,尽管我可以建议这些更改将保持最新。“很明显,它并没有让开发者接受 - 但他们必须有很多人解决这个问题 –