|
|
@@ -182,14 +182,19 @@ def gb_hook():
|
|
|
current_app.logger.info(f'----------------------------------------------------------------------------')
|
|
|
current_app.logger.info(f'GiveButter request')
|
|
|
signature = request.headers.get('X-Givebutter-Signature')
|
|
|
- gb_secret = current_app.config['GB_SECRET']
|
|
|
+ gb_secret = current_app.config['GB_SETTINGS']['secret']
|
|
|
|
|
|
raw_data = request.get_data(as_text=True)
|
|
|
event = request.json
|
|
|
+ transaction = event['data'] # TESTING
|
|
|
+ from_name = f'{transaction["first_name"]} {transaction["last_name"]}' # TESTING
|
|
|
+ email = transaction['email'] # TESTING
|
|
|
+ amount = transaction['amount'] # TESTING
|
|
|
+ current_app.logger.info(f'\n\n{raw_data}\n\nSignature: {signature}\nFrom: {from_name}\nEmail: {email}\nAmount: {amount}\n\n') # TESTING
|
|
|
|
|
|
# if not verify_gbhook_signature(raw_data, signature, gb_secret): # TESTING
|
|
|
# return jsonify({'error': 'Invalid signature'}), 401
|
|
|
- if current_app.config['GB_INTEGRATION']:
|
|
|
+ if current_app.config['GB_SETTINGS']['integration']:
|
|
|
try:
|
|
|
event_type = event['event']
|
|
|
|
|
|
@@ -208,7 +213,7 @@ def gb_hook():
|
|
|
current_app.logger.error(f'General exception processing gbhook: {pgberror}')
|
|
|
else:
|
|
|
current_app.logger.error(f'GiveButter donation recieved, but GiveButter integration is turned off. Rejected.')
|
|
|
- return jsonify({'status': 'Failed. Not accepting GiveButter donations.'}), 400
|
|
|
+ return jsonify({'status': 'Failed. Not currently accepting GiveButter donations.'}), 400
|
|
|
|
|
|
return jsonify({'received': True}), 200
|
|
|
|