我试图实施fedex api来计算一个国家邮政编码的运费.这对美国来说很好.它也在美国工作到其他国家(为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.
Run Code Online (Sandbox Code Playgroud)
不知道是什么问题.我检查了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>
Run Code Online (Sandbox Code Playgroud)
不明白应该是什么价值.下面是我发送到$ 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
)
)
)
)
Run Code Online (Sandbox Code Playgroud)
)
为了使印度到印度国内运输工作,您需要添加一个PurposeOfShipment
类型的请求.此行不是Magento的Fedex运输代码的标准.该行将CustomsClearanceDetail
作为子项添加到标题下,CommercialInvoice
然后在该行下Purpose
可以具有任何值PurposeOfShipment
.
以下是我使用的请求的示例,该请求返回了印度到印度航运的正确运费估算值.
'CustomsClearanceDetail' => array(
'CommercialInvoice' => array(
'Purpose' => "SOLD"
)
),
Run Code Online (Sandbox Code Playgroud)