Class: UnivapayClientSdk::SubscriptionSimulationRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::SubscriptionSimulationRequest
- Defined in:
- lib/univapay_client_sdk/models/subscription_simulation_request.rb
Overview
Request payload for simulating a subscription payment schedule without creating a live subscription. Specify exactly one of 'period' or 'cyclical_period' to define the billing frequency. 'installment_plan' and 'subscription_plan' are mutually exclusive — specify at most one to model a limited-cycle schedule.
Instance Attribute Summary collapse
-
#amount ⇒ Integer
Amount to be charged in each cycle.
-
#currency ⇒ String
ISO-4217 currency code.
-
#cyclical_period ⇒ String
ISO-8601 Duration for custom frequency (e.g., P3D, P2M).
-
#initial_amount ⇒ Integer
Optional different amount for the first charge.
-
#installment_plan ⇒ SubscriptionSimulationPlanSettings
Cycle-limiting plan configuration used to simulate an installment plan or a Univapay-side subscription plan.
-
#only_direct_currency ⇒ TrueClass | FalseClass
Whether only direct currency processing is allowed.
-
#payment_type ⇒ TransactionTokenPaymentType
Transaction Token Payment Type schema.
-
#period ⇒ SubscriptionSimulationPeriod
Billing frequency for the simulated schedule.
-
#schedule_settings ⇒ SubscriptionScheduleSettings
Schedule settings applied to a subscription.
-
#subscription_plan ⇒ SubscriptionSimulationPlanSettings
Cycle-limiting plan configuration used to simulate an installment plan or a Univapay-side subscription plan.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(amount:, currency:, payment_type:, schedule_settings:, initial_amount: SKIP, period: SKIP, cyclical_period: SKIP, installment_plan: SKIP, subscription_plan: SKIP, only_direct_currency: SKIP, additional_properties: nil) ⇒ SubscriptionSimulationRequest
constructor
A new instance of SubscriptionSimulationRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(amount:, currency:, payment_type:, schedule_settings:, initial_amount: SKIP, period: SKIP, cyclical_period: SKIP, installment_plan: SKIP, subscription_plan: SKIP, only_direct_currency: SKIP, additional_properties: nil) ⇒ SubscriptionSimulationRequest
Returns a new instance of SubscriptionSimulationRequest.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 93 def initialize(amount:, currency:, payment_type:, schedule_settings:, initial_amount: SKIP, period: SKIP, cyclical_period: SKIP, installment_plan: SKIP, subscription_plan: SKIP, only_direct_currency: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @amount = amount @currency = currency @payment_type = payment_type @initial_amount = initial_amount unless initial_amount == SKIP @period = period unless period == SKIP @cyclical_period = cyclical_period unless cyclical_period == SKIP @schedule_settings = schedule_settings @installment_plan = installment_plan unless installment_plan == SKIP @subscription_plan = subscription_plan unless subscription_plan == SKIP @only_direct_currency = only_direct_currency unless only_direct_currency == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Integer
Amount to be charged in each cycle. Must be a positive integer.
18 19 20 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 18 def amount @amount end |
#currency ⇒ String
ISO-4217 currency code.
22 23 24 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 22 def currency @currency end |
#cyclical_period ⇒ String
ISO-8601 Duration for custom frequency (e.g., P3D, P2M). Cannot be used together with 'period' — specify exactly one of the two.
40 41 42 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 40 def cyclical_period @cyclical_period end |
#initial_amount ⇒ Integer
Optional different amount for the first charge. Must be zero or greater.
30 31 32 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 30 def initial_amount @initial_amount end |
#installment_plan ⇒ SubscriptionSimulationPlanSettings
Cycle-limiting plan configuration used to simulate an installment plan or a Univapay-side subscription plan.
49 50 51 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 49 def installment_plan @installment_plan end |
#only_direct_currency ⇒ TrueClass | FalseClass
Whether only direct currency processing is allowed.
58 59 60 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 58 def only_direct_currency @only_direct_currency end |
#payment_type ⇒ TransactionTokenPaymentType
Transaction Token Payment Type schema.
26 27 28 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 26 def payment_type @payment_type end |
#period ⇒ SubscriptionSimulationPeriod
Billing frequency for the simulated schedule. Includes bimonthly, which
is not offered on SubscriptionPeriod for live subscription creation.
35 36 37 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 35 def period @period end |
#schedule_settings ⇒ SubscriptionScheduleSettings
Schedule settings applied to a subscription.
44 45 46 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 44 def schedule_settings @schedule_settings end |
#subscription_plan ⇒ SubscriptionSimulationPlanSettings
Cycle-limiting plan configuration used to simulate an installment plan or a Univapay-side subscription plan.
54 55 56 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 54 def subscription_plan @subscription_plan end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 114 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? hash['amount'] : nil currency = hash.key?('currency') ? hash['currency'] : nil payment_type = hash.key?('payment_type') ? hash['payment_type'] : nil schedule_settings = SubscriptionScheduleSettings.from_hash(hash['schedule_settings']) if hash['schedule_settings'] initial_amount = hash.key?('initial_amount') ? hash['initial_amount'] : SKIP period = hash.key?('period') ? hash['period'] : SKIP cyclical_period = hash.key?('cyclical_period') ? hash['cyclical_period'] : SKIP installment_plan = SubscriptionSimulationPlanSettings.from_hash(hash['installment_plan']) if hash['installment_plan'] subscription_plan = SubscriptionSimulationPlanSettings.from_hash(hash['subscription_plan']) if hash['subscription_plan'] only_direct_currency = hash.key?('only_direct_currency') ? hash['only_direct_currency'] : 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. SubscriptionSimulationRequest.new(amount: amount, currency: currency, payment_type: payment_type, schedule_settings: schedule_settings, initial_amount: initial_amount, period: period, cyclical_period: cyclical_period, installment_plan: installment_plan, subscription_plan: subscription_plan, only_direct_currency: only_direct_currency, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 61 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash['payment_type'] = 'payment_type' @_hash['initial_amount'] = 'initial_amount' @_hash['period'] = 'period' @_hash['cyclical_period'] = 'cyclical_period' @_hash['schedule_settings'] = 'schedule_settings' @_hash['installment_plan'] = 'installment_plan' @_hash['subscription_plan'] = 'subscription_plan' @_hash['only_direct_currency'] = 'only_direct_currency' @_hash end |
.nullables ⇒ Object
An array for nullable fields
89 90 91 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 89 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 77 def self.optionals %w[ initial_amount period cyclical_period installment_plan subscription_plan only_direct_currency ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
167 168 169 170 171 172 173 174 175 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 167 def inspect class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount.inspect}, currency: #{@currency.inspect}, payment_type:"\ " #{@payment_type.inspect}, initial_amount: #{@initial_amount.inspect}, period:"\ " #{@period.inspect}, cyclical_period: #{@cyclical_period.inspect}, schedule_settings:"\ " #{@schedule_settings.inspect}, installment_plan: #{@installment_plan.inspect},"\ " subscription_plan: #{@subscription_plan.inspect}, only_direct_currency:"\ " #{@only_direct_currency.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
157 158 159 160 161 162 163 164 |
# File 'lib/univapay_client_sdk/models/subscription_simulation_request.rb', line 157 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, currency: #{@currency}, payment_type: #{@payment_type},"\ " initial_amount: #{@initial_amount}, period: #{@period}, cyclical_period:"\ " #{@cyclical_period}, schedule_settings: #{@schedule_settings}, installment_plan:"\ " #{@installment_plan}, subscription_plan: #{@subscription_plan}, only_direct_currency:"\ " #{@only_direct_currency}, additional_properties: #{@additional_properties}>" end |