This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
@@ -0,0 +1,62 @@
<?php
/**
* Copyright 2023 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);
namespace Magento\TestModuleFedex\Model;
/**
* Mock Fedex rest client factory
*/
class MockCurlClient extends \Magento\Framework\HTTP\Client\Curl
{
/**
* @var MockResponseBodyLoader
*/
private $mockResponseBodyLoader;
/**
* Oauth End point to get Access Token
*
* @var string
*/
private const OAUTH_REQUEST_END_POINT = 'oauth/token';
/**
* REST end point for Rate API
*
* @var string
*/
private const RATE_REQUEST_END_POINT = 'rate/v1/rates/quotes';
/**
* @param MockResponseBodyLoader $mockResponseBodyLoader
*/
public function __construct(
MockResponseBodyLoader $mockResponseBodyLoader,
) {
$this->mockResponseBodyLoader = $mockResponseBodyLoader;
}
/**
* Fetch mock Fedex rates
*
* @param string $url
* @param array $request
* @return void
* @throws \Magento\Framework\Exception\NotFoundException
*/
public function post($url, $request): void
{
if (strpos($url, self::OAUTH_REQUEST_END_POINT) !== false) {
$this->_responseBody = $this->mockResponseBodyLoader->loadForAuthRequest();
}
if (strpos($url, self::RATE_REQUEST_END_POINT) !== false) {
$this->_responseBody = $this->mockResponseBodyLoader->loadForRestRequest(json_decode($request, true));
}
}
}
@@ -0,0 +1,33 @@
<?php
/**
* Copyright 2023 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);
namespace Magento\TestModuleFedex\Model;
use Magento\Framework\App\ObjectManager;
/**
* Mock Fedex rest client factory
*/
class MockCurlFactory extends \Magento\Framework\HTTP\Client\CurlFactory
{
/**
* Create instance of the mock curlClient
*
* @param array $data
* @return \Magento\Framework\HTTP\Client\Curl
*/
public function create(array $data = []): \Magento\Framework\HTTP\Client\Curl
{
return ObjectManager::getInstance()->create(
MockCurlClient::class,
[
'data' => $data
]
);
}
}
@@ -0,0 +1,95 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleFedex\Model;
use Magento\Framework\Exception\NotFoundException;
use Magento\Framework\HTTP\AsyncClient\Request;
use Magento\Framework\Module\Dir;
use Magento\Framework\Filesystem\Io\File;
use Magento\Framework\Stdlib\ArrayManager;
/**
* Load mock response body for Fedex rate request
*/
class MockResponseBodyLoader
{
private const REST_RESPONSE_FILE_PATTERN = '%s/_files/mock_rest_response_%s_%s.json';
private const REST_PATH_COUNTRY = 'requestedShipment/recipient/address/countryCode';
private const REST_PATH_SERVICE_TYPE = 'requestedShipment/serviceType';
private const REST_AUTH_RESPONSE_FILE = '%s/_files/mock_rest_response_auth.json';
/**
* @var Dir
*/
private $moduleDirectory;
/**
* @var File
*/
private $fileIo;
/**
* @var ArrayManager
*/
private $arrayManager;
/**
* @param Dir $moduleDirectory
* @param File $fileIo
* @param ArrayManager
*/
public function __construct(
Dir $moduleDirectory,
File $fileIo,
ArrayManager $arrayManager
) {
$this->moduleDirectory = $moduleDirectory;
$this->fileIo = $fileIo;
$this->arrayManager = $arrayManager;
}
/**
* Loads mock json response for a given request
*
* @param array $request
* @return string
* @throws NotFoundException
*/
public function loadForRestRequest(array $request): string
{
$moduleDir = $this->moduleDirectory->getDir('Magento_TestModuleFedex');
$type = strtolower($this->arrayManager->get(static::REST_PATH_SERVICE_TYPE, $request) ?? 'general');
$country = strtolower($this->arrayManager->get(static::REST_PATH_COUNTRY, $request) ?? '');
$responsePath = sprintf(static::REST_RESPONSE_FILE_PATTERN, $moduleDir, $type, $country);
if (!$this->fileIo->fileExists($responsePath)) {
throw new NotFoundException(
__('"%1" is not a valid mock response type for country "%2".', $type, $country)
);
}
return $this->fileIo->read($responsePath);
}
/**
* Load mock json response for a given request
*/
public function loadForAuthRequest()
{
$moduleDir = $this->moduleDirectory->getDir('Magento_TestModuleFedex');
$responsePath = sprintf(static::REST_AUTH_RESPONSE_FILE, $moduleDir);
if (!$this->fileIo->fileExists($responsePath)) {
throw new NotFoundException(
__('No valid mock response found for Authentication.')
);
}
return $this->fileIo->read($responsePath);
}
}
@@ -0,0 +1,6 @@
{
"access_token": "TEST_ACCESS_TOKEN",
"token_type": "bearer",
"expires_in": 3599,
"scope": "CXS-TP"
}
@@ -0,0 +1,529 @@
{
"transactionId": "TEST-RESPONSE-GENERAL_CA-0de9-4f74-89ab-d23e63d743bf",
"customerTransactionId": "customer test",
"output": {
"alerts": [
{
"code": "VIRTUAL.RESPONSE",
"message": "This is a Virtual Response.",
"alertType": "NOTE"
}
],
"rateReplyDetails": [
{
"serviceType": "SMART_POST",
"serviceName": "FedEx SmartPost®",
"packagingType": "YOUR_PACKAGING",
"ratedShipmentDetails": [
{
"rateType": "LIST",
"ratedWeightMethod": "ACTUAL",
"totalDiscounts": 0,
"totalBaseCharge": 35.42,
"totalNetCharge": 41.61,
"totalNetFedExCharge": 41.61,
"shipmentRateDetail": {
"rateZone": "5",
"dimDivisor": 139,
"fuelSurchargePercent": 14.25,
"totalSurcharges": 6.19,
"totalFreightDiscount": 0,
"surCharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"totalBillingWeight": {
"units": "LB",
"value": 25
},
"dimDivisorType": "COUNTRY",
"currency": "USD"
},
"ratedPackages": [
{
"groupNumber": 0,
"effectiveNetDiscount": 0,
"packageRateDetail": {
"rateType": "PAYOR_LIST_PACKAGE",
"ratedWeightMethod": "ACTUAL",
"baseCharge": 35.42,
"netFreight": 35.42,
"totalSurcharges": 6.19,
"netFedExCharge": 41.61,
"totalTaxes": 0,
"netCharge": 41.61,
"totalRebates": 0,
"billingWeight": {
"units": "LB",
"value": 25
},
"totalFreightDiscounts": 0,
"surcharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"currency": "USD"
}
}
],
"currency": "USD"
}
],
"operationalDetail": {
"ineligibleForMoneyBackGuarantee": false,
"astraDescription": "SMART POST"
},
"signatureOptionType": "SERVICE_DEFAULT",
"serviceDescription": {
"serviceId": "EP1000000141",
"serviceType": "SMART_POST",
"names": [
{
"type": "long",
"encoding": "utf-8",
"value": "FedEx SmartPost®"
},
{
"type": "long",
"encoding": "ascii",
"value": "FedEx SmartPost"
},
{
"type": "medium",
"encoding": "utf-8",
"value": "SmartPost®"
},
{
"type": "medium",
"encoding": "ascii",
"value": "SmartPost"
},
{
"type": "short",
"encoding": "utf-8",
"value": "SP"
},
{
"type": "short",
"encoding": "ascii",
"value": "SP"
},
{
"type": "abbrv",
"encoding": "ascii",
"value": "SP"
}
],
"description": "Smart Post",
"astraDescription": "SMART POST"
}
},
{
"serviceType": "FEDEX_GROUND",
"serviceName": "FedEx Ground",
"packagingType": "YOUR_PACKAGING",
"ratedShipmentDetails": [
{
"rateType": "LIST",
"ratedWeightMethod": "ACTUAL",
"totalDiscounts": 0,
"totalBaseCharge": 35.42,
"totalNetCharge": 41.61,
"totalNetFedExCharge": 41.61,
"shipmentRateDetail": {
"rateZone": "5",
"dimDivisor": 139,
"fuelSurchargePercent": 14.25,
"totalSurcharges": 6.19,
"totalFreightDiscount": 0,
"surCharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"totalBillingWeight": {
"units": "LB",
"value": 25
},
"dimDivisorType": "COUNTRY",
"currency": "USD"
},
"ratedPackages": [
{
"groupNumber": 0,
"effectiveNetDiscount": 0,
"packageRateDetail": {
"rateType": "PAYOR_LIST_PACKAGE",
"ratedWeightMethod": "ACTUAL",
"baseCharge": 35.42,
"netFreight": 35.42,
"totalSurcharges": 6.19,
"netFedExCharge": 41.61,
"totalTaxes": 0,
"netCharge": 41.61,
"totalRebates": 0,
"billingWeight": {
"units": "LB",
"value": 25
},
"totalFreightDiscounts": 0,
"surcharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"currency": "USD"
}
}
],
"currency": "USD"
}
],
"operationalDetail": {
"ineligibleForMoneyBackGuarantee": false,
"astraDescription": "Ground"
},
"signatureOptionType": "SERVICE_DEFAULT",
"serviceDescription": {
"serviceId": "EP1000000141",
"serviceType": "FEDEX_GROUND",
"names": [
{
"type": "long",
"encoding": "utf-8",
"value": "FedEx Ground"
},
{
"type": "long",
"encoding": "ascii",
"value": "FedEx Ground"
},
{
"type": "medium",
"encoding": "utf-8",
"value": "SmartPost®"
},
{
"type": "medium",
"encoding": "ascii",
"value": "SmartPost"
},
{
"type": "short",
"encoding": "utf-8",
"value": "SP"
},
{
"type": "short",
"encoding": "ascii",
"value": "SP"
},
{
"type": "abbrv",
"encoding": "ascii",
"value": "SP"
}
],
"description": "Ground",
"astraDescription": "Ground"
}
},
{
"serviceType": "INTERNATIONAL_ECONOMY",
"serviceName": "International Economy",
"packagingType": "YOUR_PACKAGING",
"ratedShipmentDetails": [
{
"rateType": "LIST",
"ratedWeightMethod": "ACTUAL",
"totalDiscounts": 0,
"totalBaseCharge": 35.42,
"totalNetCharge": 41.61,
"totalNetFedExCharge": 41.61,
"shipmentRateDetail": {
"rateZone": "5",
"dimDivisor": 139,
"fuelSurchargePercent": 14.25,
"totalSurcharges": 6.19,
"totalFreightDiscount": 0,
"surCharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"totalBillingWeight": {
"units": "LB",
"value": 25
},
"dimDivisorType": "COUNTRY",
"currency": "USD"
},
"ratedPackages": [
{
"groupNumber": 0,
"effectiveNetDiscount": 0,
"packageRateDetail": {
"rateType": "PAYOR_LIST_PACKAGE",
"ratedWeightMethod": "ACTUAL",
"baseCharge": 35.42,
"netFreight": 35.42,
"totalSurcharges": 6.19,
"netFedExCharge": 41.61,
"totalTaxes": 0,
"netCharge": 41.61,
"totalRebates": 0,
"billingWeight": {
"units": "LB",
"value": 25
},
"totalFreightDiscounts": 0,
"surcharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"currency": "USD"
}
}
],
"currency": "USD"
}
],
"operationalDetail": {
"ineligibleForMoneyBackGuarantee": false,
"astraDescription": "Ground"
},
"signatureOptionType": "SERVICE_DEFAULT",
"serviceDescription": {
"serviceId": "EP1000000141",
"serviceType": "INTERNATIONAL_ECONOMY",
"names": [
{
"type": "long",
"encoding": "utf-8",
"value": "International Economy"
},
{
"type": "long",
"encoding": "ascii",
"value": "International Economy"
},
{
"type": "medium",
"encoding": "utf-8",
"value": "International Economy"
},
{
"type": "medium",
"encoding": "ascii",
"value": "International Economy"
},
{
"type": "short",
"encoding": "utf-8",
"value": "IE"
},
{
"type": "short",
"encoding": "ascii",
"value": "SP"
},
{
"type": "abbrv",
"encoding": "ascii",
"value": "IE"
}
],
"description": "International Economy",
"astraDescription": "International Economy"
}
},
{
"serviceType": "INTERNATIONAL_PRIORITY",
"serviceName": "International Priority",
"packagingType": "YOUR_PACKAGING",
"ratedShipmentDetails": [
{
"rateType": "LIST",
"ratedWeightMethod": "ACTUAL",
"totalDiscounts": 0,
"totalBaseCharge": 35.42,
"totalNetCharge": 41.61,
"totalNetFedExCharge": 41.61,
"shipmentRateDetail": {
"rateZone": "5",
"dimDivisor": 139,
"fuelSurchargePercent": 14.25,
"totalSurcharges": 6.19,
"totalFreightDiscount": 0,
"surCharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"totalBillingWeight": {
"units": "LB",
"value": 25
},
"dimDivisorType": "COUNTRY",
"currency": "USD"
},
"ratedPackages": [
{
"groupNumber": 0,
"effectiveNetDiscount": 0,
"packageRateDetail": {
"rateType": "PAYOR_LIST_PACKAGE",
"ratedWeightMethod": "ACTUAL",
"baseCharge": 35.42,
"netFreight": 35.42,
"totalSurcharges": 6.19,
"netFedExCharge": 41.61,
"totalTaxes": 0,
"netCharge": 41.61,
"totalRebates": 0,
"billingWeight": {
"units": "LB",
"value": 25
},
"totalFreightDiscounts": 0,
"surcharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"currency": "USD"
}
}
],
"currency": "USD"
}
],
"operationalDetail": {
"ineligibleForMoneyBackGuarantee": false,
"astraDescription": "Ground"
},
"signatureOptionType": "SERVICE_DEFAULT",
"serviceDescription": {
"serviceId": "EP1000000141",
"serviceType": "INTERNATIONAL_PRIORITY",
"names": [
{
"type": "long",
"encoding": "utf-8",
"value": "International Economy"
},
{
"type": "long",
"encoding": "ascii",
"value": "International Priority"
},
{
"type": "medium",
"encoding": "utf-8",
"value": "International Priority"
},
{
"type": "medium",
"encoding": "ascii",
"value": "International Priority"
},
{
"type": "short",
"encoding": "utf-8",
"value": "IP"
},
{
"type": "short",
"encoding": "ascii",
"value": "IP"
},
{
"type": "abbrv",
"encoding": "ascii",
"value": "IE"
}
],
"description": "International Priority",
"astraDescription": "International Priority"
}
}
],
"quoteDate": "2023-08-14",
"encoded": false
}
}
@@ -0,0 +1,657 @@
{
"transactionId": "TEST-RESPONSE-GENERAL_US-0de9-4f74-89ab-d23e63d743bf",
"customerTransactionId": "customer test",
"output": {
"alerts": [
{
"code": "VIRTUAL.RESPONSE",
"message": "This is a Virtual Response.",
"alertType": "NOTE"
}
],
"rateReplyDetails": [
{
"serviceType": "FEDEX_GROUND",
"serviceName": "Ground",
"packagingType": "YOUR_PACKAGING",
"ratedShipmentDetails": [
{
"rateType": "LIST",
"ratedWeightMethod": "ACTUAL",
"totalDiscounts": 0,
"totalBaseCharge": 35.42,
"totalNetCharge": 41.61,
"totalNetFedExCharge": 41.61,
"shipmentRateDetail": {
"rateZone": "5",
"dimDivisor": 139,
"fuelSurchargePercent": 14.25,
"totalSurcharges": 6.19,
"totalFreightDiscount": 0,
"surCharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"totalBillingWeight": {
"units": "LB",
"value": 25
},
"dimDivisorType": "COUNTRY",
"currency": "USD"
},
"ratedPackages": [
{
"groupNumber": 0,
"effectiveNetDiscount": 0,
"packageRateDetail": {
"rateType": "PAYOR_LIST_PACKAGE",
"ratedWeightMethod": "ACTUAL",
"baseCharge": 35.42,
"netFreight": 35.42,
"totalSurcharges": 6.19,
"netFedExCharge": 41.61,
"totalTaxes": 0,
"netCharge": 41.61,
"totalRebates": 0,
"billingWeight": {
"units": "LB",
"value": 25
},
"totalFreightDiscounts": 0,
"surcharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"currency": "USD"
}
}
],
"currency": "USD"
}
],
"operationalDetail": {
"ineligibleForMoneyBackGuarantee": false,
"astraDescription": "Ground"
},
"signatureOptionType": "SERVICE_DEFAULT",
"serviceDescription": {
"serviceId": "EP1000000141",
"serviceType": "FEDEX_GROUND",
"names": [
{
"type": "long",
"encoding": "utf-8",
"value": "Fedex Ground"
},
{
"type": "long",
"encoding": "ascii",
"value": "Fedex Ground"
},
{
"type": "medium",
"encoding": "utf-8",
"value": "Ground"
},
{
"type": "medium",
"encoding": "ascii",
"value": "Ground"
},
{
"type": "short",
"encoding": "utf-8",
"value": "G"
},
{
"type": "short",
"encoding": "ascii",
"value": "G"
},
{
"type": "abbrv",
"encoding": "ascii",
"value": "G"
}
],
"description": "FedEx Ground",
"astraDescription": "FEDEX GROUND"
}
},
{
"serviceType": "FEDEX_EXPRESS_SAVER",
"serviceName": "Express Saver",
"packagingType": "YOUR_PACKAGING",
"ratedShipmentDetails": [
{
"rateType": "LIST",
"ratedWeightMethod": "ACTUAL",
"totalDiscounts": 0,
"totalBaseCharge": 35.42,
"totalNetCharge": 41.61,
"totalNetFedExCharge": 41.61,
"shipmentRateDetail": {
"rateZone": "5",
"dimDivisor": 139,
"fuelSurchargePercent": 14.25,
"totalSurcharges": 6.19,
"totalFreightDiscount": 0,
"surCharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"totalBillingWeight": {
"units": "LB",
"value": 25
},
"dimDivisorType": "COUNTRY",
"currency": "USD"
},
"ratedPackages": [
{
"groupNumber": 0,
"effectiveNetDiscount": 0,
"packageRateDetail": {
"rateType": "PAYOR_LIST_PACKAGE",
"ratedWeightMethod": "ACTUAL",
"baseCharge": 35.42,
"netFreight": 35.42,
"totalSurcharges": 6.19,
"netFedExCharge": 41.61,
"totalTaxes": 0,
"netCharge": 41.61,
"totalRebates": 0,
"billingWeight": {
"units": "LB",
"value": 25
},
"totalFreightDiscounts": 0,
"surcharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"currency": "USD"
}
}
],
"currency": "USD"
}
],
"operationalDetail": {
"ineligibleForMoneyBackGuarantee": false,
"astraDescription": "Ground"
},
"signatureOptionType": "SERVICE_DEFAULT",
"serviceDescription": {
"serviceId": "EP1000000141",
"serviceType": "FEDEX_EXPRESS_SAVER",
"names": [
{
"type": "long",
"encoding": "utf-8",
"value": "Express Saver"
},
{
"type": "long",
"encoding": "ascii",
"value": "Express Saver"
},
{
"type": "medium",
"encoding": "utf-8",
"value": "Express Saver"
},
{
"type": "medium",
"encoding": "ascii",
"value": "Express Saver"
},
{
"type": "short",
"encoding": "utf-8",
"value": "ES"
},
{
"type": "short",
"encoding": "ascii",
"value": "ES"
},
{
"type": "abbrv",
"encoding": "ascii",
"value": "ES"
}
],
"description": "Express Saver",
"astraDescription": "Express Saver"
}
},
{
"serviceType": "PRIORITY_OVERNIGHT",
"serviceName": "Priority Overnight",
"packagingType": "YOUR_PACKAGING",
"ratedShipmentDetails": [
{
"rateType": "LIST",
"ratedWeightMethod": "ACTUAL",
"totalDiscounts": 0,
"totalBaseCharge": 35.42,
"totalNetCharge": 41.61,
"totalNetFedExCharge": 41.61,
"shipmentRateDetail": {
"rateZone": "5",
"dimDivisor": 139,
"fuelSurchargePercent": 14.25,
"totalSurcharges": 6.19,
"totalFreightDiscount": 0,
"surCharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"totalBillingWeight": {
"units": "LB",
"value": 25
},
"dimDivisorType": "COUNTRY",
"currency": "USD"
},
"ratedPackages": [
{
"groupNumber": 0,
"effectiveNetDiscount": 0,
"packageRateDetail": {
"rateType": "PAYOR_LIST_PACKAGE",
"ratedWeightMethod": "ACTUAL",
"baseCharge": 35.42,
"netFreight": 35.42,
"totalSurcharges": 6.19,
"netFedExCharge": 41.61,
"totalTaxes": 0,
"netCharge": 41.61,
"totalRebates": 0,
"billingWeight": {
"units": "LB",
"value": 25
},
"totalFreightDiscounts": 0,
"surcharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"currency": "USD"
}
}
],
"currency": "USD"
}
],
"operationalDetail": {
"ineligibleForMoneyBackGuarantee": false,
"astraDescription": "Ground"
},
"signatureOptionType": "SERVICE_DEFAULT",
"serviceDescription": {
"serviceId": "EP1000000141",
"serviceType": "PRIORITY_OVERNIGHT",
"names": [
{
"type": "long",
"encoding": "utf-8",
"value": "Priority Overnight"
},
{
"type": "long",
"encoding": "ascii",
"value": "Priority Overnight"
},
{
"type": "medium",
"encoding": "utf-8",
"value": "Priority Overnight"
},
{
"type": "medium",
"encoding": "ascii",
"value": "Priority Overnight"
},
{
"type": "short",
"encoding": "utf-8",
"value": "PO"
},
{
"type": "short",
"encoding": "ascii",
"value": "PO"
},
{
"type": "abbrv",
"encoding": "ascii",
"value": "PO"
}
],
"description": "Priority Overnight",
"astraDescription": "Priority Overnight"
}
},
{
"serviceType": "FEDEX_2_DAY",
"serviceName": "2 Day",
"packagingType": "YOUR_PACKAGING",
"ratedShipmentDetails": [
{
"rateType": "LIST",
"ratedWeightMethod": "ACTUAL",
"totalDiscounts": 0,
"totalBaseCharge": 35.42,
"totalNetCharge": 41.61,
"totalNetFedExCharge": 41.61,
"shipmentRateDetail": {
"rateZone": "5",
"dimDivisor": 139,
"fuelSurchargePercent": 14.25,
"totalSurcharges": 6.19,
"totalFreightDiscount": 0,
"surCharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"totalBillingWeight": {
"units": "LB",
"value": 25
},
"dimDivisorType": "COUNTRY",
"currency": "USD"
},
"ratedPackages": [
{
"groupNumber": 0,
"effectiveNetDiscount": 0,
"packageRateDetail": {
"rateType": "PAYOR_LIST_PACKAGE",
"ratedWeightMethod": "ACTUAL",
"baseCharge": 35.42,
"netFreight": 35.42,
"totalSurcharges": 6.19,
"netFedExCharge": 41.61,
"totalTaxes": 0,
"netCharge": 41.61,
"totalRebates": 0,
"billingWeight": {
"units": "LB",
"value": 25
},
"totalFreightDiscounts": 0,
"surcharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"currency": "USD"
}
}
],
"currency": "USD"
}
],
"operationalDetail": {
"ineligibleForMoneyBackGuarantee": false,
"astraDescription": "Ground"
},
"signatureOptionType": "SERVICE_DEFAULT",
"serviceDescription": {
"serviceId": "EP1000000141",
"serviceType": "FEDEX_2_DAY",
"names": [
{
"type": "long",
"encoding": "utf-8",
"value": "2 Day"
},
{
"type": "long",
"encoding": "ascii",
"value": "2 Day"
},
{
"type": "medium",
"encoding": "utf-8",
"value": "2 Day"
},
{
"type": "medium",
"encoding": "ascii",
"value": "2 Day"
},
{
"type": "short",
"encoding": "utf-8",
"value": "2D"
},
{
"type": "short",
"encoding": "ascii",
"value": "2D"
},
{
"type": "abbrv",
"encoding": "ascii",
"value": "2D"
}
],
"description": "2 Day",
"astraDescription": "2 Day"
}
},
{
"serviceType": "FIRST_OVERNIGHT",
"serviceName": "First Overnight",
"packagingType": "YOUR_PACKAGING",
"ratedShipmentDetails": [
{
"rateType": "LIST",
"ratedWeightMethod": "ACTUAL",
"totalDiscounts": 0,
"totalBaseCharge": 35.42,
"totalNetCharge": 41.61,
"totalNetFedExCharge": 41.61,
"shipmentRateDetail": {
"rateZone": "5",
"dimDivisor": 139,
"fuelSurchargePercent": 14.25,
"totalSurcharges": 6.19,
"totalFreightDiscount": 0,
"surCharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"totalBillingWeight": {
"units": "LB",
"value": 25
},
"dimDivisorType": "COUNTRY",
"currency": "USD"
},
"ratedPackages": [
{
"groupNumber": 0,
"effectiveNetDiscount": 0,
"packageRateDetail": {
"rateType": "PAYOR_LIST_PACKAGE",
"ratedWeightMethod": "ACTUAL",
"baseCharge": 35.42,
"netFreight": 35.42,
"totalSurcharges": 6.19,
"netFedExCharge": 41.61,
"totalTaxes": 0,
"netCharge": 41.61,
"totalRebates": 0,
"billingWeight": {
"units": "LB",
"value": 25
},
"totalFreightDiscounts": 0,
"surcharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"currency": "USD"
}
}
],
"currency": "USD"
}
],
"operationalDetail": {
"ineligibleForMoneyBackGuarantee": false,
"astraDescription": "Ground"
},
"signatureOptionType": "SERVICE_DEFAULT",
"serviceDescription": {
"serviceId": "EP1000000141",
"serviceType": "FIRST_OVERNIGHT",
"names": [
{
"type": "long",
"encoding": "utf-8",
"value": "First Overnight"
},
{
"type": "long",
"encoding": "ascii",
"value": "First Overnight"
},
{
"type": "medium",
"encoding": "utf-8",
"value": "First Overnight"
},
{
"type": "medium",
"encoding": "ascii",
"value": "First Overnight"
},
{
"type": "short",
"encoding": "utf-8",
"value": "FO"
},
{
"type": "short",
"encoding": "ascii",
"value": "FO"
},
{
"type": "abbrv",
"encoding": "ascii",
"value": "FO"
}
],
"description": "First Overnight",
"astraDescription": "First Overnight"
}
}
],
"quoteDate": "2023-08-14",
"encoded": false
}
}
@@ -0,0 +1,145 @@
{
"transactionId": "TEST-RESPONSE-SMART-POST-CA-0de9-4f74-89ab-d23e63d743bf",
"customerTransactionId": "customer test",
"output": {
"alerts": [
{
"code": "VIRTUAL.RESPONSE",
"message": "This is a Virtual Response.",
"alertType": "NOTE"
}
],
"rateReplyDetails": [
{
"serviceType": "SMART_POST",
"serviceName": "FedEx SmartPost®",
"packagingType": "YOUR_PACKAGING",
"ratedShipmentDetails": [
{
"rateType": "LIST",
"ratedWeightMethod": "ACTUAL",
"totalDiscounts": 0.0,
"totalBaseCharge": 35.42,
"totalNetCharge": 41.61,
"totalNetFedExCharge": 41.61,
"shipmentRateDetail": {
"rateZone": "5",
"dimDivisor": 139,
"fuelSurchargePercent": 14.25,
"totalSurcharges": 6.19,
"totalFreightDiscount": 0.0,
"surCharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1.0
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"totalBillingWeight": {
"units": "LB",
"value": 25.0
},
"dimDivisorType": "COUNTRY",
"currency": "USD"
},
"ratedPackages": [
{
"groupNumber": 0,
"effectiveNetDiscount": 0.0,
"packageRateDetail": {
"rateType": "PAYOR_LIST_PACKAGE",
"ratedWeightMethod": "ACTUAL",
"baseCharge": 35.42,
"netFreight": 35.42,
"totalSurcharges": 6.19,
"netFedExCharge": 41.61,
"totalTaxes": 0.0,
"netCharge": 41.61,
"totalRebates": 0.0,
"billingWeight": {
"units": "LB",
"value": 25.0
},
"totalFreightDiscounts": 0.0,
"surcharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1.0
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"currency": "USD"
}
}
],
"currency": "USD"
}
],
"operationalDetail": {
"ineligibleForMoneyBackGuarantee": false,
"astraDescription": "SMART POST"
},
"signatureOptionType": "SERVICE_DEFAULT",
"serviceDescription": {
"serviceId": "EP1000000141",
"serviceType": "SMART_POST",
"names": [
{
"type": "long",
"encoding": "utf-8",
"value": "FedEx SmartPost®"
},
{
"type": "long",
"encoding": "ascii",
"value": "FedEx SmartPost"
},
{
"type": "medium",
"encoding": "utf-8",
"value": "SmartPost®"
},
{
"type": "medium",
"encoding": "ascii",
"value": "SmartPost"
},
{
"type": "short",
"encoding": "utf-8",
"value": "SP"
},
{
"type": "short",
"encoding": "ascii",
"value": "SP"
},
{
"type": "abbrv",
"encoding": "ascii",
"value": "SP"
}
],
"description": "Smart Post",
"astraDescription": "SMART POST"
}
}
],
"quoteDate": "2023-08-14",
"encoded": false
}
}
@@ -0,0 +1,145 @@
{
"transactionId": "TEST-RESPONSE-SMART-POST-US-0de9-4f74-89ab-d23e63d743bf",
"customerTransactionId": "customer test",
"output": {
"alerts": [
{
"code": "VIRTUAL.RESPONSE",
"message": "This is a Virtual Response.",
"alertType": "NOTE"
}
],
"rateReplyDetails": [
{
"serviceType": "SMART_POST",
"serviceName": "FedEx SmartPost®",
"packagingType": "YOUR_PACKAGING",
"ratedShipmentDetails": [
{
"rateType": "LIST",
"ratedWeightMethod": "ACTUAL",
"totalDiscounts": 0.0,
"totalBaseCharge": 35.42,
"totalNetCharge": 41.61,
"totalNetFedExCharge": 41.61,
"shipmentRateDetail": {
"rateZone": "5",
"dimDivisor": 139,
"fuelSurchargePercent": 14.25,
"totalSurcharges": 6.19,
"totalFreightDiscount": 0.0,
"surCharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1.0
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"totalBillingWeight": {
"units": "LB",
"value": 25.0
},
"dimDivisorType": "COUNTRY",
"currency": "USD"
},
"ratedPackages": [
{
"groupNumber": 0,
"effectiveNetDiscount": 0.0,
"packageRateDetail": {
"rateType": "PAYOR_LIST_PACKAGE",
"ratedWeightMethod": "ACTUAL",
"baseCharge": 35.42,
"netFreight": 35.42,
"totalSurcharges": 6.19,
"netFedExCharge": 41.61,
"totalTaxes": 0.0,
"netCharge": 41.61,
"totalRebates": 0.0,
"billingWeight": {
"units": "LB",
"value": 25.0
},
"totalFreightDiscounts": 0.0,
"surcharges": [
{
"type": "DELIVERY_CONFIRMATION",
"description": "Delivery and Returns",
"level": "PACKAGE",
"amount": 1.0
},
{
"type": "FUEL",
"description": "Fuel Surcharge",
"level": "PACKAGE",
"amount": 5.19
}
],
"currency": "USD"
}
}
],
"currency": "USD"
}
],
"operationalDetail": {
"ineligibleForMoneyBackGuarantee": false,
"astraDescription": "SMART POST"
},
"signatureOptionType": "SERVICE_DEFAULT",
"serviceDescription": {
"serviceId": "EP1000000141",
"serviceType": "SMART_POST",
"names": [
{
"type": "long",
"encoding": "utf-8",
"value": "FedEx SmartPost®"
},
{
"type": "long",
"encoding": "ascii",
"value": "FedEx SmartPost"
},
{
"type": "medium",
"encoding": "utf-8",
"value": "SmartPost®"
},
{
"type": "medium",
"encoding": "ascii",
"value": "SmartPost"
},
{
"type": "short",
"encoding": "utf-8",
"value": "SP"
},
{
"type": "short",
"encoding": "ascii",
"value": "SP"
},
{
"type": "abbrv",
"encoding": "ascii",
"value": "SP"
}
],
"description": "Smart Post",
"astraDescription": "SMART POST"
}
}
],
"quoteDate": "2023-08-14",
"encoded": false
}
}
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Fedex\Model\Carrier">
<arguments>
<argument name="curlFactory" xsi:type="object">Magento\TestModuleFedex\Model\MockCurlFactory</argument>
</arguments>
</type>
</config>
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleFedex" />
</config>
@@ -0,0 +1,13 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleFedex') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleFedex', __DIR__);
}