Closed dvdl16 closed 1 week ago
See enqueue_at()
in rq
, and enqueue
in frappe/utils/background_jobs.py
Error log on:
WooCommerce Fusion: v1.5.1
Traceback with variables (most recent call last):
File "app.py", line 114, in application
response = api.handle(request)
request = <Request 'http://example.com/api/method/endpoint.order_created' [POST]>
response = None
rollback = True
e = AttributeError("'Settings' object has no attribute 'secret'")
File "api/__init__.py", line 49, in handle
data = endpoint(**arguments)
request = <Request 'http://example.com/api/method/endpoint.order_created' [POST]>
endpoint = <function handle_rpc_call at 0x1234567890>
arguments = {'method': 'endpoint.order_created'}
File "api/v1.py", line 36, in handle_rpc_call
return handler.handle()
method = 'endpoint.order_created'
handler = <module 'handler' from 'api/handler/__init__.py'>
File "handler.py", line 49, in handle
data = execute_cmd(cmd)
cmd = 'endpoint.order_created'
data = None
File "handler.py", line 85, in execute_cmd
return call(method, **form_dict)
cmd = 'endpoint.order_created'
from_async = False
server_script = None
method = <function order_created at 0x9876543210>
File "__init__.py", line 1768, in call
return fn(*args, **newargs)
fn = <function order_created at 0x9876543210>
args = ()
kwargs = {'id': 12345, 'parent_id': 0, 'status': 'processing', 'currency': 'USD', 'version': '1.0.0', 'prices_include_tax': True, 'date_created': '2024-06-23T08:02:15', 'date_modified': '2024-06-23T08:02:15', 'discount_total': '0.00', 'discount_tax': '0.00', 'shipping_total': '0.00', 'shipping_tax': '0.00', 'cart_tax': '123.45', 'total': '678.90', 'total_tax': '123.45', 'customer_id': 0, 'order_key': 'order_key', 'billing': {'first_name': 'John', 'last_name': 'Doe', 'company': '', 'address_1': '123 Main St', 'address_2': '', 'city': 'Anytown', 'state': 'CA', 'postcode': '12345', 'country': 'US', 'email': 'john.doe@example.com', 'phone': '1234567890'}, 'shipping': {'first_name': 'John', 'last_name': 'Doe', 'company': '', 'address_1': '123 Main St', 'address_2': '', 'city': 'Anytown', 'state': 'CA', 'postcode': '12345', 'country': 'US', 'phone': ''}, 'payment_method': 'cod', 'payment_method_title': 'Cash on delivery', 'transaction_id': '', 'customer_ip_address': '192.168.0.1', 'customer_user_agent': 'Mozilla/5.0'}
newargs = {'id': 12345, 'parent_id': 0, 'status': 'processing', 'currency': 'USD', 'version': '1.0.0', 'prices_include_tax': True, 'date_created': '2024-06-23T08:02:15', 'date_modified': '2024-06-23T08:02:15', 'discount_total': '0.00', 'discount_tax': '0.00', 'shipping_total': '0.00', 'shipping_tax': '0.00', 'cart_tax': '123.45', 'total': '678.90', 'total_tax': '123.45', 'customer_id': 0, 'order_key': 'order_key', 'billing': {'first_name': 'John', 'last_name': 'Doe', 'company': '', 'address_1': '123 Main St', 'address_2': '', 'city': 'Anytown', 'state': 'CA', 'postcode': '12345', 'country': 'US', 'email': 'john.doe@example.com', 'phone': '1234567890'}, 'shipping': {'first_name': 'John', 'last_name': 'Doe', 'company': '', 'address_1': '123 Main St', 'address_2': '', 'city': 'Anytown', 'state': 'CA', 'postcode': '12345', 'country': 'US', 'phone': ''}, 'payment_method': 'cod', 'payment_method_title': 'Cash on delivery', 'transaction_id': '', 'customer_ip_address': '192.168.0.1', 'customer_user_agent': 'Mozilla/5.0'}
File "utils/typing_validations.py", line 31, in wrapper
return func(*args, **kwargs)
args = ()
kwargs = {'id': 12345, 'parent_id': 0, 'status': 'processing', 'currency': 'USD', 'version': '1.0.0', 'prices_include_tax': True, 'date_created': '2024-06-23T08:02:15', 'date_modified': '2024-06-23T08:02:15', 'discount_total': '0.00', 'discount_tax': '0.00', 'shipping_total': '0.00', 'shipping_tax': '0.00', 'cart_tax': '123.45', 'total': '678.90', 'total_tax': '123.45', 'customer_id': 0, 'order_key': 'order_key', 'billing': {'first_name': 'John', 'last_name': 'Doe', 'company': '', 'address_1': '123 Main St', 'address_2': '', 'city': 'Anytown', 'state': 'CA', 'postcode': '12345', 'country': 'US', 'email': 'john.doe@example.com', 'phone': '1234567890'}, 'shipping': {'first_name': 'John', 'last_name': 'Doe', 'company': '', 'address_1': '123 Main St', 'address_2': '', 'city': 'Anytown', 'state': 'CA', 'postcode': '12345', 'country': 'US', 'phone': ''}, 'payment_method': 'cod', 'payment_method_title': 'Cash on delivery', 'transaction_id': '', 'customer_ip_address': '192.168.0.1', 'customer_user_agent': 'Mozilla/5.0'}
apply_condition = <function whitelist.<locals>.innerfn.<locals>.<lambda> at 0xabcdef123456>
func = <function order_created at 0xabcdef123456>
File "endpoint.py", line 35, in order_created
verify_request()
args = ()
kwargs = {'id': 12345, 'parent_id': 0, 'status': 'processing', 'currency': 'USD', 'version': '1.0.0', 'prices_include_tax': True, 'date_created': '2024-06-23T08:02:15', 'date_modified': '2024-06-23T08:02:15', 'discount_total': '0.00', 'discount_tax': '0.00', 'shipping_total': '0.00', 'shipping_tax': '0.00', 'cart_tax': '123.45', 'total': '678.90', 'total_tax': '123.45', 'customer_id': 0, 'order_key': 'order_key', 'billing': {'first_name': 'John', 'last_name': 'Doe', 'company': '', 'address_1': '123 Main St', 'address_2': '', 'city': 'Anytown', 'state': 'CA', 'postcode': '12345', 'country': 'US', 'email': 'john.doe@example.com', 'phone': '1234567890'}, 'shipping': {'first_name': 'John', 'last_name': 'Doe', 'company': '', 'address_1': '123 Main St', 'address_2': '', 'city': 'Anytown', 'state': 'CA', 'postcode': '12345', 'country': 'US', 'phone': ''}, 'payment_method': 'cod', 'payment_method_title': 'Cash on delivery', 'transaction_id': '', 'customer_ip_address': '192.168.0.1', 'customer_user_agent': 'Mozilla/5.0'}
File "endpoint.py", line 16, in verify_request
settings.secret.encode("utf8"), request.data, hashlib.sha256
settings = <Settings: Integration Settings>
builtins.AttributeError: 'Settings' object has no attribute 'secret'
When a webhook call is received, the order's status is pending. Changes to the order's status on WooCommerce may change directly after this (e.g. with card payments), so it's best to delay the sync with a few minutes so that the Sales Order is created with the correct status