Our stripe_webhooks implementation tends to do a lot of things multiple times, including getting the customer, event, and account objects/variables. This leads to a lot of duplicate code, making it slightly harder to maintain.

I'm working on refactoring it to consolidate repetitive tasks and make it easier to read and manage.

Comments

torgosPizza created an issue. See original summary.

torgospizza’s picture

Status: Active » Needs review
StatusFileSize
new6.2 KB

Patch attached.

Patch also relies on a newly-added function in Stripe Customer module that allows us to more easily retrieve the $customer object from an event, since different event types will include the customer at a higher level. (If the event is subscription.created, for instance, the customer will live in $event->data->object->customer, but if the event is customer.created, the customer will live in $event->data->object.)

  • torgosPizza committed 6cc19df on 7.x-1.x
    Issue #2823597 by torgosPizza: Refactor webhook response code
    
torgospizza’s picture

Status: Needs review » Fixed

This has been working well for me and makes the code easier to read.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.