lib/pay/stripe/webhooks/payment_method_attached.rb in pay-2.7.2 vs lib/pay/stripe/webhooks/payment_method_attached.rb in pay-3.0.0
- old
+ new
@@ -3,14 +3,12 @@
module Webhooks
class PaymentMethodAttached
def call(event)
object = event.data.object
pay_customer = Pay::Customer.find_by(processor: :stripe, processor_id: object.customer)
+ return unless pay_customer
- # Couldn't find user, we can skip
- return unless pay_customer.present?
-
- Pay::Stripe::Billable.new(pay_customer).sync_payment_method(payment_method_id: object.id)
+ pay_customer.save_payment_method(object, default: false)
end
end
end
end
end