From 1c0ce945c224f5a81972c32f8ac758109eddb293 Mon Sep 17 00:00:00 2001 From: Brandon Moffett Date: Mon, 19 May 2025 17:40:40 -0700 Subject: [PATCH 1/3] Update versioning and enhance payment handling logic - Bumped version in GitVersion.yml to 6.3.3 and enabled commit message incrementing for continuous delivery. - Added `CustomsPaymentType` property to `ShipmentDetails` class with appropriate documentation. - Modified payment handling in `FedExShipmentProvider` to use `CustomsPaymentType` in the switch statement, simplifying the logic for the "RECIPIENT" case. --- GitVersion.yml | 2 +- .../Models/ShipmentDetails.cs | 6 ++++++ .../RestApi/Impl/FedExShipmentProvider.cs | 15 +++------------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/GitVersion.yml b/GitVersion.yml index 6979f05..4387120 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,5 +1,5 @@ mode: ContinuousDelivery -next-version: 6.3.2 +next-version: 6.3.3 increment: Patch major-version-bump-message: '\+semver:\s?(breaking|major|release)' minor-version-bump-message: '\+semver:\s?(feat|feature|minor)' diff --git a/src/EasyKeys.Shipping.FedEx.Shipment/Models/ShipmentDetails.cs b/src/EasyKeys.Shipping.FedEx.Shipment/Models/ShipmentDetails.cs index 926924b..5992532 100644 --- a/src/EasyKeys.Shipping.FedEx.Shipment/Models/ShipmentDetails.cs +++ b/src/EasyKeys.Shipping.FedEx.Shipment/Models/ShipmentDetails.cs @@ -92,6 +92,12 @@ public class ShipmentDetails /// public FedExPaymentType PaymentType { get; set; } = FedExPaymentType.Sender; + /// + /// Default payment type would be recipient unless its a COD. + /// Sender,ThirdParty,Recipient,Account,Collect. + /// + public FedExPaymentType CustomsPaymentType { get; set; } = FedExPaymentType.Recipient; + /// /// Collect on delivery is defaulted to false. /// diff --git a/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs b/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs index 11dc22e..ac5ce9d 100644 --- a/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs +++ b/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs @@ -296,7 +296,8 @@ public async Task CreateShipmentAsync(FedExServiceType serviceTyp }).ToList() }; - switch (shipmentDetails.PaymentType.Name) + // customs payment type + switch (shipmentDetails.CustomsPaymentType.Name) { case "SENDER": shipmentRequest.RequestedShipment.CustomsClearanceDetail.DutiesPayment = new Payment_1 @@ -307,17 +308,7 @@ public async Task CreateShipmentAsync(FedExServiceType serviceTyp case "RECIPIENT": shipmentRequest.RequestedShipment.CustomsClearanceDetail.DutiesPayment = new Payment_1 { - PaymentType = Payment_1PaymentType.RECIPIENT, - Payor = new Payor_1 - { - ResponsibleParty = new Party_2 - { - AccountNumber = new PartyAccountNumber - { - Value = shipmentDetails.AccountNumber - } - } - } + PaymentType = Payment_1PaymentType.RECIPIENT }; break; } From 6decc7c8a3e630f0473861985e95e0646a7fe443 Mon Sep 17 00:00:00 2001 From: Brandon Moffett Date: Mon, 19 May 2025 18:24:06 -0700 Subject: [PATCH 2/3] Enhance DutiesPayment structure in FedExShipmentProvider Updated the DutiesPayment property to include a new Payor object. This object now contains a ResponsibleParty with an AccountNumber set from shipmentDetails, improving the payment handling logic. --- .../RestApi/Impl/FedExShipmentProvider.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs b/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs index ac5ce9d..86e284a 100644 --- a/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs +++ b/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs @@ -308,7 +308,17 @@ public async Task CreateShipmentAsync(FedExServiceType serviceTyp case "RECIPIENT": shipmentRequest.RequestedShipment.CustomsClearanceDetail.DutiesPayment = new Payment_1 { - PaymentType = Payment_1PaymentType.RECIPIENT + PaymentType = Payment_1PaymentType.RECIPIENT, + Payor = new Payor_1 + { + ResponsibleParty = new Party_2 + { + AccountNumber = new PartyAccountNumber + { + Value = shipmentDetails.AccountNumber + } + } + } }; break; } From b948e0c0578c409be171e5b00b0210657a2ee0de Mon Sep 17 00:00:00 2001 From: Brandon Moffett Date: Mon, 19 May 2025 18:28:46 -0700 Subject: [PATCH 3/3] Add THIRD_PARTY payment handling in FedEx logic Introduce handling for "THIRD_PARTY" payment type in the FedEx shipment processing. Set up `ShippingChargesPayment` with appropriate `Payment` object and account number. Add default case for other payment types to set `DutiesPayment` as `RECIPIENT`. --- .../RestApi/Impl/FedExShipmentProvider.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs b/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs index 86e284a..6c2a98a 100644 --- a/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs +++ b/src/EasyKeys.Shipping.FedEx.Shipment/RestApi/Impl/FedExShipmentProvider.cs @@ -321,6 +321,29 @@ public async Task CreateShipmentAsync(FedExServiceType serviceTyp } }; break; + + case "THIRD_PARTY": + shipmentRequest.RequestedShipment.ShippingChargesPayment = new Payment + { + PaymentType = PaymentType.THIRD_PARTY, + Payor = new Payor + { + ResponsibleParty = new ResponsiblePartyParty + { + AccountNumber = new PartyAccountNumber + { + Value = shipmentDetails.AccountNumber + } + } + } + }; + break; + default: + shipmentRequest.RequestedShipment.CustomsClearanceDetail.DutiesPayment = new Payment_1 + { + PaymentType = Payment_1PaymentType.RECIPIENT + }; + break; } } @@ -348,6 +371,23 @@ public async Task CreateShipmentAsync(FedExServiceType serviceTyp } }; break; + + case "THIRD_PARTY": + shipmentRequest.RequestedShipment.ShippingChargesPayment = new Payment + { + PaymentType = PaymentType.THIRD_PARTY, + Payor = new Payor + { + ResponsibleParty = new ResponsiblePartyParty + { + AccountNumber = new PartyAccountNumber + { + Value = shipmentDetails.AccountNumber + } + } + } + }; + break; } var token = await _authService.GetTokenAsync(cancellationToken);