Skip to content

Commit 69321b2

Browse files
committed
Add update_tracking
1 parent 23516d0 commit 69321b2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

shopify/resources/fulfillment.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from ..base import ShopifyResource
2+
import json
23

34

45
class Fulfillment(ShopifyResource):
@@ -13,6 +14,24 @@ def complete(self):
1314
def open(self):
1415
self._load_attributes_from_response(self.post("open"))
1516

17+
def update_tracking(self, tracking_info, notify_customer):
18+
fulfill = FulfillmentV2()
19+
fulfill.id = self.id
20+
fulfill.update_tracking(tracking_info, notify_customer)
21+
1622

1723
class FulfillmentOrders(ShopifyResource):
1824
_prefix_source = "/orders/$order_id/"
25+
26+
class FulfillmentV2(ShopifyResource):
27+
_singular = 'fulfillment'
28+
_plural = 'fulfillments'
29+
30+
def update_tracking(self, tracking_info, notify_customer):
31+
body = {
32+
"fulfillment": {
33+
"tracking_info": tracking_info,
34+
"notify_customer": notify_customer
35+
}
36+
}
37+
self._load_attributes_from_response(self.post("update_tracking", json.dumps(body).encode()))

0 commit comments

Comments
 (0)