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

[DL-82] Import Flow HS code #32

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

sebastiandl
Copy link
Collaborator

@sebastiandl sebastiandl commented Mar 22, 2021

What problem is the code solving?

The HS code handled by flow is different from the HS code we are currently handling for Fulfil. Because of that we need to import from Flow the HS codes to eventually syncrhonize them with Fulfil since the we need to use them when printing Commercial Invoices for Flow Orders.

How does this change address the problem?

By adding the following changes:

  • NEW rake task spree_variant:import_flow_hs_code: This rake task calls the API endpoint to retrieve HS10 codes, and then extract the first 6 digits of each code and stores them within the flow_data information.

  • NEW rake task spree_variant:import_flow_hs_code_from_csv: This rake tasks updates HS6 codes based on a csv file. Flow allows us to create a CSV file from their console, which we can use to retrieve the HS6 codes directly. This is intended to be a backup method and is quite simple and straight forward.

  • Both rake tasks will call the Fulfill Flow Hs code sincronization before finishing in order to make sure to propagate the HS code properly.

Why is this the best solution?

This is not the best solution unfortunately, since in both scenarios we need to perform manual actions. The best approach would be to have a webhook configured, but we have suspicions that they are not working on Flow side.

On the other side, Flow is aware that we only need the HS6 code and they will be working on their side to provide us with such endpoint. In the meantime we should be fine with going with either of these options. Once we have the HS6 code endpoint ready we can update the spree_variant:import_flow_hs_code to use that endpoint instead.

Share the knowledge

Since the HS codes from Flow and Fulfil would be different, we have to handle them in separate places within Spree and Fulfil. In Spree we are going to be storing those Flow HS codes within the flow data information, while in Fulfil the Flow HS codes are going to be stored in the product's metadata. That synchronization with Fulfil is being handled in this PR https://github.com/mejuri-inc/mejuri-web/pull/889

@sebastiandl sebastiandl force-pushed the feature/dl-82-hs-code-handling branch from 11cd126 to 6c214d0 Compare March 22, 2021 13:37
@sebastiandl sebastiandl changed the base branch from main to develop March 22, 2021 13:49
@sebastiandl sebastiandl marked this pull request as ready for review March 25, 2021 16:33
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.

2 participants