我正在定制UPS和Odoo之间的集成。我需要能够运行费率请求和运输请求从UPS使用他们的API,并已协商的费率返回。我确认我的UPS账户已启用议价。
我能够得到航运请求返回的协商率。然而,Rate Request返回公布的价格。有人能帮我弄清楚是怎么回事吗?
率要求:
End URL
https://onlinetools.ups.com/webservices/
Request Option
{ 'RequestOption': 'Shop', 'SubVersion': None, 'TransactionReference': None }
Request
{ 'OriginRecordTransactionTimestamp': None, 'Shipper':
{ 'Name': 'SELLER', 'ShipperNumber': 'XXXXXX', 'Address':
{ 'AddressLine': [ 'STREET' ],
'City': 'u200bMataró',
'StateProvinceCode': None,
'PostalCode': '08302',
'CountryCode': 'ES',
'TaxIdentificationNumber':
'ESB67488221',
'EMailAddress': 'info@seller.com'
}
},
'ShipTo':
{ 'Name': 'CUSTOMER',
'Address':
{ 'AddressLine': [],
'City': 'Lousada',
'StateProvinceCode': None,
'PostalCode': '4620-101',
'CountryCode': 'PT',
'AddressLine1': 'Street',
'AddressLine2': '',
'AddressLine3': ''
}
},
'ShipFrom':
{ 'Name': 'SELLER',
'Address':
{ 'AddressLine': [ 'STREET,' ],
'City': 'u200bMataró',
'StateProvinceCode': None,
'PostalCode': '08302',
'CountryCode': 'ES' }
},
'AlternateDeliveryAddress': None,
'ShipmentIndicationType': [],
'PaymentDetails': None,
'FRSPaymentInformation': None,
'FreightShipmentInformation': None,
'GoodsNotInFreeCirculationIndicator': None,
'Service': None,
'NumOfPieces': 1,
'ShipmentTotalWeight': None,
'DocumentsOnlyIndicator': None,
'Package':
[{ 'PackagingType':
{ 'Code': '02',
'Description': None
},
'Dimensions':
{ 'UnitOfMeasurement':
{ 'Code': 'CM',
'Description': None
},
'Length': 175.0,
'Width': 14.0,
'Height': 14.0
},
'DimWeight': None,
'PackageWeight':
{ 'UnitOfMeasurement':
{ 'Code': 'KGS',
'Description': None
},
'Weight': 7.05
},
'Commodity': None,
'LargePackageIndicator': None,
'PackageServiceOptions':
{ 'DeliveryConfirmation': None,
'AccessPointCOD': None,
'COD': None,
'DeclaredValue':
{ 'CurrencyCode': 'EUR',
'MonetaryValue': 555.0
},
'ShipperDeclaredValue':
{ 'CurrencyCode':
'EUR',
'MonetaryValue': 555.0
},
'ProactiveIndicator': None,
'Insurance': None,
'VerbalConfirmationIndicator': None,
'UPSPremiumCareIndicator': None,
'HazMat': None,
'DryIce': None },
'AdditionalHandlingIndicator': None,
'Description': ''
}],
'ShipmentServiceOptions':
{ 'SaturdayPickupIndicator': None,
'SaturdayDeliveryIndicator': None,
'AccessPointCOD': None,
'DeliverToAddresseeOnlyIndicator': None,
'DirectDeliveryOnlyIndicator': None,
'COD': None,
'DeliveryConfirmation': None,
'ReturnOfDocumentIndicator': None,
'UPScarbonneutralIndicator': True,
'CertificateOfOriginIndicator': None,
'PickupOptions': None,
'DeliveryOptions': None,
'RestrictedArticles': None,
'ShipperExportDeclarationIndicator': None,
'CommercialInvoiceRemovalIndicator': None,
'ImportControl': None,
'ReturnService': None,
'SDLShipmentIndicator': None,
'EPRAIndicator': None
},
'ShipmentRatingOptions':
{ 'NegotiatedRatesIndicator': 1,
'FRSShipmentIndicator': None,
'RateChartIndicator': None,
'UserLevelDiscountIndicator': 1
},
'InvoiceLineTotal': None,
'RatingMethodRequestedIndicator': None,
'TaxInformationIndicator': None,
'PromotionalDiscountInformation': None,
'DeliveryTimeInformation': None
}
运输要求:
End URL
https://onlinetools.ups.com/webservices/
Request Option
{ 'RequestOption': 'nonvalidate', 'SubVersion': None, 'TransactionReference': None }
Request
{ 'Description': 'S02806',
'ReturnService': None,
'DocumentsOnlyIndicator': None,
'Shipper':
{ 'Name': 'Company',
'AttentionName': 'Company',
'CompanyDisplayableName': None,
'TaxIdentificationNumber': 'ESB67488221',
'TaxIDType': None,
'Phone':
{ 'Number': '34922808092',
'Extension': None
},
'ShipperNumber': 'XXXXXX',
'FaxNumber': None,
'EMailAddress': 'info@seller.com',
'Address':
{ 'AddressLine': [ 'STREET' ],
'City': 'u200bMataró',
'StateProvinceCode': None,
'PostalCode': '08302',
'CountryCode': 'ES'
}
},
'ShipTo':
{ 'Name': 'CUSTOMER',
'AttentionName': 'CUSTOMER',
'CompanyDisplayableName': None,
'TaxIdentificationNumber': 'PTTAXNUMBER',
'TaxIDType': None,
'Phone':
{ 'Number': '12345678',
'Extension': None
},
'FaxNumber': None,
'EMailAddress': 'customer@email.com',
'Address':
{ 'AddressLine': 'Street',
'City': 'Lousada',
'StateProvinceCode': None,
'PostalCode': '4620-101',
'CountryCode': 'PT',
'ResidentialAddressIndicator': None,
'AddressLine2': '',
'AddressLine3': ''
},
'LocationID': None
},
'AlternateDeliveryAddress': None,
'ShipFrom':
{ 'Name': 'SELLER',
'AttentionName': 'SELLER',
'CompanyDisplayableName': None,
'TaxIdentificationNumber': 'ESTAXNUMBER',
'TaxIDType': None,
'Phone':
{ 'Number': '123456789',
'Extension': None
},
'FaxNumber': None,
'Address':
{ 'AddressLine': [ 'STREET' ],
'City': 'u200bMataró',
'StateProvinceCode': None,
'PostalCode': '08302',
'CountryCode': 'ES'
},
'EMailAddress': None
},
'PaymentInformation':
{ 'ShipmentCharge':
[{ 'Type': '01',
'BillShipper':
{ 'AccountNumber': '7W865X',
'CreditCard': None,
'AlternatePaymentMethod': None
},
'BillReceiver': None,
'BillThirdParty': None,
'ConsigneeBilledIndicator': None
}],
'SplitDutyVATIndicator': None
},
'FRSPaymentInformation': None,
'FreightShipmentInformation': None,
'GoodsNotInFreeCirculationIndicator': None,
'ShipmentRatingOptions':
{ 'NegotiatedRatesIndicator': 1,
'FRSShipmentIndicator': None,
'RateChartIndicator': None,
'TPFCNegotiatedRatesIndicator': None,
'UserLevelDiscountIndicator': None
},
'MovementReferenceNumber': None,
'ReferenceNumber': [],
'Service':
{ 'Code': '11',
'Description': 'Service Code'
},
'InvoiceLineTotal': None,
'NumOfPiecesInShipment': None,
'USPSEndorsement': None,
'MILabelCN22Indicator': None,
'SubClassification': None,
'CostCenter': None,
'PackageID': None,
'IrregularIndicator': None,
'ShipmentIndicationType': [],
'MIDualReturnShipmentKey': None,
'MIDualReturnShipmentIndicator': None,
'RatingMethodRequestedIndicator': None,
'TaxInformationIndicator': None,
'PromotionalDiscountInformation': None,
'ShipmentServiceOptions':
{ 'SaturdayDeliveryIndicator': None,
'SaturdayPickupIndicator': None,
'COD': None,
'AccessPointCOD': None,
'DeliverToAddresseeOnlyIndicator': None,
'DirectDeliveryOnlyIndicator': None,
'Notification': [],
'LabelDelivery': None,
'InternationalForms':
{ 'FormType': '01',
'UserCreatedForm': None,
'CN22Form': None,
'UPSPremiumCareForm': None,
'AdditionalDocumentIndicator': None,
'FormGroupIdName': None,
'SEDFilingOption': None,
'EEIFilingOption': None,
'Contacts':
{ 'ForwardAgent': None,
'UltimateConsignee': None,
'IntermediateConsignee': None,
'Producer': None,
'SoldTo':
{ 'Name': 'Trofeuveloz Fabrica de Calcado',
'AttentionName': 'Trofeuveloz Fabrica de Calcado',
'TaxIdentificationNumber': 'PT513066004',
'Phone':
{ 'Number': '351255829143',
'Extension': None
},
'Option': None,
'Address':
{ 'AddressLine': 'Street',
'City': 'Lousada',
'StateProvinceCode': None,
'Town': None, 'PostalCode': '4620-101',
'CountryCode': 'PT',
'AddressLine2': '',
'AddressLine3': ''
},
'EMailAddress': None
}
},
'Product':
{ 'Description': 'Textile',
'Unit':
{ 'Number': 10,
'UnitOfMeasurement':
{ 'Code': 'M',
'Description': None
},
'Value': 50.0
},
'CommodityCode': '5602109000',
'PartNumber': None,
'OriginCountryCode': 'PH',
'JointProductionIndicator': None,
'NetCostCode': None,
'NetCostDateRange': None,
'PreferenceCriteria': None,
'ProducerInfo': None,
'MarksAndNumbers': None,
'NumberOfPackagesPerCommodity': None,
'ProductWeight': None,
'VehicleID': None,
'ScheduleB': None,
'ExportType': None,
'SEDTotalValue': None,
'ExcludeFromForm': None,
'ProductCurrencyCode': None,
'PackingListInfo': None,
'EEIInformation': None
},
'InvoiceNumber': 'S0280000',
'InvoiceDate': '20201210',
'PurchaseOrderNumber': 'S0280000',
'TermsOfShipment': None,
'ReasonForExport': 'SALE',
'Comments': None,
'DeclarationStatement': None,
'Discount': None,
'FreightCharges': None,
'InsuranceCharges': None,
'OtherCharges': None,
'CurrencyCode': 'EUR',
'BlanketPeriod': None,
'ExportDate': None,
'ExportingCarrier': None,
'CarrierID': None,
'InBondCode': None,
'EntryNumber': None,
'PointOfOrigin': None,
'PointOfOriginType': None,
'ModeOfTransport': None,
'PortOfExport': None,
'PortOfUnloading': None,
'LoadingPier': None,
'PartiesToTransaction': None,
'RoutedExportTransactionIndicator': None,
'ContainerizedIndicator': None,
'License': None,
'ECCNNumber': None,
'OverridePaperlessIndicator': 1,
'ShipperMemo': None,
'MultiCurrencyInvoiceLineTotal': None,
'HazardousMaterialsIndicator': None
},
'DeliveryConfirmation': None,
'ReturnOfDocumentIndicator': None,
'ImportControlIndicator': None,
'LabelMethod': None,
'CommercialInvoiceRemovalIndicator': None,
'UPScarbonneutralIndicator': True,
'PreAlertNotification': [],
'ExchangeForwardIndicator': None,
'HoldForPickupIndicator': None,
'DropoffAtUPSFacilityIndicator': None,
'LiftGateForPickUpIndicator': None,
'LiftGateForDeliveryIndicator': None,
'SDLShipmentIndicator': None,
'EPRAReleaseCode': None, 'RestrictedArticles': None },
'Package':
[{ 'Description': 'TEXTILE',
'Packaging':
{ 'Code': '02',
'Description': None
},
'Dimensions':
{ 'UnitOfMeasurement':
{ 'Code': 'CM',
'Description': 'TEXTILE' },
'Length': 175.0,
'Width': 14.0,
'Height': 14.0
},
'DimWeight': None,
'PackageWeight':
{ 'UnitOfMeasurement':
{ 'Code': 'KGS',
'Description': None
},
'Weight': 7.05
},
'LargePackageIndicator': None,
'ReferenceNumber': [],
'AdditionalHandlingIndicator': None,
'PackageServiceOptions':
{ 'DeliveryConfirmation': None,
'DeclaredValue':
{ 'Type':
{ 'Code': '01',
'Description': 'TEXTILE'
},
'CurrencyCode': 'EUR',
'MonetaryValue': 552.38
},
'COD': None,
'AccessPointCOD': None,
'VerbalConfirmation': None,
'ShipperReleaseIndicator': None,
'Notification': None,
'HazMat': [],
'DryIce': None,
'UPSPremiumCareIndicator': None,
'ProactiveIndicator': None,
'PackageIdentifier': None,
'ClinicalTrialsID': None
},
'Commodity': None,
'HazMatPackageInformation': None
}]
}
响应速度
{ 'Response': { 'ResponseStatus': { 'Code': '1', 'Description': 'Success' }, 'Alert': [ { 'Code': '119001', 'Description': 'Additional Handling has automatically been set on Package 1.' }, { 'Code': '110971', 'Description': 'Your invoice may vary from the displayed reference rates' } ], 'AlertDetail': [], 'TransactionReference': None }, 'RatedShipment': [ { 'Disclaimer': [], 'Service': { 'Code': '11', 'Description': None }, 'RateChart': None, 'RatedShipmentAlert': [ { 'Code': '119001', 'Description': 'Additional Handling has automatically been set on Package 1.' }, { 'Code': '110971', 'Description': 'Your invoice may vary from the displayed reference rates' } ], 'BillableWeightCalculationMethod': None, 'RatingMethod': None, 'BillingWeight': { 'UnitOfMeasurement': { 'Code': 'KGS', 'Description': 'Kilograms' }, 'Weight': '7.5' }, 'TransportationCharges': { 'Code': None, 'Description': None, 'CurrencyCode': 'EUR', 'MonetaryValue': '52.91', 'SubType': None }, 'BaseServiceCharge': None, 'ItemizedCharges': [], 'FRSShipmentData': None, 'ServiceOptionsCharges': { 'Code': None, 'Description': None, 'CurrencyCode': 'EUR', 'MonetaryValue': '24.30', 'SubType': None }, 'TaxCharges': [], 'TotalCharges': { 'Code': None, 'Description': None, 'CurrencyCode': 'EUR', 'MonetaryValue': '77.21', 'SubType': None }, 'TotalChargesWithTaxes': None, 'NegotiatedRateCharges': { 'ItemizedCharges': [], 'TaxCharges': [], 'TotalCharge': { 'Code': None, 'Description': None, 'CurrencyCode': 'EUR', 'MonetaryValue': '52.38', 'SubType': None }, 'TotalChargesWithTaxes': None }, 'GuaranteedDelivery': None, 'RatedPackage': [ { 'TransportationCharges': None, 'BaseServiceCharge': None, 'ServiceOptionsCharges': None, 'TotalCharges': None, 'Weight': '7.1', 'BillingWeight': None, 'Accessorial': [], 'ItemizedCharges': [], 'NegotiatedCharges': None } ], 'TimeInTransit': None }, { 'Disclaimer': [], 'Service': { 'Code': '65', 'Description': None }, 'RateChart': None, 'RatedShipmentAlert': [ { 'Code': '119001', 'Description': 'Additional Handling has automatically been set on Package 1.' }, { 'Code': '110971', 'Description': 'Your invoice may vary from the displayed reference rates' } ], 'BillableWeightCalculationMethod': None, 'RatingMethod': None, 'BillingWeight': { 'UnitOfMeasurement': { 'Code': 'KGS', 'Description': 'Kilograms' }, 'Weight': '7.5' }, 'TransportationCharges': { 'Code': None, 'Description': None, 'CurrencyCode': 'EUR', 'MonetaryValue': '295.78', 'SubType': None }, 'BaseServiceCharge': None, 'ItemizedCharges': [], 'FRSShipmentData': None, 'ServiceOptionsCharges': { 'Code': None, 'Description': None, 'CurrencyCode': 'EUR', 'MonetaryValue': '24.30', 'SubType': None }, 'TaxCharges': [], 'TotalCharges': { 'Code': None, 'Description': None, 'CurrencyCode': 'EUR', 'MonetaryValue': '320.08', 'SubType': None }, 'TotalChargesWithTaxes': None, 'NegotiatedRateCharges': { 'ItemizedCharges': [], 'TaxCharges': [], 'TotalCharge': { 'Code': None, 'Description': None, 'CurrencyCode': 'EUR', 'MonetaryValue': '292.82', 'SubType': None }, 'TotalChargesWithTaxes': None }, 'GuaranteedDelivery': None, 'RatedPackage': [ { 'TransportationCharges': None, 'BaseServiceCharge': None, 'ServiceOptionsCharges': None, 'TotalCharges': None, 'Weight': '7.1', 'BillingWeight': None, 'Accessorial': [], 'ItemizedCharges': [], 'NegotiatedCharges': None } ], 'TimeInTransit': None } ] }
从我运行的测试中,当' negotiatedratesindicator ';: 1或0,但当设置为"true"时,我确实得到了一个比率。奇怪的是"False"还返回协商后的价格或仅返回"没有任何文本。似乎任何文本都会导致协商率返回,但1或0不会。
"NegotiatedRatesIndicator" : "True"
NegotiatedRatesIndicator期望一个任意长度的字符串,包括0。将其更改为"true";正如上面评论者建议的那样,应该可以工作。将1改为">
面临同样的问题。尝试使用有效的ShipperNumber并验证它是否也激活了ABR。在更新版本中,如果您使用NegotiatedRatesIndicator,也需要ShipFrom StateProvinceCode。