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
|
import asquare as sq
|
||||||
|
|
||||||
# Square SDK webhook validation
|
# 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 asquareclass import AsyncSquareClient # type: ignore
|
||||||
from abricksetapi import AsyncBricksetAPI
|
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")
|
return web.Response(status=401, text="Unauthorized: Missing signature")
|
||||||
|
|
||||||
# Use Square SDK's official validation function
|
# Use Square SDK's official validation function
|
||||||
is_valid = is_valid_webhook_event_signature(
|
is_valid = verify_signature(
|
||||||
body_str,
|
request_body=body_str,
|
||||||
signature_header,
|
signature_header=signature_header,
|
||||||
SQUARE_WEBHOOK_SIGNATURE_KEY,
|
signature_key=SQUARE_WEBHOOK_SIGNATURE_KEY,
|
||||||
SQUARE_WEBHOOK_URL,
|
notification_url=SQUARE_WEBHOOK_URL,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not is_valid:
|
if not is_valid:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import sys
|
|||||||
|
|
||||||
sys.path.insert(0, "src")
|
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 data from Square's documentation
|
||||||
TEST_BODY = '{"hello":"world"}'
|
TEST_BODY = '{"hello":"world"}'
|
||||||
@@ -29,8 +29,11 @@ def test_signature_validation():
|
|||||||
print()
|
print()
|
||||||
|
|
||||||
# This should return True with Square's test data
|
# This should return True with Square's test data
|
||||||
is_valid = is_valid_webhook_event_signature(
|
is_valid = verify_signature(
|
||||||
TEST_BODY, TEST_SIGNATURE, TEST_SIGNATURE_KEY, TEST_NOTIFICATION_URL
|
request_body=TEST_BODY,
|
||||||
|
signature_header=TEST_SIGNATURE,
|
||||||
|
signature_key=TEST_SIGNATURE_KEY,
|
||||||
|
notification_url=TEST_NOTIFICATION_URL,
|
||||||
)
|
)
|
||||||
|
|
||||||
if is_valid:
|
if is_valid:
|
||||||
|
|||||||
Reference in new issue
Block a user