Class: AdyenApIs::RecurringProcessingModel

Inherits:
Object
  • Object
show all
Defined in:
lib/adyen_ap_is/models/recurring_processing_model.rb

Overview

Defines a recurring payment type. Required when creating a token to store payment details or using stored payment details. Allowed values: * Subscription – A transaction for a fixed or variable amount, which follows a fixed schedule. * CardOnFile – With a card-on-file (CoF) transaction, card details are stored to enable one-click or omnichannel journeys, or simply to streamline the checkout process. Any subscription not following a fixed schedule is also considered a card-on-file transaction. * UnscheduledCardOnFile – An unscheduled card-on-file (UCoF) transaction is a transaction that occurs on a non-fixed schedule and/or have variable amounts. For example, automatic top-ups when a cardholder’s balance drops below a certain amount.

Constant Summary collapse

RECURRING_PROCESSING_MODEL =
[
  # TODO: Write general description for CARDONFILE
  CARDONFILE = 'CardOnFile'.freeze,

  # TODO: Write general description for SUBSCRIPTION
  SUBSCRIPTION = 'Subscription'.freeze,

  # TODO: Write general description for UNSCHEDULEDCARDONFILE
  UNSCHEDULEDCARDONFILE = 'UnscheduledCardOnFile'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CARDONFILE) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/adyen_ap_is/models/recurring_processing_model.rb', line 36

def self.from_value(value, default_value = CARDONFILE)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'cardonfile' then CARDONFILE
  when 'subscription' then SUBSCRIPTION
  when 'unscheduledcardonfile' then UNSCHEDULEDCARDONFILE
  else
    default_value
  end
end

.validate(value) ⇒ Object



30
31
32
33
34
# File 'lib/adyen_ap_is/models/recurring_processing_model.rb', line 30

def self.validate(value)
  return false if value.nil?

  RECURRING_PROCESSING_MODEL.include?(value)
end