我是 UPS api 的新手,我正在尝试向 UPS 调用 ShipmentConfirmRequest,这是我使用 python 发送到 wwwcie.ups.com/ups.app/xml/ShipConfirm 的 xml 格式。
<?xml version="1.0"?>
<AccessRequest xml:lang='en-US'>
<AccessLicenseNumber>NUMBER</AccessLicenseNumber>
<UserId>UUUUU</UserId>
<Password>PASSWORD</Password>
</AccessRequest>
<?xml version="1.0"?>
<ShipmentConfirmRequest>
<Request>
<TransactionReference>
<CustomerContext>00001</CustomerContext>
<XpciVersion>1.0001</XpciVersion>
</TransactionReference>
<RequestAction>ShipConfirm</RequestAction>
<RequestOption>nonvalidate</RequestOption>
</Request>
<Shipment>
<Description>00001</Description>
<!--InvoiceLineTotal>
<CurrencyCode>EUR</CurrencyCode>
<MonetaryValue>4887</MonetaryValue>
</InvoiceLineTotal-->
<Shipper>
<Name>HELICONIA</Name>
<AttentionName>HELICONIA</AttentionName>
<Address>
<AddressLine1></AddressLine1>
<AddressLine2></AddressLine2>
<AddressLine3></AddressLine3>
<City></City>
<StateProvinceCode></StateProvinceCode>
<CountryCode></CountryCode>
<PostalCode></PostalCode>
</Address>
<PhoneNumber></PhoneNumber>
<ShipperNumber>NUMBER</ShipperNumber>
<TaxIdentificationNumber></TaxIdentificationNumber>
<FaxNumber></FaxNumber>
<EMailAddress></EMailAddress>
</Shipper>
<ShipTo>
<CompanyName>Agriiolait</CompanyName>
<AttentionName></AttentionName>
<Address>
<AddressLine1>Agriiolait</AddressLine1>
<AddressLine2>69 rue de Chimay</AddressLine2>
<AddressLine3></AddressLine3>
<City>Wavre</City>
<StateProvinceCode></StateProvinceCode>
<CountryCode>BE</CountryCode>
<PostalCode></PostalCode>
</Address>
<PhoneNumber>+32 10 588 558</PhoneNumber>
<FaxNumber></FaxNumber>
<EMailAddress>info@agroiilait.com</EMailAddress>
<TaxIdentificationNumber></TaxIdentificationNumber>
<LocationID></LocationID>
</ShipTo>
<Service>
<Code>14</Code>
<Description>Next Day Air</Description>
</Service>
</Shipment>
<PaymentInformation>
<Prepaid>
<BillShipper>
<AccountNumber>25AC57</AccountNumber>
</BillShipper>
</Prepaid>
</PaymentInformation>
<Package>
<Description></Description>
<PackagingType>
<Code>01</Code>
<Description>UPS Letter</Description>
</PackagingType>
<Dimensions>
<UnitOfMeasurement>
<Code>IN</Code>
<Description>Inches</Description>
</UnitOfMeasurement>
<Length>11.0</Length>
<Width>110.0</Width>
<Height>11.0</Height>
</Dimensions>
<PackageWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
<Description>Pounds</Description>
</UnitOfMeasurement>
<Weight>11.0</Weight>
</PackageWeight>
<ReferenceNumber>
<Code>01</Code>
<Value></Value>
</ReferenceNumber>
<ReferenceNumber>
<Code>02</Code>
<Value></Value>
</ReferenceNumber>
<PackageServiceOptions>
<InsuredValue>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>975.0</MonetaryValue>
</InsuredValue>
</PackageServiceOptions>
</Package>
<LabelSpecification>
<LabelPrintMethod>
<Code>GIF</Code>
<Description>GIF</Description>
</LabelPrintMethod>
<HTTPUserAgent></HTTPUserAgent>
<LabelImageFormat>
<Code>GIF</Code>
</LabelImageFormat>
<LabelStockSize>
<Height>8</Height>
<Width>8</Width>
</LabelStockSize>
<LabelImageFormat>
<Code>GIF</Code>
<Description>GIF</Description>
</LabelImageFormat>
</LabelSpecification>
</ShipmentConfirmRequest>
但是我得到了不好的回应,比如
<ShipmentConfirmResponse>
<Response>
<TransactionReference>
<CustomerContext>00001</CustomerContext>
<XpciVersion>1.0001</XpciVersion>
</TransactionReference>
<ResponseStatusCode>0</ResponseStatusCode>
<ResponseStatusDescription>Failure</ResponseStatusDescription>
<Error>
<ErrorSeverity>Hard</ErrorSeverity>
<ErrorCode>120416</ErrorCode>
<ErrorDescription>A single billing option is required per shipment.
</ErrorDescription>
</Error>
</Response>
</ShipmentConfirmResponse>
谁能指导我如何摆脱它?
您缺少以下元素 /ShipmentRequest/Shipment/PaymentInformation/ShipmentCharge/Type 在您的发货请求中。此元素的值可以是 01 = Transportation 或 02 = Duties and Taxes。如果您需要有关运费类型的更多信息,请参阅Shipping Package Web Service Developers Guide(2012 年 12 月 31 日) 第 67 页。
请注意,Type 的 ShipmentCharge 元素只能有一个等于 01。
最好!
我是一名优秀的程序员,十分优秀!