Sha256: f985f45bfd7c7710a24471ee9a27a46ecf2b12a41743616297f2012aa2a95765

Contents?: true

Size: 417 Bytes

Versions: 2

Compression:

Stored size: 417 Bytes

Contents

module Pay
  module Lago
    module Webhooks
      class InvoiceCreated
        def call(event)
          pay_charge = Pay::Lago::Charge.sync(event.invoice.lago_id, object: event.invoice)

          if pay_charge && Pay.send_email?(:receipt, pay_charge)
            Pay.mailer.with(pay_customer: pay_charge.customer, pay_charge: pay_charge).receipt.deliver_later
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pay-lago-0.1.1 lib/pay/lago/webhooks/invoice_created.rb
pay-lago-0.1.0 lib/pay/lago/webhooks/invoice_created.rb