php - FedEx shipping api 在印度国内有效吗

标签 php fedex

我尝试实现 fedex api 来计算从 wnn 到一个国家/地区的邮政编码的运输成本。它在美国工作得很好。它还可以从美国到其他国家/地区工作(已尝试在 IN 和 AU)。但是当我尝试使用来自印度或澳大利亚的两个邮政编码作为发货人和收件人地址时。它给出以下错误:-

The transaction returned an Error.
Severity: ERROR
Source: crs
Code: 691
Message: The PurposeOfShipmentType is null, empty or invalid.
LocalizedMessage: The PurposeOfShipmentType is null, empty or invalid.

不知道是什么问题。我检查了 wsdl 文件中 PurposeOfShipmentType 的值,它显示在 xml 代码下方:-

First occurrence
<xs:element name="Purpose" type="ns:PurposeOfShipmentType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>The reason for the shipment. Note: SOLD is not a valid purpose for a Proforma Invoice.</xs:documentation>
        </xs:annotation>
      </xs:element>

second occurrence
<xs:simpleType name="PurposeOfShipmentType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="GIFT"/>
      <xs:enumeration value="NOT_SOLD"/>
      <xs:enumeration value="PERSONAL_EFFECTS"/>
      <xs:enumeration value="REPAIR_AND_RETURN"/>
      <xs:enumeration value="SAMPLE"/>
      <xs:enumeration value="SOLD"/>
    </xs:restriction>
  </xs:simpleType>

不理解应该是什么值。下面是我发送到 $client ->getRates($request) 函数的数组

$request = Array
(
[WebAuthenticationDetail] => Array
    (
        [UserCredential] => Array
            (
                [Key] => *******
                [Password] => *******
            )

    )

[ClientDetail] => Array
    (
        [AccountNumber] => *****
        [MeterNumber] => *****
    )

[TransactionDetail] => Array
    (
        [CustomerTransactionId] =>  *** Rate Available Services Request using PHP ***
    )

[Version] => Array
    (
        [ServiceId] => crs
        [Major] => 16
        [Intermediate] => 0
        [Minor] => 0
    )

[ReturnTransitAndCommit] => 1
[RequestedShipment] => Array
    (
        [DropoffType] => REGULAR_PICKUP
        [ShipTimestamp] => 2014-10-03T11:37:53+02:00
        [Shipper] => Array
            (
                [Address] => Array
                    (
                        [StreetLines] => Array
                            (
                                [0] => 10 Fed Ex Pkwy
                            )

                        [City] => Memphis
                        [StateOrProvinceCode] => 
                        [PostalCode] => 110016
                        [CountryCode] => IN
                    )

            )

        [Recipient] => Array
            (
                [Address] => Array
                    (
                        [StreetLines] => Array
                            (
                                [0] => 13450 Farmcrest Ct
                            )

                        [City] => Herndon
                        [StateOrProvinceCode] => 
                        [PostalCode] => 302015
                        [CountryCode] => IN
                    )

            )

        [ShippingChargesPayment] => Array
            (
                [PaymentType] => SENDER
                [Payor] => Array
                    (
                        [ResponsibleParty] => Array
                            (
                                [AccountNumber] => 510087500
                                [Contact] => 
                                [Address] => Array
                                    (
                                        [CountryCode] => IN
                                    )

                            )

                    )

            )

        [PackageCount] => 2
        [RequestedPackageLineItems] => Array
            (
                [0] => Array
                    (
                        [SequenceNumber] => 1
                        [GroupPackageCount] => 1
                        [Weight] => Array
                            (
                                [Value] => 2
                                [Units] => LB
                            )

                        [Dimensions] => Array
                            (
                                [Length] => 10
                                [Width] => 10
                                [Height] => 3
                                [Units] => IN
                            )

                    )

                [1] => Array
                    (
                        [SequenceNumber] => 2
                        [GroupPackageCount] => 1
                        [Weight] => Array
                            (
                                [Value] => 5
                                [Units] => LB
                            )

                        [Dimensions] => Array
                            (
                                [Length] => 20
                                [Width] => 20
                                [Height] => 10
                                [Units] => IN
                            )

                    )

            )

    )

)

最佳答案

要使印度到印度的国内运输正常进行,您需要在请求中添加 PurposeOfShipment 类型。此行在 Magento 的 Fedex 运输代码中不是标准的。该行将作为 CommercialInvoice 下的子项添加到 CustomsClearanceDetail header 中,然后其下的一行是 Purpose,它可以具有 的任何值PurposeOfShipment 有。

这是我使用的请求的示例,该请求返回了印度到印度航运的正确航运估算。

'CustomsClearanceDetail' => array(
     'CommercialInvoice' => array(
       'Purpose' => "SOLD"
    )
),

关于php - FedEx shipping api 在印度国内有效吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26176066/

相关文章:

php - 使用安全登录抓取网站内容

php - ImageMagick convert 在命令行中工作,但不能通过 PHP exec()

java - Fedex 使用 Java 将标签打印运送到热敏打印机

web-services - Fedex SmartPost 开发者账户的 HubId 无效

Magento Fedex 货币

php - 如果已经使用了 mysql_select_db,你能对两个数据库进行查询吗?

php - CRON 作业的 MySQL 权限

php - FEDEX 网络服务 wsdl 文件

PHP - 清理垃圾

linux - 将 openssl 0.9.8g 升级到 1.0.1e