Sha256: 10a7690df9162a062a4b7024d445b17adfdf39a81bb6c5bdc9cb481ea0e83832

Contents?: true

Size: 441 Bytes

Versions: 4

Compression:

Stored size: 441 Bytes

Contents

require 'stripe'

module Colt

  class SubscriptionPayment
    SUBSCRIPTION_PAYMENT_FAILED = "invoice.payment_failed"
    
    # Retrieving the event from the Stripe API guarantees its authenticity  
    def initialize(id)
      @event = Stripe::Event.retrieve(id)
    end 
    
    def failed?
      @event.type == SUBSCRIPTION_PAYMENT_FAILED
    end
    
    def stripe_customer_token
      @event.data.object.customer
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
colt-0.4.5 lib/colt/subscription_payment.rb
colt-0.4.4 lib/colt/subscription_payment.rb
colt-0.4.3 lib/colt/subscription_payment.rb
colt-0.4.2 lib/colt/subscription_payment.rb