pay-rails / pay

Payments for Ruby on Rails apps
https://github.com/pay-rails/pay
MIT License
1.98k stars 316 forks source link

[BUG] undefined local variable or method 'subscription' when upgrading to v8 #1084

Closed thiago-sydow closed 1 month ago

thiago-sydow commented 1 month ago

Bug Report

Describe the Bug:

Can't retry failed payments for Subscriptions

To Reproduce:

payment_processor.subscriptions.past_due.each(&:retry_failed_payment)

When processor is Pay::Stripe::Subscription

Expected Behavior:

Works as before version 8

Actual Behavior:

undefined local variable or method `subscription' for an instance of Pay::Stripe::Subscription

Environment:

Additional Context:

I'm "almost sure" that the issue is that this Line https://github.com/pay-rails/pay/blob/b604d0548874da64d5eb5d5ecff46f63a9751ae5/app/models/pay/stripe/subscription.rb#L335 should call api_record instead of subscription

Possible Fix:

Replace subscription for api_record ? I could not find tests for this method so not sure if it's only that

Steps to Reproduce with Fix (if available):

Related Issues:

Labels to Apply:

Checklist:

excid3 commented 1 month ago

Thanks, released as 8.1.1!