|
|
|
@ -136,7 +136,7 @@ def submit_order_acknowledgement(path: str, schedule_shipped_date: str, ack_type
|
|
|
|
doc = frappe.get_doc("SPS Integration Settings", {"enabled":1})
|
|
|
|
doc = frappe.get_doc("SPS Integration Settings", {"enabled":1})
|
|
|
|
url = f"{doc.get_sales_order_url}/{path}"
|
|
|
|
url = f"{doc.get_sales_order_url}/{path}"
|
|
|
|
expires_on = get_datetime(doc.expires_on)
|
|
|
|
expires_on = get_datetime(doc.expires_on)
|
|
|
|
current_time = now_datetime()
|
|
|
|
current_time = now_datetime()
|
|
|
|
access_token = ""
|
|
|
|
access_token = ""
|
|
|
|
|
|
|
|
|
|
|
|
if expires_on <= current_time or (expires_on - current_time).total_seconds() <= 300:
|
|
|
|
if expires_on <= current_time or (expires_on - current_time).total_seconds() <= 300:
|
|
|
|
@ -157,10 +157,10 @@ def submit_order_acknowledgement(path: str, schedule_shipped_date: str, ack_type
|
|
|
|
formatted_data = format_sales_order_ack(response.json(),schedule_shipped_date, ack_type)
|
|
|
|
formatted_data = format_sales_order_ack(response.json(),schedule_shipped_date, ack_type)
|
|
|
|
frappe.log_error(title="Formatted SO Ack Payload", message=f"{formatted_data}")
|
|
|
|
frappe.log_error(title="Formatted SO Ack Payload", message=f"{formatted_data}")
|
|
|
|
# Sales order ack functionality
|
|
|
|
# Sales order ack functionality
|
|
|
|
ack_response = sales_order_acknowledgement(data=formatted_data,path=path)
|
|
|
|
# ack_response = sales_order_acknowledgement(data=formatted_data,path=path)
|
|
|
|
# ack_response = {
|
|
|
|
ack_response = {
|
|
|
|
# "path":"/in/ACK_a86e370c-43b9-3db1-b6bd-6289a132448f}-d76e3c43e0024359960669e9855509ce.dat",
|
|
|
|
"path":"/in/ACK_a86e370c-43b9-3db1-b6bd-6289a132448f}-d76e3c43e0024359960669e9855509ce.dat",
|
|
|
|
# "url":"https://api.spscommerce.com/transactions/v5/data/in/ACK_a86e370c-43b9-3db1-b6bd-6289a132448f}-d76e3c43e0024359960669e9855509ce.dat"}
|
|
|
|
"url":"https://api.spscommerce.com/transactions/v5/data/in/ACK_a86e370c-43b9-3db1-b6bd-6289a132448f}-d76e3c43e0024359960669e9855509ce.dat"}
|
|
|
|
if ack_response:
|
|
|
|
if ack_response:
|
|
|
|
ack_path = ack_response.get("path")
|
|
|
|
ack_path = ack_response.get("path")
|
|
|
|
if frappe.db.exists("Sales Order", {"name": sales_order, "docstatus": 1}):
|
|
|
|
if frappe.db.exists("Sales Order", {"name": sales_order, "docstatus": 1}):
|
|
|
|
@ -173,4 +173,5 @@ def submit_order_acknowledgement(path: str, schedule_shipped_date: str, ack_type
|
|
|
|
frappe.log_error(title="Payload for Ord ACK error",message=f"{response.json()}")
|
|
|
|
frappe.log_error(title="Payload for Ord ACK error",message=f"{response.json()}")
|
|
|
|
frappe.log_error(title="Testing functionality order ack", message=f"Order Ack Required Stuff: {path}\\n{schedule_shipped_date}\\n{ack_type}")
|
|
|
|
frappe.log_error(title="Testing functionality order ack", message=f"Order Ack Required Stuff: {path}\\n{schedule_shipped_date}\\n{ack_type}")
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
frappe.log_error(title="Error while ack the order through button", message=f"{str(e)}")
|
|
|
|
# frappe.log_error(title="Error while ack the order through button", message=f"{str(e)}")
|
|
|
|
|
|
|
|
frappe.log_error(title="Error while ack the order through button", message=str(frappe.get_traceback()))
|