Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Stripe invoice.upcoming webhooks with null next_payment_attempt cause TypeError #1138

Open
3 tasks done
mguidetti opened this issue Jan 25, 2025 · 0 comments
Open
3 tasks done

Comments

@mguidetti
Copy link
Contributor

mguidetti commented Jan 25, 2025

Bug Report

Describe the Bug:

The next_payment_attempt attribute of Stripe's Invoice object is nullable for invoices where collection_method=send_invoice

If an invoice.upcoming webhook with a null next_payment_attempt attribute is received by Pay, Pay::Stripe::Webhooks::SubscriptionRenewing will raise a TypeError can't convert NilClass into an exact number because Time.zone.at cannot receive null arguments

date: Time.zone.at(event.data.object.next_payment_attempt)

To Reproduce:

  1. Receive a Stripe invoice.upcoming webhook with a null next_payment_attempt attribute

Expected Behavior:
The webhook should successfully process and send an subscription renewing email.

Actual Behavior:
TypeError can't convert NilClass into an exact number is raised

Environment:

  • Pay gem version: 8.3.0
  • Ruby version: 3.3.6
  • Rails version: 7.2
  • Operating System: Ubuntu 24

Possible Fix:
The next_payment_attempt can be safe navigated to handle null values and solve this error, but the subscription renewing email should probably be modified to handle conditions where next_payment_attempt is not set.

Labels to Apply:
bug

Checklist:

  • I have searched for similar issues and couldn't find any
  • I have checked the documentation for relevant information
  • I have included all the required information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant