Class: Tang::CreateInvoice

Inherits:
Object
  • Object
show all
Defined in:
app/services/tang/create_invoice.rb

Class Method Summary collapse

Class Method Details

.call(event) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/services/tang/create_invoice.rb', line 3

def self.call(event)
  stripe_invoice = event.data.object

  invoice = Invoice.from_stripe(stripe_invoice)

  if invoice.present?
    stripe_invoice.lines.data.each do |stripe_invoice_item|
      InvoiceItem.from_stripe(stripe_invoice_item, invoice)
    end
  end

  return invoice
end