Module: Pay::Stripe::Charge

Extended by:
ActiveSupport::Concern
Defined in:
lib/pay/stripe/charge.rb

Instance Method Summary collapse

Instance Method Details

#stripe?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/pay/stripe/charge.rb', line 10

def stripe?
  processor == "stripe"
end

#stripe_chargeObject



14
15
16
17
18
# File 'lib/pay/stripe/charge.rb', line 14

def stripe_charge
  ::Stripe::Charge.retrieve(processor_id)
rescue ::Stripe::StripeError => e
  raise Pay::Stripe::Error, e
end

#stripe_refund!(amount_to_refund) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/pay/stripe/charge.rb', line 20

def stripe_refund!(amount_to_refund)
  ::Stripe::Refund.create(
    charge: processor_id,
    amount: amount_to_refund
  )

  update(amount_refunded: amount_to_refund)
rescue ::Stripe::StripeError => e
  raise Pay::Stripe::Error, e
end