-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
[BOL-10] Order Tracking Service #97
Conversation
a129801
to
12f861e
Compare
32f4960
to
2b6591c
Compare
base.class_eval do | ||
before_save :update_bolt_tracking_info | ||
end |
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.
Why you have used
base.class_eval do
before_save :update_bolt_tracking_info
end
rather than base.before_save :update_bolt_tracking_info
?
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.
Modified here 4644cca
end | ||
|
||
def update_bolt_tracking_info | ||
return unless tracking_was.nil? |
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 think that return if tracking_was
is more readable
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.
Modified here 4644cca
transaction_reference = payment&.response_code | ||
return if transaction_reference.blank? | ||
|
||
SolidusBolt::ShipmentTrackingJob.perform_later(transaction_reference: transaction_reference, shipment: self) |
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.
What will happen if the order contains more than one shipment?
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'm not sure yet if Bolt supports multiple shipments like Solidus.
Nothing in the bolt docs points to supporting multiple shipments and also this API returns an error if we have already added one instance of tracking details to the Order on Bolt.
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 think we should ask the Bolt team how they would like to handle that part. I don't want to return an error anytime that a user marks the second shipment as shipped.
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.
Sure
transaction_reference: transaction_reference, | ||
tracking_number: shipment.tracking, | ||
carrier: shipment.shipping_method.name, | ||
items: order.bolt_items, |
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.
This is not right, the shipped items should be the items in the shipment, not the items in the order.
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.
Moved this to the shipment_decorator
.
This commit adds the order tracking service for Bolt API. This service calls the bolt order_tracking endpoint with updated data for Order Tracking. Refer: https://help.bolt.com/api-bolt/#tag/Orders/operation/trackOrder
36bc3a4
to
e432ca5
Compare
This commit adds a ShipmentTrackingJob that calls the ShipmentTracking Service. This was necessary because the check for the update on the tracking number is called before_save and calling the service at this point would cause a lot of delay for the API to execute. Hence, the service is called asynchronously from this point in the code.
e432ca5
to
d4dba27
Compare
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.
Solidus should invoke Order Tracking API multiple times for the same transaction reference, but different items and different tracking information base on shipments information.
This issue has been automatically marked as stale because it has not had recent activity. It might be closed if no further activity occurs. Thank you for your contributions. |
This PR adds the order tracking service for Bolt API and also syncs the tracking data on both Bolt and Solidus.
Refer: https://help.bolt.com/api-bolt/#tag/Orders/operation/trackOrder