Sha256: d061fadfbd97947411db05ee8d2c2c4a8fc5419b7bdb5de34ec580479138d46a
Contents?: true
Size: 583 Bytes
Versions: 6
Compression:
Stored size: 583 Bytes
Contents
module Tang class ImportChargesJob < ActiveJob::Base queue_as :default def perform(starting_after = nil) # Do something later stripe_charges = Stripe::Charge.list(limit: 100, starting_after: starting_after) stripe_charges.each do |stripe_charge| invoice = Invoice.find_by(stripe_id: stripe_charge.invoice) if invoice.present? Charge.from_stripe(stripe_charge, invoice) end end if stripe_charges.has_more Tang::ImportChargesJob.perform_now(stripe_charges.data.last.id) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems