Aramex汇率计算器API返回ERR52-邮政编码不提供服务

时间:2018-09-18 09:18:09

标签: php api aramex

我正在尝试为我的电子商务系统集成Aramex费率计算器API,以实现本地送货服务,但出现此错误。

 [Code] => ERR52
 [Message] => OriginAddress - Service Offering Unavailable for zip code (01300)

[Code] => ERR52
[Message] => DestinationAddress - Service Offering Unavailable for zip code (80000)

我的代码:

$params = array(
    'ClientInfo'            => array(
                                'AccountCountryCode' => 'LK',
                                    'AccountEntity' => 'CMB',
                                    'AccountNumber' => 'xxxxxxxxx',
                                    'AccountPin' => 'xxxxxx',
                                    'UserName' => 'xxxxx@xxxx.xxx',
                                    'Password' => 'xxxxxxx',
                                    'Version' => 'v1.0'
                            ),

    'Transaction'           => array(
                                'Reference1'            => '001' 
                            ),

    'OriginAddress'         => array(
                                'Line1'                 => 'Arimac Digital',
                                'Line2'                 => '6th Lane',
                                'Line3'                 => 'Kollupitiya',
                                'City'                  => 'Colombo',
                                'PostCode'              => '01300',
                                'CountryCode'               => 'LK'
                            ),

    'DestinationAddress'    => array(
                                'Line1'                 => 'Mr. Lakshitha',
                                'Line2'                 => '6th Lane',
                                'Line3'                 => 'Karapitiya',
                                'City'                  => 'Galle',
                                'PostCode'              => '80000',
                                'CountryCode'           => 'LK'
                            ),
    'ShipmentDetails'       => array(
                                'PaymentType'            => 'C',
                                'ProductGroup'           => 'DOM',
                                'ProductType'            => 'PPX',
                                'ActualWeight'           => array('Value' => 0.2, 'Unit' => 'KG'),
                                'ChargeableWeight'       => array('Value' => 0.2, 'Unit' => 'KG'),
                                'NumberOfPieces'         => 1
                            )
);

$soapClient = new SoapClient('aramex-rates-calculator-wsdl.wsdl', array('trace' => 1));
$results = $soapClient->CalculateRate($params); 

首先我想,这是因为aramex在我的国家(斯里兰卡)不支持本地交货。但是,从他们的网站上,我可以毫无错误地计算出我所在国家/地区之间的房价。

有人可以告诉我,我是否正确添加了所有参数?是否需要其他参数?

3 个答案:

答案 0 :(得分:0)

在计算价格时尽量不要使用邮政编码

   'DestinationAddress' => array(
                        'Line1' => 'Mr. Lakshitha',
                        'Line2' => '6th Lane',
                        'Line3' => 'Karapitiya',
                        'City' => 'Galle',
                        //      'PostCode'              => '80000',
                        'CountryCode' => 'LK'
                    ),

答案 1 :(得分:0)

使用的产品类型错误,您需要使用ONP,因为PPX是优先包裹快递。

答案 2 :(得分:0)

{
"OriginAddress": {
    "Line1": null,
    "Line2": null,
    "Line3": null,
    "City": "Colombo",
    "StateOrProvinceCode": "",
    "PostCode": "01300",
    "CountryCode": "LK",
    "Longitude": 0.0,
    "Latitude": 0.0,
    "BuildingNumber": null,
    "BuildingName": null,
    "Floor": null,
    "Apartment": null,
    "POBox": null,
    "Description": null
},
"DestinationAddress": {
    "Line1": null,
    "Line2": null,
    "Line3": null,
    "City": "Galle",
    "StateOrProvinceCode": "",
    "PostCode": "80000",
    "CountryCode": "LK",
    "Longitude": 0.0,
    "Latitude": 0.0,
    "BuildingNumber": null,
    "BuildingName": null,
    "Floor": null,
    "Apartment": null,
    "POBox": null,
    "Description": null
},
"ShipmentDetails": {
    "Dimensions": null,
    "ActualWeight": {
        "Unit": "kg",
        "Value": 5.0
    },
    "ChargeableWeight": {
        "Unit": "kg",
        "Value": 5.0
    },
    "DescriptionOfGoods": null,
    "GoodsOriginCountry": null,
    "NumberOfPieces": 1,
    "ProductGroup": "DOM",
    "ProductType": "ONP",
    "PaymentType": "P",
    "PaymentOptions": null,
    "CustomsValueAmount": null,
    "CashOnDeliveryAmount": null,
    "InsuranceAmount": null,
    "CashAdditionalAmount": null,
    "CashAdditionalAmountDescription": null,
    "CollectAmount": null,
    "Services": "",
    "Items": null,
    "DeliveryInstructions": null,
    "AdditionalProperties": null,
    "ContainsDangerousGoods": false
},
"PreferredCurrencyCode": "LKR",
"Transaction": null

}

我已经添加了示例代码,这应该可以正常工作。如果未定义费率,则会显示“获取费率失败”。