Class: Pay::Braintree::Webhooks::SubscriptionChargedUnsuccessfully
- Inherits:
-
Object
- Object
- Pay::Braintree::Webhooks::SubscriptionChargedUnsuccessfully
- Defined in:
- lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
Instance Method Summary collapse
Instance Method Details
#call(event) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb', line 7 def call(event) # subscription = event.subscription # return if subscription.nil? # pay_subscription = Pay::Subscription.find_by_processor_and_id(:braintree, subscription.id) # return unless pay_subscription.present? # pay_customer = pay_subscription.customer # pay_charge = Pay::Braintree::Billable.new(pay_customer).save_transaction(subscription.transactions.first) # if Pay.send_emails # Pay.mailer.with(pay_customer: pay_charge.customer, charge: pay_charge).receipt.deliver_later # end end |