stupid typo
This commit is contained in:
1 parent
4320b4cba9
commit
57a5afbe48
2 files changed
+12
-9
No files matched your search
+6
-6
@@ -23,7 +23,7 @@ time = int(time())
|
||||
import asquare as sq
|
||||
|
||||
# Square SDK webhook validation
|
||||
from square.utilities.webhooks_helper import is_valid_webhook_event_signature
|
||||
from square.utils.webhooks_helper import verify_signature
|
||||
|
||||
# from asquareclass import AsyncSquareClient # type: ignore
|
||||
from abricksetapi import AsyncBricksetAPI
|
||||
@@ -121,11 +121,11 @@ async def hook_handler(request: web.Request) -> web.Response:
|
||||
return web.Response(status=401, text="Unauthorized: Missing signature")
|
||||
|
||||
# Use Square SDK's official validation function
|
||||
is_valid = is_valid_webhook_event_signature(
|
||||
body_str,
|
||||
signature_header,
|
||||
SQUARE_WEBHOOK_SIGNATURE_KEY,
|
||||
SQUARE_WEBHOOK_URL,
|
||||
is_valid = verify_signature(
|
||||
request_body=body_str,
|
||||
signature_header=signature_header,
|
||||
signature_key=SQUARE_WEBHOOK_SIGNATURE_KEY,
|
||||
notification_url=SQUARE_WEBHOOK_URL,
|
||||
)
|
||||
|
||||
if not is_valid:
|
||||
|
||||
@@ -9,7 +9,7 @@ import sys
|
||||
|
||||
sys.path.insert(0, "src")
|
||||
|
||||
from square.utilities.webhooks_helper import is_valid_webhook_event_signature
|
||||
from square.utils.webhooks_helper import verify_signature
|
||||
|
||||
# Test data from Square's documentation
|
||||
TEST_BODY = '{"hello":"world"}'
|
||||
@@ -29,8 +29,11 @@ def test_signature_validation():
|
||||
print()
|
||||
|
||||
# This should return True with Square's test data
|
||||
is_valid = is_valid_webhook_event_signature(
|
||||
TEST_BODY, TEST_SIGNATURE, TEST_SIGNATURE_KEY, TEST_NOTIFICATION_URL
|
||||
is_valid = verify_signature(
|
||||
request_body=TEST_BODY,
|
||||
signature_header=TEST_SIGNATURE,
|
||||
signature_key=TEST_SIGNATURE_KEY,
|
||||
notification_url=TEST_NOTIFICATION_URL,
|
||||
)
|
||||
|
||||
if is_valid:
|
||||
|
||||
Reference in new issue
Block a user