Class: Munificent::StripePaymentSweeper

Inherits:
Object
  • Object
show all
Defined in:
app/sweepers/munificent/stripe_payment_sweeper.rb

Class Method Summary collapse

Class Method Details

.runObject



4
5
6
7
8
9
10
11
12
13
14
# File 'app/sweepers/munificent/stripe_payment_sweeper.rb', line 4

def run
  Stripe::PaymentIntent.list.auto_paging_each do |payment_intent|
    next unless payment_intent.status == "succeeded"

    Payment.create_and_assign(
      amount: payment_intent.amount,
      currency: payment_intent.currency,
      stripe_payment_intent_id: payment_intent.id,
    )
  end
end