Description
After the tracking is updated through the API the order is marked as shipped though does not move into “Shipped”
When I did:
We are using a local python script to post tracking numbers we receive from a vendors web-service.
Snippets used after retrieving tracking:
- Header Snippet:
ord_headers = {
'Authorization' : 'Basic REMOVED FOR FORM EXAMPLE=',
'Content-Type' : 'application/json'
}
ord_url = 'https://api.ordoro.com/'
ord_tag_id_await_tracking = '30068'
ord_tag_name_await_tracking = 'Awaiting Tracking'
ord_get_dropship_orders_params = {
'tag' : ord_tag_name_await_tracking
- Body Snippet
shipment_id = eachOrder['shipments'][0]['shipment_id']
r = requests.post(f"{ord_url}/shipment/{shipment_id}/tracking/", data=json.dumps(data), headers=ord_headers)
log(f"[{PONumber}] Response from ordoro:\n\r{r.content.decode('UTF-8')}")
log(f"[{PONumber}] Removing 'Awaiting Tracking' tag...")
I expected:
On the web app after a tracking number is input and saved the order is marked as shipped and moved to the Shipped tab.
I would expect that after adding the tracking the order would move to shipped.
What actually happened:
We don’t get any error the order just sitting in Dropship Requested marked as “Marked As Shipped”
Request Details
import requests
import json
import datetime
import xml.etree.ElementTree as ET
log_file = f"LOG-{datetime.datetime.now().strftime('%Y%m%d-%H%M%S')}.txt"
taw_u = 'REMOVED FOR EXAMPLE'
taw_p = 'REMOVED FOR EXAMPLE'
taw_url = 'http://ws.tapww.com/Services.asmx'
taw_headers = {
'Content-Type' : 'application/x-www-form-urlencoded',
}
ord_headers = {
'Authorization' : 'Basic REMOVED FOR EXAMPLE=',
'Content-Type' : 'application/json'
}
ord_url = 'https://api.ordoro.com/'
ord_tag_id_await_tracking = '30068'
ord_tag_name_await_tracking = 'Awaiting Tracking'
ord_get_dropship_orders_params = {
'tag' : ord_tag_name_await_tracking
}
def log(str):
print(str, flush=True)
with open(log_file, 'a') as file:
file.write(f"{str}\n\r")
### GET ALL AWAITING TRACKING ORDERS FROM ORDORO ###
log("Requesting all orders with 'Awaiting Tracking' from ordoro...")
r = requests.get(f"{ord_url}/order/", params=ord_get_dropship_orders_params, headers=ord_headers)
robj = json.loads(r.content)
ord_orders = robj['order']
log(f"Found {len(ord_orders)} to process.")
for eachOrder in ord_orders:
PONumber = eachOrder['order_id']
taw_order_id = ''
log(f"\n\r---- {PONumber} ----")
# LOOP THROUGH ORDER COMMENTS TO FIND THE ORDER NUMBER RETURNED BY TAW
for eachComment in eachOrder['comments']:
if("TAW_ORD_ID" in eachComment['text']):
taw_order_id = eachComment['text'].split(':')[1]
log(f"[{PONumber}] TAW order id {taw_order_id}")
log(f"[{PONumber}] Requesting tracking info from TAW...")
# ASK FOR TRACKING INFO FROM TAW
r = requests.post(f"{taw_url}/GetTrackingInfo", data=f"UserID={taw_u}&Password={taw_p}&OrderNumber={taw_order_id}&PONumber={PONumber}", headers=taw_headers)
log(f"[{PONumber}] Response from TAW:\n\r{r.content.decode('UTF-8')}")
try:
# PARSE TRACKING INFO FROM TAW RESPONSE
root = ET.ElementTree(ET.fromstring(r.content)).getroot()
record = root.find('Record')
log(f"[{PONumber}] Tracking info found! Parsing...")
data = {}
data['ship_date'] = record.find('ShipDate').text
log(f"[{PONumber}] Ship date: {data['ship_date']}")
data['tracking'] = {}
data['tracking']['tracking'] = record.find('TrackNum').text.strip()
log(f"[{PONumber}] Tracking number: {data['tracking']['tracking']}")
# IF NO TRACKING NUMBER, LOG IT AND GO ON TO THE NEXT ONE
if (data['tracking']['tracking'] == ""):
log(f"[{PONumber}] No tracking number found. Skipping.")
continue
data['tracking']['vendor'] = record.find('Type').text.strip()
# IF NO VENDOR, LOG IT AND GO ON TO THE NEXT ONE
if (data['tracking']['vendor'] == ""):
log(f"[{PONumber}] No vendor found. Skipping.")
continue
log(f"[{PONumber}] Vendor: {data['tracking']['vendor']}")
log(f"[{PONumber}] Sending to ordoro...")
# SEND TRACKING INFO TO ORDORO
shipment_id = eachOrder['shipments'][0]['shipment_id']
r = requests.post(f"{ord_url}/shipment/{shipment_id}/tracking/", data=json.dumps(data), headers=ord_headers)
log(f"[{PONumber}] Response from ordoro:\n\r{r.content.decode('UTF-8')}")
log(f"[{PONumber}] Removing 'Awaiting Tracking' tag...")
# DELETE AWAITING TRACKING TAG FROM ORDER
r = requests.delete(f"{ord_url}/order/{PONumber}/tag/{ord_tag_id_await_tracking}/", headers=ord_headers)
log(f"[{PONumber}] Response from ordoro:\n\r{r.content.decode('UTF-8')}")
except Exception as err:
log(f"[{PONumber}] Error parsing tracking info...\n\rException:\n\r{err}\n\rLast Response:\n\r{r.content.decode('UTF-8')}")
log(f"[{PONumber}] Finished.")
Response Details
{
"_link": "/order/M-TEST-001-2/",
"status": "shipped",
"order_date": "2019-07-30T19:10:37+00:00",
"company_id": 570270,
"cart_order_id": "",
"cart_shipment_id": "",
"order_id": "M-TEST-001-2",
"shipping_type": "",
"additional_cart_info": {},
"notes_from_customer": "",
"credit_card_issuer": null,
"product_amount": 0,
"shipping_amount": 0,
"tax_amount": 0,
"discount_amount": 0,
"grand_total": 0,
"is_order_parent": false,
"created": "2019-07-31T00:37:42.263198+00:00",
"updated": "2019-08-01T00:22:04.538239+00:00",
"obscured_date": null,
"id": 4032812686,
"cart": 101476,
"cart_name": "Manual",
"shipping_address": {
"_link": "/address/8114118077/",
"company": "JAY CO TSS",
"street1": "REMOVED FOR FORM EXAMPLE",
"street2": "REMOVED FOR FORM EXAMPLE",
"zip": "REMOVED FOR FORM EXAMPLE",
"id": 8114118077,
"name": "REMOVED FOR FORM EXAMPLE",
"city": "REMOVED FOR FORM EXAMPLE",
"state": "CA",
"country": "US",
"email": "REMOVED FOR FORM EXAMPLE",
"phone": "REMOVED FOR FORM EXAMPLE",
"fax": "",
"reference_number": "",
"cart_address_id": "",
"validation": {
"suggested": [],
"is_error": false,
"additional_text": null
}
},
"billing_address": {
"_link": "/address/8114118078/",
"company": "JAY CO TSS",
"street1": "REMOVED FOR FORM EXAMPLE",
"street2": "REMOVED FOR FORM EXAMPLE",
"zip": "REMOVED FOR FORM EXAMPLE",
"id": 8114118078,
"name": "REMOVED FOR FORM EXAMPLE",
"city": "REMOVED FOR FORM EXAMPLE",
"state": "REMOVED FOR FORM EXAMPLE",
"country": "REMOVED FOR FORM EXAMPLE",
"email": "REMOVED FOR FORM EXAMPLE",
"phone": "REMOVED FOR FORM EXAMPLE",
"fax": "",
"reference_number": "",
"cart_address_id": "",
"validation": {
"suggested": [],
"is_error": false,
"additional_text": null
}
},
"shipments": [
{
"_link": "/shipment/M-TEST-001-2-1/",
"status": "shipped",
"company_id": 570270,
"order_id": "M-TEST-001-2",
"added_by_id": 58906,
"assigned_to_id": 62700,
"shipment_id": "M-TEST-001-2-1",
"shipped": true,
"ship_date": "2019-07-31T00:00:00+00:00",
"created": "2019-07-31T00:37:42.416156+00:00",
"updated": "2019-08-01T00:22:04.488357+00:00",
"exported": null,
"barcode": "156453346241965",
"cart_notified_on": null,
"notify_cart": false,
"notify_cart_success": null,
"credit_card_issuer": null,
"product_amount": 0,
"shipping_amount": 0,
"tax_amount": 0,
"discount_amount": 0,
"grand_total": 0,
"cart_vendor": "manual",
"notes_from_customer": "",
"cart": 101476,
"order_date": "2019-07-30T19:10:37+00:00",
"requested_shipping_method": "",
"cart_order_id": "",
"additional_cart_info": {},
"ship_to": {
"_link": "/address/8114118091/",
"company": "REMOVED FOR FORM EXAMPLE",
"street1": "REMOVED FOR FORM EXAMPLE",
"street2": "REMOVED FOR FORM EXAMPLE",
"zip": "92806",
"id": 8114118091,
"name": "REMOVED FOR FORM EXAMPLE",
"city": "REMOVED FOR FORM EXAMPLE",
"state": "CA",
"country": "US",
"email": "REMOVED FOR FORM EXAMPLE",
"phone": "REMOVED FOR FORM EXAMPLE",
"fax": "",
"reference_number": "",
"cart_address_id": "",
"validation": {
"is_error": false,
"suggested": [],
"additional_text": null
}
},
"dropship_info": {
"send_to_dropshipper_history": [],
"get_tracking_from_dropshipper_history": [],
"id": 7716927272,
"shipment_id": 24678603,
"dropshipper_id": 44251,
"shipping_method": "",
"instructions": "",
"show_price": false,
"send_to_dropshipper": false,
"send_to_dropshipper_success": null,
"get_tracking_from_dropshipper": false,
"get_tracking_from_dropshipper_success": null,
"created": "2019-07-31T00:37:42.499128+00:00",
"updated": "2019-07-31T00:37:42.516057+00:00",
"company": "(Dropship) - Transamerican Wholesale LLC.",
"street1": "",
"street2": "",
"zip": "",
"name": null,
"city": "",
"state": "",
"country": "",
"email": "REMOVED FOR FORM EXAMPLE",
"phone": "",
"fax": "",
"reference_number": "",
"cart_address_id": null,
"validation": {
"suggested": [],
"is_error": false,
"additional_text": null
}
},
"billing_address": {
"company": "JAY CO TSS",
"street1": "REMOVED FOR FORM EXAMPLE",
"street2": "STE B",
"zip": "92806",
"id": 8114118092,
"name": "REMOVED FOR FORM EXAMPLE",
"city": "REMOVED FOR FORM EXAMPLE",
"state": "REMOVED FOR FORM EXAMPLE",
"country": "REMOVED FOR FORM EXAMPLE",
"email": "REMOVED FOR FORM EXAMPLE",
"phone": "REMOVED FOR FORM EXAMPLE",
"fax": "",
"reference_number": "",
"cart_address_id": "",
"validation": {
"is_error": false,
"suggested": [],
"additional_text": null
}
},
"ship_from": {
"company": "(Dropship) - Transamerican Wholesale LLC.",
"street1": "",
"street2": "",
"zip": "",
"id": 7716927272,
"name": null,
"city": "",
"state": "",
"country": "",
"email": "REMOVED FOR FORM EXAMPLE",
"phone": "",
"fax": "",
"reference_number": "",
"cart_address_id": null,
"validation": {
"suggested": [],
"is_error": false,
"additional_text": null
},
"dropshipper_id": 44251,
"dropshipper_shipping_method": "",
"dropshipper_requested_date": "2019-07-31T00:37:42.516057+00:00",
"dropshipper_instructions": "",
"dropshipper_show_price": false
},
"lines": [
{
"order_line_id": 49551687,
"id": 43153934,
"shipment_id": 24678603,
"item_price": 0,
"quantity": 1,
"total_price": 0,
"comment": "",
"cogs": 0,
"selected_option": "",
"supplier_price": 0,
"product": {
"type": null,
"cost": 0,
"id": 78245157,
"company_id": 570270,
"name": "TEST ITEM 4",
"sku": "TEST-S4",
"taxable": "",
"weight": 0,
"length": null,
"width": null,
"height": null,
"price": 0,
"customer_text": null,
"total_on_hand": 10,
"category": null,
"is_kit_parent": false,
"archive_date": null,
"created": "2019-06-24T19:28:10.678195+00:00",
"updated": "2019-07-31T22:09:16.375970+00:00",
"upc": "",
"asin": null,
"image_url": null,
"default_image_id": null,
"_link": "/product/TEST-S4/"
},
"product_name": "TEST ITEM 4",
"cart_order_id": "",
"cart_orderitem_id": "",
"cart_shipment_id": "",
"ordered_quantity": 1,
"_link": "/shipment/M-TEST-001-2-1/line/43153934/"
}
],
"assigned_to": {
"company": null,
"street1": "REMOVED FOR FORM EXAMPLE",
"street2": "REMOVED FOR FORM EXAMPLE",
"zip": "REMOVED FOR FORM EXAMPLE",
"id": 7683517388,
"name": "Jay Co LLC",
"city": "Anaheim",
"state": "CA",
"country": "US",
"email": "REMOVED FOR FORM EXAMPLE",
"phone": "REMOVED FOR FORM EXAMPLE",
"fax": null,
"reference_number": null,
"cart_address_id": null,
"validation": {
"suggested": [],
"is_error": false,
"additional_text": null
}
},
"audit_label": [],
"weight": 0,
"notify_cart_history": [],
"_linkgeneratelabel": "/shipment/M-TEST-001-2-1/label/generate/",
"_linkgeneratereturnlabel": "/shipment/M-TEST-001-2-1/return_label/generate/",
"_linklabelrate": "/shipment/M-TEST-001-2-1/label/rate/",
"_linkreturnlabelrate": "/shipment/M-TEST-001-2-1/return_label/rate/",
"comments": [],
"tags": [],
"shipment_presets": [],
"return_presets": [],
"tracking": {
"id": 24975362,
"company_id": 570270,
"shipper_id": null,
"package_tracking": null,
"tracking": "1Z7533E80317440349",
"shipping_method": "ground",
"display_shipping_method": "ground",
"package_type": null,
"params": {},
"void": false,
"cost": 14,
"estimated_delivery_date": null,
"print_date": null,
"created": "2019-08-01T00:22:04.471937+00:00",
"updated": "2019-08-01T00:22:04.472424+00:00",
"tracking_url": null,
"vendor": "ups",
"shipment_id": "M-TEST-001-2-1",
"_link": "/label/M-TEST-001-2-1/",
"_linkraw": null,
"_linkrawdocs": null,
"insurance": null
},
"return_tracking": {}
}
],
"tags": [
{
"id": 30068,
"text": "Awaiting Tracking",
"color": "#ff8900",
"_link": "/tag/order/30068/"
}
],
"lines": [
{
"_link": "/order/M-TEST-001-2/line/49551687/",
"product": {
"type": null,
"cost": 0,
"id": 78245157,
"company_id": 570270,
"name": "TEST ITEM 4",
"sku": "TEST-S4",
"taxable": "",
"weight": 0,
"length": null,
"width": null,
"height": null,
"price": 0,
"customer_text": null,
"total_on_hand": 10,
"category": null,
"is_kit_parent": false,
"archive_date": null,
"created": "2019-06-24T19:28:10.678195+00:00",
"updated": "2019-07-31T22:09:16.375970+00:00",
"upc": "",
"asin": null,
"image_url": null,
"default_image_id": null,
"_link": "/product/TEST-S4/"
},
"order_line_id": 49551687,
"cart_order_id": "",
"cart_orderitem_id": "",
"cart_shipment_id": "",
"product_name": "TEST ITEM 4",
"product_cost": 0,
"product_supplier_id": 44251,
"quantity": 1,
"item_price": 0,
"total_price": 0,
"selected_option": "",
"tax_lines": [],
"shippability": {
"is_dropship": true,
"supplier_id": 44251,
"num_ordered": 1,
"num_shipped": 1,
"num_shippable": 0,
"on_hand": 0,
"shippability": "shipped",
"track_inventory": true
}
}
],
"comments": [
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-08-01T00:22:04.545344+00:00",
"text": "Marked shipment as shipped, and recalculated order status"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-08-01T00:22:04.483544+00:00",
"text": "Added tracking number 1Z7533E80317440349"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-08-01T00:19:39.004755+00:00",
"text": "Order modified:\n- Added tag \"Awaiting Tracking\" (id: 30068)"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-08-01T00:19:34.225981+00:00",
"text": "Order modified:\n- Removed tag \"Dropship Ready\" (id: 30093)"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T23:52:08.961261+00:00",
"text": "Order modified:\n- Added tag \"Dropship Ready\" (id: 30093)"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T23:51:05.734172+00:00",
"text": "Deleted ground UPS® shipping label, tracking number 1Z7533E80317440349"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T23:51:05.728452+00:00",
"text": "Marked shipment as unshipped, and recalculated order status"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:33:16.630172+00:00",
"text": "Order modified:\n- Removed tag \"Awaiting Tracking\" (id: 30068)"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:33:13.850364+00:00",
"text": "Marked shipment as shipped, and recalculated order status"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:33:13.792662+00:00",
"text": "Added tracking number 1Z7533E80317440349"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:33:04.543411+00:00",
"text": "Deleted ground UPS® shipping label, tracking number 1Z7533E80317440349"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:33:04.537017+00:00",
"text": "Marked shipment as unshipped, and recalculated order status"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:32:50.664548+00:00",
"text": "Order modified:\n- Added tag \"Awaiting Tracking\" (id: 30068)"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:31:05.196240+00:00",
"text": "Order modified:\n- Removed tag \"Awaiting Tracking\" (id: 30068)"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:30:59.682189+00:00",
"text": "Marked shipment as shipped, and recalculated order status"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:30:59.629915+00:00",
"text": "Added tracking number 1Z7533E80317440349"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:30:00.128293+00:00",
"text": "Order modified:\n- Added tag \"Awaiting Tracking\" (id: 30068)"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:29:53.342388+00:00",
"text": "Deleted ground UPS® shipping label, tracking number 1Z7533E80317440349"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:29:53.335189+00:00",
"text": "Marked shipment as unshipped, and recalculated order status"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:29:20.508291+00:00",
"text": "Order modified:\n- Removed tag \"Awaiting Tracking\" (id: 30068)"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:29:19.684924+00:00",
"text": "Marked shipment as shipped, and recalculated order status"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:29:19.628653+00:00",
"text": "Added tracking number 1Z7533E80317440349"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T22:27:30.145738+00:00",
"text": "Deleted None UPS® shipping label, tracking number 1Z7533E80317440349"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-31T00:37:44.169048+00:00",
"text": "Batch processing: Dropshipment request sent to Transamerican Wholesale LLC. <REMOVED FOR FORM EXAMPLE>"
},
{
"user": "task@ordoro.com",
"date": "2019-07-30T19:12:33.102050+00:00",
"text": "Updated address with data: validate=False, validation={'is_error': False, 'additional_text': None, 'suggested': [{'is_commercial': True, 'street1': 'REMOVED FOR FORM EXAMPLE', 'street2': '', 'city': 'REMOVED FOR FORM EXAMPLE', 'state': 'REMOVED FOR FORM EXAMPLE', 'zip': 'REMOVED FOR FORM EXAMPLE', 'country_code': 'REMOVED FOR FORM EXAMPLE'}]}"
},
{
"user": "REMOVED FOR FORM EXAMPLE",
"date": "2019-07-30T19:12:31+00:00",
"text": "Manual order created"
}
],
"shippability": "shipped",
"parent_order_number": "M-TEST-001",
"child_order_numbers": []
}
Body
Will update when possible
Request ID
Will update when possible