Class: UnivapayClientSdk::CheckoutSubscriptionPlanConfiguration

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

Overview

Univapay-side subscription 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, fixed_cycle: SKIP, fixed_cycle_amount: SKIP, supported_payment_types: SKIP, min_charge_amount: SKIP, max_payout_period: SKIP, additional_properties: nil) ⇒ CheckoutSubscriptionPlanConfiguration

Returns a new instance of CheckoutSubscriptionPlanConfiguration.



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

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

  @enabled = enabled unless enabled == SKIP
  @fixed_cycle = fixed_cycle unless fixed_cycle == SKIP
  @fixed_cycle_amount = fixed_cycle_amount unless fixed_cycle_amount == 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
  @additional_properties = additional_properties
end

Instance Attribute Details

#enabledTrueClass | FalseClass

Whether subscription plans are enabled.

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#fixed_cycleTrueClass | FalseClass

Whether fixed-cycle subscription plans are allowed.

Returns:

  • (TrueClass | FalseClass)


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

def fixed_cycle
  @fixed_cycle
end

#fixed_cycle_amountTrueClass | FalseClass

Whether fixed-cycle-amount subscription plans are allowed.

Returns:

  • (TrueClass | FalseClass)


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

def fixed_cycle_amount
  @fixed_cycle_amount
end

#max_payout_periodString

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

Returns:

  • (String)


36
37
38
# File 'lib/univapay_client_sdk/models/checkout_subscription_plan_configuration.rb', line 36

def max_payout_period
  @max_payout_period
end

#min_charge_amountCheckoutMoneyAmount

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

Returns:



31
32
33
# File 'lib/univapay_client_sdk/models/checkout_subscription_plan_configuration.rb', line 31

def min_charge_amount
  @min_charge_amount
end

#supported_payment_typesArray[CheckoutPaymentType]

Payment types eligible for subscription plans.

Returns:



26
27
28
# File 'lib/univapay_client_sdk/models/checkout_subscription_plan_configuration.rb', line 26

def supported_payment_types
  @supported_payment_types
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



86
87
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
# File 'lib/univapay_client_sdk/models/checkout_subscription_plan_configuration.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  enabled = hash.key?('enabled') ? hash['enabled'] : SKIP
  fixed_cycle = hash.key?('fixed_cycle') ? hash['fixed_cycle'] : SKIP
  fixed_cycle_amount =
    hash.key?('fixed_cycle_amount') ? hash['fixed_cycle_amount'] : SKIP
  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

  # 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.
  CheckoutSubscriptionPlanConfiguration.new(enabled: enabled,
                                            fixed_cycle: fixed_cycle,
                                            fixed_cycle_amount: fixed_cycle_amount,
                                            supported_payment_types: supported_payment_types,
                                            min_charge_amount: min_charge_amount,
                                            max_payout_period: max_payout_period,
                                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    min_charge_amount
    max_payout_period
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    enabled
    fixed_cycle
    fixed_cycle_amount
    supported_payment_types
    min_charge_amount
    max_payout_period
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



128
129
130
131
132
133
134
135
# File 'lib/univapay_client_sdk/models/checkout_subscription_plan_configuration.rb', line 128

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

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
124
125
# File 'lib/univapay_client_sdk/models/checkout_subscription_plan_configuration.rb', line 119

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