Class: UnivapayClientSdk::MerchantWebhookSubscriptionPlanConfiguration

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

Overview

Subscription plan configuration.

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) ⇒ MerchantWebhookSubscriptionPlanConfiguration

Returns a new instance of MerchantWebhookSubscriptionPlanConfiguration.



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

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

Enables limited-cycle subscription plans.

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#fixed_cycleTrueClass | FalseClass

Allows plans limited by a fixed number of cycles.

Returns:

  • (TrueClass | FalseClass)


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

def fixed_cycle
  @fixed_cycle
end

#fixed_cycle_amountTrueClass | FalseClass

Allows plans limited by a total target amount.

Returns:

  • (TrueClass | FalseClass)


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

def fixed_cycle_amount
  @fixed_cycle_amount
end

#max_payout_periodString

Maximum payout delay allowed for subscription plan settlements.

Returns:

  • (String)


34
35
36
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_plan_configuration.rb', line 34

def max_payout_period
  @max_payout_period
end

#min_charge_amountMerchantWebhookMoneyAmount

Monetary amount object serialized by backend config models.



30
31
32
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_plan_configuration.rb', line 30

def min_charge_amount
  @min_charge_amount
end

#supported_payment_typesArray[String]

Payment types that can use subscription plans.

Returns:

  • (Array[String])


26
27
28
# File 'lib/univapay_client_sdk/models/merchant_webhook_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.



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

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 = MerchantWebhookMoneyAmount.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.
  MerchantWebhookSubscriptionPlanConfiguration.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.



37
38
39
40
41
42
43
44
45
46
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_plan_configuration.rb', line 37

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



61
62
63
64
65
66
67
68
69
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_plan_configuration.rb', line 61

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

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
57
58
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_plan_configuration.rb', line 49

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.



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

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.



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

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