Class: ForestLiana::StripePaymentRefunder

Inherits:
Object
  • Object
show all
Defined in:
app/services/forest_liana/stripe_payment_refunder.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ StripePaymentRefunder

Returns a new instance of StripePaymentRefunder.



3
4
5
6
# File 'app/services/forest_liana/stripe_payment_refunder.rb', line 3

def initialize(params)
  @params = params
  Stripe.api_key = ForestLiana.integrations[:stripe][:api_key]
end

Instance Method Details

#performObject



8
9
10
11
12
13
14
15
# File 'app/services/forest_liana/stripe_payment_refunder.rb', line 8

def perform
  return unless @params[:data][:attributes][:ids]

  @params[:data][:attributes][:ids].each do |id|
    ch = ::Stripe::Charge.retrieve(id)
    ch.refunds.create
  end
end