Class: Pay::LemonSqueezy::PaymentMethod

Inherits:
PaymentMethod show all
Defined in:
app/models/pay/lemon_squeezy/payment_method.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PaymentMethod

find_by_processor_and_id, pay_processor_for, #payment_processor

Class Method Details

.sync(pay_customer:, attributes:) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/models/pay/lemon_squeezy/payment_method.rb', line 4

def self.sync(pay_customer:, attributes:)
  return unless pay_customer.subscription

  payment_method = pay_customer.default_payment_method || pay_customer.build_default_payment_method
  payment_method.processor_id ||= NanoId.generate

  attrs = {
    payment_method_type: "card",
    brand: attributes.card_brand,
    last4: attributes.card_last_four
  }

  payment_method.update!(attrs)
  payment_method
end

Instance Method Details

#detachObject



23
24
# File 'app/models/pay/lemon_squeezy/payment_method.rb', line 23

def detach
end

#make_default!Object



20
21
# File 'app/models/pay/lemon_squeezy/payment_method.rb', line 20

def make_default!
end