Sha256: 1f4280be437c1db6ec4b787f93ce37d97aec1c3917d0f9b5e37990b1aa878168
Contents?: true
Size: 943 Bytes
Versions: 11
Compression:
Stored size: 943 Bytes
Contents
StripeEvent.configure do |events| events.subscribe 'charge.failed' do |event| stripe_id = event.data.object['customer'] subscription = ::Subscription.find_by_stripe_id(stripe_id) subscription.charge_failed end events.subscribe 'invoice.payment_succeeded' do |event| stripe_id = event.data.object['customer'] amount = event.data.object['total'].to_f / 100.0 subscription = ::Subscription.find_by_stripe_id(stripe_id) subscription.payment_succeeded(amount) end events.subscribe 'charge.dispute.created' do |event| stripe_id = event.data.object['customer'] subscription = ::Subscription.find_by_stripe_id(stripe_id) subscription.charge_disputed end events.subscribe 'customer.subscription.deleted' do |event| stripe_id = event.data.object['customer'] subscription = ::Subscription.find_by_stripe_id(stripe_id) subscription.subscription_owner.try(:cancel) end end
Version data entries
11 entries across 11 versions & 2 rubygems