3

When querying Shopify transaction data (from the python api client) for transactions involving SagePay, we're receiving an error when the client attempts to parse the returned xml:

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

This appears to be being caused by the transaction/receipt element contents including an invalid xml tag name to indicate the 3D-secure status.

For instance:

<?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.

We're currently not in a position to use the json api as the python api client doesn't support it.

4

1 回答 1

0

Shopify 将需要修复以不发送无效的 XML 元素名称。例如,元素名称可以带有下划线前缀。完成后我会在这里更新。

shopify python API 中缺少 JSON 支持,其实是由于 pyactiveresource 中缺少支持造成的。我已将JSON 支持补丁上游发送到您可以使用的 activeresource。由于缺乏上游活动,它们似乎被忽略了。

更新: Shopify 已修复为不返回带有无效元素名称的 XML。相反,它将在元素名称中使用下划线作为无效起始字符的前缀。

于 2012-11-15T16:22:13.087 回答