-
-
Notifications
You must be signed in to change notification settings - Fork 122
WIP Freightcom new REST API #766
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
base: main
Are you sure you want to change the base?
Conversation
@danh91 can you review and let me know thought and adjustments? |
Hi @jacobshilitz, I will be able to review it today. |
kind reminder |
This commit introduces an `api_key` field to Freightcom settings models and mappers, allowing the configuration of an API key. It includes model migration, data handling updates, and ensures compatibility for future API key usage.
Deleted various Freightcom-related sample XML and XSD files, along with outdated vendor documentation, from the repository. These files were no longer required and their removal helps clean up the project.
Introduced `rate_request`, `rate_response`, and `error_response` JSON schemas for Freightcom. Replaced `generateDS` with a `quicktype`-based approach for generating Python bindings. Enhanced test fixtures to include new `api_key` configuration.
Replaces the quote script with a more standardized and modular rate API integration. Introduced new schemas, utilities, and data mappings to streamline rate requests and responses. Updated shipping logic to align with the new structure.
c109251
to
2cb671b
Compare
This migration removes the `username` and `password` fields from Freightcom settings across models, fixtures, and settings definitions. The changes streamline authentication to rely solely on `api_key`. Relevant tests and configurations have been updated accordingly.
I setup for now it should require the manual input of payment id in the settings, is there anyway we can populate a dropdown, the problem is that it need to save the api key first only then you can authenticate? i'll look if they have a place in the interface to get the payment ids |
Streamlined the retrieval and configuration of payment methods by introducing dynamic fetching based on account settings and payment method type. Removed hardcoded payment IDs and legacy unused logic, replacing them with a cache-based mechanism to improve flexibility and maintainability.
Dear Freightcom API Customer, Please note that the legacy version of the Freightcom API will no longer be supported as of March 31st, 2025. We request that you begin the process of switching to the most recent and updated Freightcom API, which has been available for the last 18 months. With the new Freightcom API you gain access to more functionality, faster response times, superior uptime, all while future proofing your integration for upcoming feature and service releases. |
Renamed and standardized function names (e.g., `create_shipment_request` to `shipment_request`) for consistency and readability. Adjusted response handling and removed unused/commented-out code to improve maintainability. Minor cleanup in formatting and imports to streamline the codebase.
it was pulling None after we have a function without underscore
@danh91 got a chance to review? |
Hi @minchaminder , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a couple of comments to help with some changes recommendation.
Let me know if you have a question particularly related to passing the payment_method_id
around
modules/core/karrio/server/providers/extension/models/freightcom.py
Outdated
Show resolved
Hide resolved
modules/core/karrio/server/providers/migrations/0081_freightcomsettings_api_key.py
Outdated
Show resolved
Hide resolved
.../core/karrio/server/providers/migrations/0082_remove_freightcomsettings_password_and_more.py
Outdated
Show resolved
Hide resolved
modules/connectors/freightcom/karrio/providers/freightcom/utils.py
Outdated
Show resolved
Hide resolved
modules/connectors/freightcom/karrio/providers/freightcom/utils.py
Outdated
Show resolved
Hide resolved
modules/connectors/freightcom/karrio/providers/freightcom/utils.py
Outdated
Show resolved
Hide resolved
Moved `PaymentMethodType` to improve organization and restructured its usage via `connection_config` for flexibility. Enhanced error handling and streamlined payment method selection logic for better reliability and clarity.
@jacobshilitz , |
Yes, I tried my best to implument the unit tests... |
I'm not sure how to set payment_method_type here. now that's it's a connection_config (maybe we should go back and have it as a normal setting) tracking is not working yet... its comlicated as ferightcom has its own tracking API, only the real tracking of the carrier |
Tracking is indeed tricky when dealing with hubs. Here is an example with EasyPost The general idea is that if they are already tracking the shipment, you want to retrieve the tracking information they have by using the shipment_id or any tracking ID that they returned when you created the label. |
The debug `print` statement was removed for cleaner code, and the Freightcom gateway configuration was updated to nest `payment_method_type` within a `config` dictionary. This ensures better consistency and structure in the gateway setup.
I'm bracking my head as freightcom is requiring the shipment_id that I store in |
You can store it in meta as 'freightcom_shipment_identifier' When the request for the Tracking is sent, the meta content gets added to tracking_request.options.freightcom_shipment_identifier So the trick is that you can add anything that you might need later that is specific to your integration inside meta when you are parsing shipment and rates responses |
one more thing how do I trigger a tracking fetch for the api? tests are not a real api call |
Using the API you can call the it like this: POST /v1/proxy/tracking?hub=freightcom When you create a shipment it will automatically append the hub to the tracking url |
I only get the canpar I added this is the body i post in the api:
|
for now lets put it to work with no tracking |
@danh91 freightcom legacy API has officially shutdown as of 03/31/2025 |
Freightcom announced they're migrating to a new REST API, their current xml api will be retiring in March
I've been working on implementing the new REST API for Freightcom. The changes and enhancements have been made in line with the API provided in the Freightcom developer documentation. Here's the link for your reference: Freightcom API documentation
Please note that this is still a draft and not the final version of the code. Posting so that you can review when you have a moment and share your thoughts.
The challenges I still face are: