Class: Payola::PaymentGateway

Inherits:
Object
  • Object
show all
Defined in:
lib/payola/payment_gateway.rb

Class Method Summary collapse

Class Method Details

.sync(adapter: Payola.registry[:payment_gateway_adapter], subscription:) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/payola/payment_gateway.rb', line 3

def self.sync(adapter: Payola.registry[:payment_gateway_adapter],
              subscription:)

  gateway_subscription = adapter.apply_subscription \
                          subscription.payment_gateway_parameters

  subscription = subscription.dup

  subscription.source_subscription_id   = gateway_subscription[:subscription_id]
  subscription.last_four_of_credit_card = gateway_subscription[:last_four_of_credit_card]
  subscription.status                   = gateway_subscription[:status]

  subscription
end