2012-11-15 75 views
3

當查詢涉及SagePay交易Shopify交易數據(從Python API客戶端),我們收到的當客戶端嘗試解析返回的XML錯誤:Shopify XML API響應 - 無效的元素名稱:3DSecureStatus

Error(Error('Unable to parse xml data: not well-formed (invalid token): line 24, column 7',),)

這似乎是由交易/收據元素內容引起的,包括無效的xml標籤名稱以指示3D安全狀態。

例如:

<?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中的客戶端不支持它的位置。

回答

0

Shopify將需要修復,以不發送無效的XML元素名稱。例如。元素名稱可以用下劃線作爲前綴。完成後我會在這裏更新。

shopify python API缺乏JSON支持實際上是由於pyactive資源缺乏支持。我已將JSON support patches向上遊發送給您可以使用的主動資源。由於缺乏上游活動,他們似乎被忽略了。

更新:Shopify已修復爲不返回具有無效元素名稱的XML。相反,它會在元素名稱前加一個帶下劃線的無效起始字符。