cancel
Showing results for 
Search instead for 
Did you mean: 

Pulling Fedex Discounted rate

Pulling Fedex Discounted rate

I have a working FedEx API that successful pulls rate from them.

 

However, my company has a discounted deal with FedEx and the rate it currently pulls is normal rate.

I have spoken to FedEx representative and they told me that "You can pull the list and discounted rates with Web Services. Under RateTypes you would select Account instead if List. "

 

I have also done some search on the internet, the only custom code I found is for magento 1.x

I have looked at the carrier php file in **html/vendor/magento/module-fedex/Model**

but couldn't figure what to do.

 

Any help regarding this is appreciated

2 REPLIES 2

Re: Pulling Fedex Discounted rate

Hi,

 

I have been trying to read the code and I believe that this is controlled by the order of this array:

 

/**
* Types of rates, order is important
*
* @var array
*/

protected $_ratesOrder = [
'RATED_ACCOUNT_PACKAGE',
'PAYOR_ACCOUNT_PACKAGE',
'RATED_ACCOUNT_SHIPMENT',
'PAYOR_ACCOUNT_SHIPMENT',
'RATED_LIST_PACKAGE',
'PAYOR_LIST_PACKAGE',
'RATED_LIST_SHIPMENT',
'PAYOR_LIST_SHIPMENT',
];

 

Their is a loop in the _getRateAmountOriginBased function that finds the first non-null rate type.  The order that it checks is the order of the above _ratesOrder array.

 

foreach ($this->_ratesOrder as $rateType) {
if (!empty($rateTypeAmounts[$rateType])) {
$amount = $rateTypeAmounts[$rateType];
break;
}
}

 

I may be wrong.... I am still trying to figure this out.

 

The standard code returns the "List" prices?  Or the "Account" prices ?

Re: Pulling Fedex Discounted rate

Did you resolve this?  I am trying to do the same thing but the other posts related to this don't seem to work. 


@Shimon2 wrote:

Hi,

 

I have been trying to read the code and I believe that this is controlled by the order of this array:

 

/**
* Types of rates, order is important
*
@* @var array
*/

protected $_ratesOrder = [
'RATED_ACCOUNT_PACKAGE',
'PAYOR_ACCOUNT_PACKAGE',
'RATED_ACCOUNT_SHIPMENT',
'PAYOR_ACCOUNT_SHIPMENT',
'RATED_LIST_PACKAGE',
'PAYOR_LIST_PACKAGE',
'RATED_LIST_SHIPMENT',
'PAYOR_LIST_SHIPMENT',
];

 

Their is a loop in the _getRateAmountOriginBased function that finds the first non-null rate type.  The order that it checks is the order of the above _ratesOrder array.

 

foreach ($this->_ratesOrder as $rateType) {
if (!empty($rateTypeAmounts[$rateType])) {
$amount = $rateTypeAmounts[$rateType];
break;
}
}

 

I may be wrong.... I am still trying to figure this out.

 

The standard code returns the "List" prices?  Or the "Account" prices ?