【问题标题】:eBay API convert Shipping Address to International Address formatseBay API 将送货地址转换为国际地址格式
【发布时间】:2014-11-11 07:57:23
【问题描述】:

我正在构建获取买家送货地址的 eBay 应用程序

我打电话给GetOrdershttp://developer.ebay.com/devzone/xml/docs/reference/ebay/getorders.html

并收到此 xml 作为回报:

<AddressAttribute type="AddressAttributeCodeType"> AddressAttributeType (string) </AddressAttribute>
    <AddressID> string </AddressID>
    <AddressOwner> AddressOwnerCodeType </AddressOwner>
    <CityName> string </CityName>
    <Country> CountryCodeType </Country>
    <CountryName> string </CountryName>
    <ExternalAddressID> string </ExternalAddressID>
    <Name> string </Name>
    <Phone> string </Phone>
    <PostalCode> string </PostalCode>
    <ReferenceID> string </ReferenceID>
    <StateOrProvince> string </StateOrProvince>
    <Street1> string </Street1>
    <Street2> string </Street2>
</AddressAttribute >

我正在尝试了解如何将送货地址转换为国际送货格式 http://en.wikipedia.org/wiki/Address_(geography)

这意味着: 如果国家/地区是Finland,则结果应为以下字符串:

Company
Name or Department
Street name + number + *apartment number (optional)
Postal code + Town
Country

如果国家/地区是Iceland,则结果应为以下字符串:

Name
Streetname + Number
Complements
Postal code + Place

如果国家是USA,那么结果应该是:

Name of addressee
House number and street name
Name of town, State abbreviation + ZIP code
(typical handwritten format)

等等

我怎样才能自动做到这一点?

【问题讨论】:

  • 您可以在 C# 代码中读取 XML 文件并根据需要设置格式吗?

标签: c# paypal ebay-api


【解决方案1】:

我正在一个小页面上使用 PHP 获取我的 eBay 列表详细信息。我还没到那里,但是一旦我进入地址打印,我也计划解决这个问题。

我正在使用 GetItemTransactions 来获取地址详细信息。那个电话有:

<Name>John Doe</Name>
<Street>Nowhere St. 11</Street>
<Street1>Nowhere St. 11</Street1>
<CityName>Berlin</CityName>
<StateOrProvince>
<Country>DE</Country>
<CountryName>Germany</CountryName>
<Phone>Invalid Request</Phone>
<PostalCode>11508</PostalCode>

我打算使用这种默认格式:

<Name>
<Street>
<Street1>  // if not the same
<PostalCode><CityName>
<CountryName>

对于英国、美国等,我做了一个简单的操作:

if($Country == 'UK|UK|CA|AU') 
{
echo $CityName." ".$StateOrProvince." ".$PostalCode;
}

我认为在开始时进行一些微调和监控非常容易。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-06
    • 1970-01-01
    • 1970-01-01
    • 2012-08-15
    • 2014-02-11
    • 1970-01-01
    • 2023-03-31
    相关资源
    最近更新 更多