Class: Payola::Factories::PaymentToken

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

Class Method Summary collapse

Class Method Details

.create(card: nil) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/payola/factories/payment_token.rb', line 8

def self.create(card: nil)
  payment_gateway_adapter_class_name = Payola.registry[:payment_gateway_adapter].name
  payment_gateway_adapter_type       = payment_gateway_adapter_class_name[/::(\w+)PaymentGateway\z/, 1]
  factory_class_name                 = "Payola::Factories::#{payment_gateway_adapter_type}PaymentToken"
  factory_class                      = factory_class_name.constantize

  factory_class.create(card: card)
end