Class: UnivapayClientSdk::CheckoutInstallmentsConfiguration

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/checkout_installments_configuration.rb

Overview

Installment plan configuration applied to checkout.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(enabled: SKIP, card_processor: SKIP, supported_payment_types: SKIP, min_charge_amount: SKIP, max_payout_period: SKIP, only_with_processor: SKIP, additional_properties: nil) ⇒ CheckoutInstallmentsConfiguration

Returns a new instance of CheckoutInstallmentsConfiguration.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 71

def initialize(enabled: SKIP, card_processor: SKIP,
               supported_payment_types: SKIP, min_charge_amount: SKIP,
               max_payout_period: SKIP, only_with_processor: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @enabled = enabled unless enabled == SKIP
  @card_processor = card_processor unless card_processor == SKIP
  @supported_payment_types = supported_payment_types unless supported_payment_types == SKIP
  @min_charge_amount = min_charge_amount unless min_charge_amount == SKIP
  @max_payout_period = max_payout_period unless max_payout_period == SKIP
  @only_with_processor = only_with_processor unless only_with_processor == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#card_processorCheckoutInstallmentCardProcessor

Card-processor capabilities available for installment payments.



18
19
20
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 18

def card_processor
  @card_processor
end

#enabledTrueClass | FalseClass

Whether installment plans are enabled.

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 14

def enabled
  @enabled
end

#max_payout_periodString

ISO-8601 period bounding the maximum payout delay for installment settlements. null when unrestricted.

Returns:

  • (String)


32
33
34
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 32

def max_payout_period
  @max_payout_period
end

#min_charge_amountCheckoutMoneyAmount

Minimum charge amount eligible for installment plans. null when unrestricted.

Returns:



27
28
29
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 27

def min_charge_amount
  @min_charge_amount
end

#only_with_processorTrueClass | FalseClass

Whether installment plans are restricted to processor-backed flows. Always true — retained for backwards compatibility.

Returns:

  • (TrueClass | FalseClass)


37
38
39
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 37

def only_with_processor
  @only_with_processor
end

#supported_payment_typesArray[CheckoutPaymentType]

Payment types eligible for installment plans.

Returns:



22
23
24
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 22

def supported_payment_types
  @supported_payment_types
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 88

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  enabled = hash.key?('enabled') ? hash['enabled'] : SKIP
  card_processor = CheckoutInstallmentCardProcessor.from_hash(hash['card_processor']) if
    hash['card_processor']
  supported_payment_types =
    hash.key?('supported_payment_types') ? hash['supported_payment_types'] : SKIP
  min_charge_amount = CheckoutMoneyAmount.from_hash(hash['min_charge_amount']) if
    hash['min_charge_amount']
  max_payout_period =
    hash.key?('max_payout_period') ? hash['max_payout_period'] : SKIP
  only_with_processor =
    hash.key?('only_with_processor') ? hash['only_with_processor'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  CheckoutInstallmentsConfiguration.new(enabled: enabled,
                                        card_processor: card_processor,
                                        supported_payment_types: supported_payment_types,
                                        min_charge_amount: min_charge_amount,
                                        max_payout_period: max_payout_period,
                                        only_with_processor: only_with_processor,
                                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['enabled'] = 'enabled'
  @_hash['card_processor'] = 'card_processor'
  @_hash['supported_payment_types'] = 'supported_payment_types'
  @_hash['min_charge_amount'] = 'min_charge_amount'
  @_hash['max_payout_period'] = 'max_payout_period'
  @_hash['only_with_processor'] = 'only_with_processor'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
67
68
69
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 64

def self.nullables
  %w[
    min_charge_amount
    max_payout_period
  ]
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
58
59
60
61
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 52

def self.optionals
  %w[
    enabled
    card_processor
    supported_payment_types
    min_charge_amount
    max_payout_period
    only_with_processor
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



131
132
133
134
135
136
137
138
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 131

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} enabled: #{@enabled.inspect}, card_processor: #{@card_processor.inspect},"\
  " supported_payment_types: #{@supported_payment_types.inspect}, min_charge_amount:"\
  " #{@min_charge_amount.inspect}, max_payout_period: #{@max_payout_period.inspect},"\
  " only_with_processor: #{@only_with_processor.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



122
123
124
125
126
127
128
# File 'lib/univapay_client_sdk/models/checkout_installments_configuration.rb', line 122

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} enabled: #{@enabled}, card_processor: #{@card_processor},"\
  " supported_payment_types: #{@supported_payment_types}, min_charge_amount:"\
  " #{@min_charge_amount}, max_payout_period: #{@max_payout_period}, only_with_processor:"\
  " #{@only_with_processor}, additional_properties: #{@additional_properties}>"
end