feat: Add switches for logging full webhook traffic
Debugging civicrm#145 has become complicated due to an apparent differential between sandbox webhook messages, live webhook messages, and the in-dashboard preview of live webhook messages. In order to get better insight into why certain webhooks are shaped differently than expected, we need a way to provide webhook logging without having it be the full-time standard (we'd fill up our disks, honestly).
This MR seeks to address this as discussed in the call regarding #145:
- Two new environment variables,
TRACE_STRIPE_WEBHOOK
andTRACE_PAYPAL_WEBHOOK
have been added -
settings.py
ingests them and adds them to the list of settings - These settings are passed into the Stripe and Paypal controllers via DI
- Said controllers add them as private variables,
self.__trace_webhooks
, in their constructors - When each controller runs its own version of
process_webhook
in response to an incoming webhook being validated, ifself.__trace_webhooks
is true, we log thedict
representation of that webhook message. - A tremendous number of unit tests have been adjusted to respect this update
Edited by anarcat