Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
fix: parse phone as string
Browse files Browse the repository at this point in the history
Closes #365
  • Loading branch information
moltar committed May 3, 2021
1 parent 3a78306 commit fcc83cd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ export const parseResponse = <T>(
textNodeName: 'text',
parseTrueNumberOnly: true,
tagValueProcessor: (value) => decode(value),
// force to be parsed as string
stopNodes: ['Phone'],
},
true,
)
Expand Down
3 changes: 2 additions & 1 deletion test/unit/__fixtures__/orders_list_orders.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PostalCode>98103</PostalCode>
<CountryCode>US</CountryCode>
<AddressType>Commercial</AddressType>
<Phone>3333333333</Phone>
</ShippingAddress>
<OrderTotal>
<CurrencyCode>USD</CurrencyCode>
Expand Down Expand Up @@ -106,7 +107,7 @@
<AddressLine1>1-2-10 Akasaka</AddressLine1>
<City>Tokyo</City>
<PostalCode>107-0053</PostalCode>
<CountryCode>JP</CountryCode>
<CountryCode>JP</CountryCode>
</ShippingAddress>
<OrderTotal>
<CurrencyCode>JPY</CurrencyCode>
Expand Down
1 change: 1 addition & 0 deletions test/unit/__snapshots__/orders.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ Array [
"City": "Seattle",
"CountryCode": "US",
"Name": "Buyer name",
"Phone": "3333333333",
"PostalCode": "98103",
},
},
Expand Down

0 comments on commit fcc83cd

Please sign in to comment.