Enhance Shipping Method Management with Carrier Accounts and Broker Configuration#36
Open
JustShah wants to merge 7 commits into
Open
Enhance Shipping Method Management with Carrier Accounts and Broker Configuration#36JustShah wants to merge 7 commits into
JustShah wants to merge 7 commits into
Conversation
Added new columns for broker and carrier ID to the shipping methods table. This schema change supports the new functionality for managing brokers and carrier accounts within shipping methods.
Introduced a broker enum to the shipping method model to differentiate between different brokers (e.g., none, EasyPost). This allows for more flexible and clear handling of shipping methods based on the broker used.
Added a new field for selecting the broker in the admin shipping method form. This enables administrators to specify the broker for each shipping method, improving the configuration and management of shipping methods. Created a partial view for the broker field in the admin shipping method form. This modular approach improves code maintainability and allows for easier updates to the broker field in the future. Removed redundant fields from the admin shipping method form to streamline the user interface and reduce clutter. This makes the form easier to use and prevents confusion.
Added a method to retrieve carrier accounts from shipping methods in the shipment decorator. This is necessary to ensure that the correct carrier accounts are used when creating shipments with EasyPost.
Modified the estimator to pass carrier accounts when creating shipments with EasyPost. This ensures that the correct carrier accounts are used, improving the accuracy and reliability of shipment creation. Added a check to ensure that the shipping method is both present and available to users before proceeding in the estimator. This prevents errors and ensures that only valid shipping methods are considered.
Refactored the `ShippingMethodSelector` to use `find_by` instead of `find_or_create_by` for locating shipping methods based on carrier, service level, and carrier ID. This change ensures that only existing shipping methods are retrieved without creating new ones.
- Modified the shipment decorator to conditionally create pickup details only if 'pickup_day' is present in customer metadata. - Updated the order's customer metadata to include pickup details only if they are present.
Author
Tested Scenarios1) Service Level Not Present:
2) Carrier ID Mismatch:
3) Rate Methods Discrepancy:
In our database, we only have USPS Express and USPS Priority in shipping methods. We will not create a new shipping method for USPS GroundAdvantage. 4) No Matching Shipping Method:
5) Invalid Carrier ID:
6) Unavailable Shipping Methods:
7) Available Shipping Methods:
8) Partial Match on Carrier Name:
9) No Match on Carrier Name:
Please review all the scenarios. Let me know if I missed any or if you would like to add any others. |
|
Look good! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This PR introduces several enhancements to the shipping method management system, focusing on integrating carrier accounts and broker configurations. The changes aim to improve the accuracy, reliability, and flexibility of shipping method handling within the application.
Changes:
Update ShippingMethodSelector to find shipping methods by carrier ID:
ShippingMethodSelectorto usefind_byinstead offind_or_create_byfor locating shipping methods based on carrier, service level, and carrier ID. This ensures that only existing shipping methods are retrieved without creating new ones.Update estimator to include carrier accounts in shipment creation:
Add carrier accounts method to shipment decorator:
Add broker configuration fields to admin shipping method form:
Add broker enum to shipping method decorator:
Add broker and carrier ID columns to shipping methods table:
Impact:
These changes enhance the shipping method management system by integrating carrier accounts and broker configurations, leading to more accurate and reliable shipment handling. The improvements to the admin interface also make it easier for administrators to manage shipping methods effectively.