https://github.com/easykeys/EasyKeys.Shipping
FedEx, Usps, Stamps.com Shipping Implementations
https://github.com/easykeys/EasyKeys.Shipping
aspnetcore dotnet dotnet-core fedex-api fedexapi kdcllc shipping-api shipping-labels shipping-rates stamps-com usps-api
Last synced: about 1 year ago
JSON representation
FedEx, Usps, Stamps.com Shipping Implementations
- Host: GitHub
- URL: https://github.com/easykeys/EasyKeys.Shipping
- Owner: easykeys
- License: apache-2.0
- Created: 2021-02-12T03:10:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-15T18:14:47.000Z (about 2 years ago)
- Last Synced: 2024-09-18T10:14:36.326Z (over 1 year ago)
- Topics: aspnetcore, dotnet, dotnet-core, fedex-api, fedexapi, kdcllc, shipping-api, shipping-labels, shipping-rates, stamps-com, usps-api
- Language: C#
- Homepage:
- Size: 41.1 MB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EasyKeys.Shipping
[](https://ci.appveyor.com/project/easykeys/easykeys-shipping)
[](https://www.nuget.org/packages?q=EasyKeys.Shipping.Abstractions)

[](https://f.feedz.io/easykeys/core/packages/EasyKeys.Shipping.Abstractions/latest/download)
[EasyKeys.com](https://easykeys.com) production ready shipment library for FedEx, Stamps and USPS shipping providers.
## Give a Star! :star:
If you like or are using this project please give it a star. Thanks!
## Reusable Abstractions
- [x] [EasyKeys.Shipping.Abstractions](./src/EasyKeys.Shipping.Abstractions)
- [x] [EasyKeys.Shipping.PostalAddress](./src/EasyKeys.Shipping.PostalAddress)
## FedEx Shipping
- [x] [EasyKeys.Shipping.FedEx.Abstractions](./src/EasyKeys.Shipping.FedEx.Abstractions)
- [x] [EasyKeys.Shipping.FedEx.AddressValidation](./src/EasyKeys.Shipping.FedEx.AddressValidation)
- [x] [EasyKeys.Shipping.FedEx.Rates](./src/EasyKeys.Shipping.FedEx.Rates)
- [x] [EasyKeys.Shipping.FedEx.Shipment](./src/EasyKeys.Shipping.FedEx.Shipment)
- [x] [EasyKeys.Shipping.FedEx.Tracking](./src/EasyKeys.Shipping.FedEx.Tracking)
- [x] [EasyKeys.Shipping.FedEx.Console](./src/EasyKeys.Shipping.FedEx.Console) - Sample Application
## Stamps Shipping
- [x] [EasyKeys.Shipping.Stamps.Abstractions](./src/EasyKeys.Shipping.Stamps.Abstractions)
- [x] [EasyKeys.Shipping.Stamps.AddressValidation](./src/EasyKeys.Shipping.Stamps.AddressValidation)
- [x] [EasyKeys.Shipping.Stamps.Rates](./src/EasyKeys.Shipping.Stamps.Rates)
- [x] [EasyKeys.Shipping.Stamps.Shipment](./src/EasyKeys.Shipping.Stamps.Shipment)
- [x] [EasyKeys.Shipping.Stamps.Tracking](./src/EasyKeys.Shipping.Stamps.Tracking)
- [x] [EasyKeys.Shipping.Stamps.Console](./src/EasyKeys.Shipping.Stamps.Console) - Sample application
## USPS Shipping
- [x] [EasyKeys.Shipping.Usps.Abstractions](./src/EasyKeys.Shipping.Usps.Abstractions)
- [x] [EasyKeys.Shipping.Usps.Rates](./src/EasyKeys.Shipping.Usps.Rates)
## Poly policy Sample
```csharp
var request = new ValidateAddress(model?.RequestId ?? Guid.NewGuid().ToString(), originalAddress, originalAddress);
var response = await _policy.ExecuteAsync(
async (ctx, ct) => await _validationProvider.ValidateAddressAsync(request, ct),
new Context
{
[_policyContextMethod] = "ValidateAsync"
},
cancellationToken);
private IAsyncPolicy GetRetryWithTimeOutPolicy()
{
// each call is limited to 30 seconds in case when fedex is non-reponsive and it is 1min timeout, it is way to long
// The request channel timed out attempting to send after 00:01:00.
// Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.
var timeoutPolicy = Policy.TimeoutAsync(30, TimeoutStrategy.Pessimistic);
var jitterer = new Random();
return Policy
.Handle()
.WaitAndRetryAsync(
retryCount: 3, // exponential back-off plus some jitter
sleepDurationProvider: (retryAttempt, context) =>
{
return TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))
+ TimeSpan.FromMilliseconds(jitterer.Next(0, 200));
},
onRetry: (ex, span, context) =>
{
var methodName = context[_policyContextMethod] ?? "MethodNotSpecified";
_logger.LogWarning(
"{Method} wait {Seconds} to execute with exception: {Message} for named policy: {Policy}",
methodName,
span.TotalSeconds,
ex.Message,
context.PolicyKey);
})
.WithPolicyKey($"{nameof(FedExAddressValidationProvider)}WaitAndRetryAsync")
.WrapAsync(timeoutPolicy);
}
```
## References
- https://github.com/leoboles/Integration.Stamps.git
- https://github.com/oparamo/StampsService.git