-
Notifications
You must be signed in to change notification settings - Fork 3
Add Freightcom Rest shipping integration plugin #4
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
Open
jacobshilitz
wants to merge
22
commits into
karrioapi:main
Choose a base branch
from
jacobshilitz:freightcom
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
43cc493 to
facb4b6
Compare
This commit introduces a new Karrio plugin for Freightcom Rest API, including mappers, schemas, and provider implementations for rate, shipment, and cancellation functionalities. It also adds support for Freightcom-specific settings, utilities, and unit mappings to enable seamless integration and plugin registration.
- Add package-data configuration to ensure metadata.json is included when the package is built and installed - This fixes the missing file error during package installation
- Add failsafe handling for empty responses to prevent errors in shipment ID extraction. - Ensure deserialization fallback to empty JSON if response is missing.
… Freightcom shipment creation - Set duty tax recipient type to "receiver" as required by the API. - Adjust commodity value calculation to ensure formatting meets API expectations.
- Map duty paid_by field to API-compatible recipient type with a fallback to "receiver".
- Update error message construction to include details or data values if available, improving clarity in error responses.
…ling - Refactor error message construction to format details and data values more clearly, enhancing the readability of error responses.
… documents - Add fields for customs data, product composition, and paperless customs documentation. - Align schemas with Freightcom API Version 2.6.2 changes.
…ent requests - Introduce checks for Canadian to US shipments to ensure proper customs processing. - Update conditions to include packaging type validation for customs commodities in both rate and shipment request functions.
…ipments - Refactor customs data construction to improve clarity and maintainability. - Ensure proper inclusion of product details while maintaining existing functionality for customs processing.
- Simplify conditions for CA to US shipments by removing unnecessary `is_package_or_courierpak` validation. - Ensure customs commodity checks are streamlined for both rate and shipment requests.
- Introduce logic for handling Delivered Duty Paid (DDP) shipments, including determining appropriate payment methods. - Add support for selecting customs and duties payment method, with built-in caching for efficiency. - Ensure accurate mapping of tax recipients and guarantee customs charges for DDP shipments.
- Add level parameter to error messages (defaults to 'error') - Add _get_level() helper function - Freightcom API v2 does not provide level field, so defaults to 'error' - Required for upstream sync with karrio-community (commit 1a1b158)
6f3088b to
655d2fe
Compare
Add guaranteed rate flag to rate metadata in Freightcom API v2 integration. Extracts is_rate_guaranteed from customs_charge_data and stores it in rate meta dict.
- Add USMCA detection for US, CA, MX routes (bidirectional) - Add use_usmca option to control USMCA handling (defaults to true) - Set cusma_included=True for USMCA-eligible shipments - Add usmca_number option for certification number - Implement PDF document upload via paperless_customs_documents - Fix customs_and_duties_payment_method_id for all DDP shipments - Support non_auto_parts option for products
5a3354f to
9411a40
Compare
Extract is_rate_guaranteed from shipment.rate.customs_charge_data and include it in shipment meta to indicate if customs charges are guaranteed.
831a541 to
e29cccd
Compare
- Add carrier-specific freightcom_doc_files option to avoid conflicts with FedEx - FedEx requires documentId (pre-uploaded) while Freightcom accepts base64 directly - Prevents SHIPMENTS.DOCUMENTID.INVALID errors when rate shopping across carriers - Maintains backward compatibility with doc_files fallback - See GitLab issue karrioapi#11 for migration details
- Simplified commodities selection logic - Removed complex nested conditionals - Aligned product fields (product_name=item.title, description=item.description) - Added weight field to products - Simplified customs check (has_customs) - Updated both rate and shipment to use consistent pattern - Simplified filter condition to only check item.hs_code - Added is_usmca_eligible helper function for customs handling
…G/CM) Freightcom REST expects imperial units and converts/rounds them. By sending metric units, Karrio was converting to metric, then Freightcom was converting back to imperial and rounding, causing double conversion and rounding errors. Changed all weight and dimension units from metric (KG/CM) to imperial (LB/IN) in both rate and shipment requests to match Freightcom REST's expectations.
Changed from checking hasattr() and state is not None to using 'in' operator to properly detect if the option was actually provided in the options dict. Also changed default from True to False when option is not provided. The hasattr() check was always True due to __getattr__, so it didn't properly detect when the option was missing. Using 'in options' correctly checks if the option exists in the internal options dict.
…t ProductType The Freightcom API v2 rate request schema does not include product_name or weight fields in the ProductType (only shipment request has these fields). This bug was introduced in commit f75bd38 when these fields were incorrectly added to the rate request. Also fixed freightcom_non_auto_parts option check to use 'in' operator instead of hasattr() for consistency with other option checks. Fixes error when creating rate requests with customs data.
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.
This commit introduces a new Karrio plugin for Freightcom Rest API, including mappers, schemas, and provider implementations for rate, shipment, and cancellation functionalities. It also adds support for Freightcom-specific settings, utilities, and unit mappings to enable seamless integration and plugin registration.