当查询涉及SagePay的交易的Shopify交易数据(从python api客户端)时,当客户端试图解析返回的xml时,我们收到一个错误:
Error(Error('Unable to parse xml data: not well-formed (invalid token): line 24, column 7',),)
这似乎是由事务/收据元素内容引起的,该内容包括指示3D-secure状态的无效xml标记名称。
例如:
<?xml version="1.0" encoding="UTF-8"?>
<transactions type="array">
<transaction>
<order-id type="integer">123456789</order-id>
<amount type="decimal">123.45</amount>
<status>success</status>
<kind>sale</kind>
<authorization>{-REDACTED-}</authorization>
<created-at type="datetime">2012-01-01T01:01:01+00:00</created-at>
<gateway>sage_pay_form</gateway>
<id type="integer">123456789</id>
<test type="boolean">false</test>
<receipt>
<VendorTxCode>123456789</VendorTxCode>
<VPSTxId>{-REDACTED-}</VPSTxId>
<Status>OK</Status>
<StatusDetail>0000 : The Authorisation was Successful.</StatusDetail>
<TxAuthNo>123456789</TxAuthNo>
<AVSCV2>SECURITY CODE MATCH ONLY</AVSCV2>
<AddressResult>NOTMATCHED</AddressResult>
<PostCodeResult>NOTMATCHED</PostCodeResult>
<CV2Result>MATCHED</CV2Result>
<GiftAid>0</GiftAid>
<3DSecureStatus>OK</3DSecureStatus>
<CAVV>-REDACTED-</CAVV>
<CardType>MC</CardType>
<Last4Digits>1234</Last4Digits>
<Amount>123.45</Amount>
</receipt>
</transaction>
</transactions>As '3DSecureStatus' is not a valid xml element name, xml parsing fails.
我们目前不能使用json api,因为python api客户端不支持它。
发布于 2012-11-16 00:22:13
Shopify将需要修复,以不发送无效的XML元素名称。例如,元素名称可以加一个下划线作为前缀。完成后,我会在这里更新。
shopify python API中缺乏对JSON的支持实际上是由于缺乏对pyactiveresource的支持。我已经将JSON support patches发送到activeresource,你可以使用它。由于缺乏上游活动,它们似乎被忽视了。
更新: Shopify已修复为不返回具有无效元素名称的XML。相反,它将在元素名称中为无效的开始字符加上下划线。
https://stackoverflow.com/questions/13396578
复制相似问题