Sha256: 60ee9259f03bd520e65fde73b52a5ca0f8317d5705e65b6dbc9815f0e6cbe569
Contents?: true
Size: 1.18 KB
Versions: 6
Compression:
Stored size: 1.18 KB
Contents
module StripeLocal module AssociationMethods def customer @customer ||= StripeLocal::Customer.find_by( model_id: id ) end def subscription @subscription ||= StripeLocal::Subscription.find_by( customer_id: customer.id ) end def cards @cards ||= StripeLocal::Card.where( customer_id: customer.id ) end def plan @plan ||= StripeLocal::Plan.find_by( id: subscription.plan_id ) end def discount @discount ||= StripeLocal::Discount.find_by( customer_id: customer.id ) end def coupon @coupon ||= StripeLocal::Coupon.find_by( id: discount.coupon_id ) end def invoices @invoices ||= StripeLocal::Invoice.where( customer_id: customer.id ).order( date: :desc ) end def paid_invoices invoices.paid end def charges @charges ||= StripeLocal::Charge.where( customer_id: customer.id ).order( created: :desc ) end def transactions @transactions ||= StripeLocal::Transaction.where( source: charges ).order( created: :desc ) end def pending_transactions transactions.pending end def available_transactions transactions.available end end end
Version data entries
6 entries across 6 versions & 1 rubygems