|
|
@@ -179,6 +179,8 @@ def sign_payload(payload, secret): # For TESTING purposes
|
|
|
return test_payload
|
|
|
|
|
|
|
|
|
+# Not currently in use by GB, but it was. Maybe in the future?
|
|
|
+# Leaving it here just in case.
|
|
|
def verify_gbhook_signature(payload, signature, secret):
|
|
|
current_app.logger.info(f'\n\nRecieved Signature: {signature}\n\n')
|
|
|
expected_signature = hmac.new(
|
|
|
@@ -206,18 +208,12 @@ def gb_hook():
|
|
|
|
|
|
raw_data = request.get_data(as_text=True)
|
|
|
|
|
|
- # signature = sign_payload(raw_data, gb_secret) # For TESTING purposes
|
|
|
-
|
|
|
event = request.json
|
|
|
|
|
|
- # if not verify_gbhook_signature(raw_data, signature, gb_secret): # GB is not currently signing payloads. Just sending the signing secret
|
|
|
- # return jsonify({'error': 'Invalid signature'}), 401 # Leaving this here in case they ever decide to sign it
|
|
|
-
|
|
|
if signature == gb_secret:
|
|
|
if current_app.config['GB_SETTINGS']['integration']:
|
|
|
try:
|
|
|
event_type = event['event']
|
|
|
-
|
|
|
if event_type == 'transaction.succeeded':
|
|
|
transaction = event['data']
|
|
|
from_name = f'{transaction["first_name"]} {transaction["last_name"]}'
|