Skip to content

Commit 8641680

Browse files
committed
#2011 Fix error of Fedex plugin for India intra-country shipping rates
1 parent db40053 commit 8641680

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

src/Plugins/Nop.Plugin.Shipping.Fedex/Description.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Group: Shipping rate computation
22
FriendlyName: FedEx
33
SystemName: Shipping.FedEx
4-
Version: 1.23
4+
Version: 1.24
55
SupportedVersions: 3.90
66
Author: nopCommerce team
77
DisplayOrder: 1

src/Plugins/Nop.Plugin.Shipping.Fedex/FedexComputationMethod.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,33 @@ private void SetShipmentDetails(RateRequest request, decimal orderSubTotal, stri
188188
request.RequestedShipment.RateRequestTypes[1] = RateRequestType.LIST;
189189
//request.RequestedShipment.PackageDetail = RequestedPackageDetailType.INDIVIDUAL_PACKAGES;
190190
//request.RequestedShipment.PackageDetailSpecified = true;
191+
192+
//for India domestic shipping add additional details
193+
if (request.RequestedShipment.Shipper.Address.CountryCode.Equals("IN", StringComparison.InvariantCultureIgnoreCase) &&
194+
request.RequestedShipment.Recipient.Address.CountryCode.Equals("IN", StringComparison.InvariantCultureIgnoreCase))
195+
{
196+
var commodity = new Commodity
197+
{
198+
Name = "1",
199+
NumberOfPieces = "1",
200+
CustomsValue = new Money
201+
{
202+
Amount = orderSubTotal,
203+
AmountSpecified = true,
204+
Currency = currencyCode
205+
}
206+
};
207+
208+
request.RequestedShipment.CustomsClearanceDetail = new CustomsClearanceDetail
209+
{
210+
CommercialInvoice = new CommercialInvoice
211+
{
212+
Purpose = PurposeOfShipmentType.SOLD,
213+
PurposeSpecified = true
214+
},
215+
Commodities = new[] { commodity }
216+
};
217+
}
191218
}
192219

193220
private void SetPayment(RateRequest request)
@@ -720,13 +747,15 @@ private Currency GetRequestedShipmentCurrency(string originCountryCode, string d
720747
var primaryStoreCurrency = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId);
721748

722749
//The solution coded here might be considered a bit of a hack
723-
//it only supports the scenario for US / Canada shipping
750+
//it only supports the scenario for US / Canada / India shipping
724751
//because nopCommerce does not have a concept of a designated currency for a Country.
725752
string originCurrencyCode;
726753
if (originCountryCode == "US")
727754
originCurrencyCode = "USD";
728755
else if (originCountryCode == "CA")
729756
originCurrencyCode = "CAD";
757+
else if (originCountryCode == "IN")
758+
originCurrencyCode = "INR";
730759
else
731760
originCurrencyCode = primaryStoreCurrency.CurrencyCode;
732761

@@ -735,6 +764,8 @@ private Currency GetRequestedShipmentCurrency(string originCountryCode, string d
735764
destinCurrencyCode = "USD";
736765
else if (destinCountryCode == "CA")
737766
destinCurrencyCode = "CAD";
767+
else if (destinCountryCode == "IN")
768+
destinCurrencyCode = "INR";
738769
else
739770
destinCurrencyCode = primaryStoreCurrency.CurrencyCode;
740771

0 commit comments

Comments
 (0)