Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/amazon shipping #48

Merged
merged 15 commits into from
Dec 16, 2024
Merged

Feature/amazon shipping #48

merged 15 commits into from
Dec 16, 2024

Conversation

ucrengineer
Copy link
Collaborator

amazon shipping rate and shipment implementation.

some refactoring of fedex api implementations.

Brandon Moffett added 15 commits December 14, 2024 14:37
This commit updates the solution to include new projects for Amazon shipping functionalities, specifically adding the `Amazon` and `EasyKeys.Shipping.Amazon.Abstractions` projects. The `.editorconfig` file has been enhanced with additional coding style rules.

A new project file for `EasyKeys.Shipping.Amazon.Abstractions` has been created, targeting `.NET 8.0` and including necessary package references. New classes and methods in `AmazonShippingServiceCollectionExtensions.cs` facilitate the integration of the Amazon shipping client.

Additionally, a new JSON file `amazon-shipping.json` defines the OpenAPI specifications for the Amazon Shipping API, detailing endpoints for shipping rates, shipment purchases, and tracking. The changes also introduce a configuration class `AmazonShippingApiOptions` for API authentication, along with an interface and implementation for token management, improving the overall authentication mechanism.
- Updated solution file to include "EasyKeys.Shipping.Amazon.Rates".
- Added project reference to "EasyKeys.Shipping.Amazon.Abstractions" in `Minimal.Apis.csproj`.
- Updated `Program.cs` with a new using directive for dependency injection.
- Introduced a new `.editorconfig` for coding style and formatting rules.
- Created `Class1.cs` in the "EasyKeys.Shipping.Amazon.Rates" namespace.
- Established `EasyKeys.Shipping.Amazon.Rates.csproj` with necessary settings.
- Included new project `AmazonConsoleApp` in the solution.
- Updated `AmazonShippingServiceCollectionExtensions` namespace.
- Modified properties in `AmazonShippingApi` to allow null values.
- Added `.editorconfig` for coding style and formatting rules.
- Created `AmazonConsoleApp.csproj` with necessary configurations.
- Implemented HTTP request logic in `Program.cs` for Amazon API.
- Adjusted spacing in the AddAmazonShippingClient method for consistency.
- Removed 'required' keyword from ClientId, ClientSecret, and RefreshToken properties in AmazonShippingApiOptions, making them optional.
- Assigned default values of string.Empty to ClientId, ClientSecret, and RefreshToken.
Introduces the `AmazonShippingRateProvider` class implementing the `IAmazonShippingRateProvider` interface to retrieve shipping rates from the Amazon API. Updates the `ShipDate` property type in `AmazonShippingApi.cs` from `DateTimeOffset` to `string`. Adds a new folder for dependency injection in the project file. Removes the unused `Class1.cs` file. Includes additional using directives in relevant files for improved functionality.
Updated `Program.cs` to implement shipment creation using `OneClickShipmentAsync`, including detailed shipment information. Changed `ShipDate` type in `AmazonShippingApi.cs` from `DateTimeOffset` to `string`.

Modified `GetRatesAsync` in `AmazonShippingRateProvider.cs` to construct a `GetRatesRequest` with new shipment details and improved error handling. Cleaned up `EasyKeys.Shipping.Amazon.Rates.csproj` by removing unnecessary folder references.

Added `AddRestApiAmazonRateProvider` method in `AmazonRatesServiceCollectionExtensions.cs` to register services for the Amazon shipping rate provider.
- Removed `AmazonConsoleApp` and its related files.
- Added `EasyKeys.Shipping.Amazon.Shipment` project for better organization.
- Updated `.editorconfig` for consistent coding styles.
- Introduced `AmazonShippingShipmentProvider` and `IAmazonShippingShipmentProvider` interface for shipment operations.
- Created `ShippingDetails` class to encapsulate shipment information.
- Enhanced `AmazonShippingRateProvider` to use dynamic package dimensions and weights.
- Implemented error handling in the new shipment provider.
Updated `AmazonShippingApiOptions` to include `IsDevelopment` and `ClientId` properties for better environment configuration.
Modified `AmazonShippingRateProvider` and `AmazonShippingShipmentProvider` to utilize the new options, adjusting the base URL based on the development environment.
Replaced references to the old `_amazonShippingApi` field with `_shippingApi` for consistency across method implementations.
- Added using directives and method summaries in
  `AmazonShippingServiceCollectionExtensions.cs` to
  improve documentation and service registration.

- Removed unnecessary using directives in
  `AmazonRatesServiceCollectionExtensions.cs` and
  updated method summaries for `AddRestApiAmazonRateProvider`
  and `AddRestApiAmazonShipmentProvider`.

- Commented out calls to `AddAmazonShippingClient` to
  indicate changes in service registration practices.
Introduce logging capabilities in `AmazonShippingRateProvider` and `AmazonShippingShipmentProvider` for improved error handling. Log detailed error messages from the Amazon Shipping API. Remove redundant `services.AddLogging()` calls in `AddRestApiAmazonRateProvider` and `AddRestApiAmazonShipmentProvider`.
- Simplified return value in `AmazonApiAuthenticatorService` to only return the access token.
- Updated sender details in `AmazonShippingRateProvider` for clarity.
- Replaced `labelOptions` with `shippingDetails` in `AmazonShippingShipmentProvider` for consistency.
- Enhanced `FedExServiceCollectionExtensions` to include logging and register `IFedexApiAuthenticatorService`.
- Streamlined service setup by removing unnecessary logging in various service extension classes.
- Updated `EasyKeys.Shipping.FuncTest` project file to include references to Amazon Rates and Shipment projects.
- Improved `ServiceProviderInstance` for easier Amazon service configuration in tests.
- Adjusted shipment date in `TestShipments` for testing scenarios.
- Added unit tests for `AmazonShippingRateProvider` and `AmazonShippingShipmentProvider` to validate functionality.
Updated project files for `EasyKeys.Shipping.Amazon.Abstractions`, `EasyKeys.Shipping.Amazon.Rates`, and `EasyKeys.Shipping.Amazon.Shipment` to include new NuGet package settings with descriptions and tags.

Significantly expanded README files to include build badges, library descriptions, installation instructions, prerequisites, detailed usage examples, dependency information, and contribution guidelines.
Changed the `next-version` from `4.3.0` to `5.0.0`, reflecting a major version increment for the upcoming release. The branch structure remains unchanged, with the `feature` branch configured to tag as `preview` and increment by `patch`, while `master` settings are retained.
Added checks to ensure the `labels` object and its first byte are not null, improving test robustness and data validation.
Eliminated references to `EasyKeys.Shipping.Abstractions.Models`
and `EasyKeys.Shipping.Amazon.Abstractions.DependencyInjection`
to streamline dependencies and improve code clarity.
@ucrengineer ucrengineer merged commit cbdece5 into master Dec 16, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant