Class: UnivapayClientSdk::SubscriptionCreateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::SubscriptionCreateRequest
- Defined in:
- lib/univapay_client_sdk/models/subscription_create_request.rb
Overview
Request payload for creating a subscription.
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).
-
#first_charge_authorization_only ⇒ TrueClass | FalseClass
If true, the first charge will only be an authorization (Hold).
-
#first_charge_capture_after ⇒ String
ISO-8601 Duration for auto-capture if authorization only is true.
-
#initial_amount ⇒ Integer
Optional different amount for the first charge.
-
#installment_plan ⇒ SubscriptionInstallmentPlan
Configuration for credit card company side installments.
-
#metadata ⇒ GenericMetadata
A free-form dictionary for custom metadata.
-
#period ⇒ SubscriptionPeriod
Subscription Period schema.
-
#schedule_settings ⇒ SubscriptionScheduleSettings
Schedule settings applied to a subscription.
-
#subscription_plan ⇒ SubscriptionPlanSettings
Configuration for limited-cycle subscriptions (Univapay side).
-
#three_ds ⇒ ChargeCreateRequestThreeDs
Charge Create Request Three Ds schema.
-
#transaction_token_id ⇒ UUID | String
Transaction token ID authorized for recurring payments.
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(transaction_token_id:, amount:, currency:, initial_amount: SKIP, period: SKIP, cyclical_period: SKIP, schedule_settings: SKIP, installment_plan: SKIP, subscription_plan: SKIP, first_charge_authorization_only: false, first_charge_capture_after: SKIP, metadata: SKIP, three_ds: SKIP, additional_properties: nil) ⇒ SubscriptionCreateRequest
constructor
A new instance of SubscriptionCreateRequest.
-
#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(transaction_token_id:, amount:, currency:, initial_amount: SKIP, period: SKIP, cyclical_period: SKIP, schedule_settings: SKIP, installment_plan: SKIP, subscription_plan: SKIP, first_charge_authorization_only: false, first_charge_capture_after: SKIP, metadata: SKIP, three_ds: SKIP, additional_properties: nil) ⇒ SubscriptionCreateRequest
Returns a new instance of SubscriptionCreateRequest.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 107 def initialize(transaction_token_id:, amount:, currency:, initial_amount: SKIP, period: SKIP, cyclical_period: SKIP, schedule_settings: SKIP, installment_plan: SKIP, subscription_plan: SKIP, first_charge_authorization_only: false, first_charge_capture_after: SKIP, metadata: SKIP, three_ds: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @transaction_token_id = transaction_token_id @amount = amount @currency = currency @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 unless schedule_settings == SKIP @installment_plan = installment_plan unless installment_plan == SKIP @subscription_plan = subscription_plan unless subscription_plan == SKIP unless == SKIP @first_charge_authorization_only = end unless first_charge_capture_after == SKIP @first_charge_capture_after = first_charge_capture_after end @metadata = unless == SKIP @three_ds = three_ds unless three_ds == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Integer
Amount to be charged in each cycle.
18 19 20 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 18 def amount @amount end |
#currency ⇒ String
ISO-4217 currency code.
22 23 24 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 22 def currency @currency end |
#cyclical_period ⇒ String
ISO-8601 Duration for custom frequency (e.g., P3D, P2M). Cannot be used if 'period' is specified.
35 36 37 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 35 def cyclical_period @cyclical_period end |
#first_charge_authorization_only ⇒ TrueClass | FalseClass
If true, the first charge will only be an authorization (Hold).
51 52 53 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 51 def @first_charge_authorization_only end |
#first_charge_capture_after ⇒ String
ISO-8601 Duration for auto-capture if authorization only is true. Allowed days: P1D to P6D.
56 57 58 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 56 def first_charge_capture_after @first_charge_capture_after end |
#initial_amount ⇒ Integer
Optional different amount for the first charge.
26 27 28 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 26 def initial_amount @initial_amount end |
#installment_plan ⇒ SubscriptionInstallmentPlan
Configuration for credit card company side installments.
43 44 45 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 43 def installment_plan @installment_plan end |
#metadata ⇒ GenericMetadata
A free-form dictionary for custom metadata.
60 61 62 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 60 def @metadata end |
#period ⇒ SubscriptionPeriod
Subscription Period schema.
30 31 32 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 30 def period @period end |
#schedule_settings ⇒ SubscriptionScheduleSettings
Schedule settings applied to a subscription.
39 40 41 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 39 def schedule_settings @schedule_settings end |
#subscription_plan ⇒ SubscriptionPlanSettings
Configuration for limited-cycle subscriptions (Univapay side).
47 48 49 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 47 def subscription_plan @subscription_plan end |
#three_ds ⇒ ChargeCreateRequestThreeDs
Charge Create Request Three Ds schema.
64 65 66 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 64 def three_ds @three_ds end |
#transaction_token_id ⇒ UUID | String
Transaction token ID authorized for recurring payments.
14 15 16 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 14 def transaction_token_id @transaction_token_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 140 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. transaction_token_id = hash.key?('transaction_token_id') ? hash['transaction_token_id'] : nil amount = hash.key?('amount') ? hash['amount'] : nil currency = hash.key?('currency') ? hash['currency'] : nil 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 schedule_settings = SubscriptionScheduleSettings.from_hash(hash['schedule_settings']) if hash['schedule_settings'] installment_plan = SubscriptionInstallmentPlan.from_hash(hash['installment_plan']) if hash['installment_plan'] subscription_plan = SubscriptionPlanSettings.from_hash(hash['subscription_plan']) if hash['subscription_plan'] = hash['first_charge_authorization_only'] ||= false first_charge_capture_after = hash.key?('first_charge_capture_after') ? hash['first_charge_capture_after'] : SKIP = GenericMetadata.from_hash(hash['metadata']) if hash['metadata'] three_ds = ChargeCreateRequestThreeDs.from_hash(hash['three_ds']) if hash['three_ds'] # 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. SubscriptionCreateRequest.new(transaction_token_id: transaction_token_id, amount: amount, currency: currency, initial_amount: initial_amount, period: period, cyclical_period: cyclical_period, schedule_settings: schedule_settings, installment_plan: installment_plan, subscription_plan: subscription_plan, first_charge_authorization_only: , first_charge_capture_after: first_charge_capture_after, metadata: , three_ds: three_ds, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 67 def self.names @_hash = {} if @_hash.nil? @_hash['transaction_token_id'] = 'transaction_token_id' @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_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['first_charge_authorization_only'] = 'first_charge_authorization_only' @_hash['first_charge_capture_after'] = 'first_charge_capture_after' @_hash['metadata'] = 'metadata' @_hash['three_ds'] = 'three_ds' @_hash end |
.nullables ⇒ Object
An array for nullable fields
103 104 105 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 103 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 87 def self.optionals %w[ initial_amount period cyclical_period schedule_settings installment_plan subscription_plan first_charge_authorization_only first_charge_capture_after metadata three_ds ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 203 def inspect class_name = self.class.name.split('::').last "<#{class_name} transaction_token_id: #{@transaction_token_id.inspect}, amount:"\ " #{@amount.inspect}, currency: #{@currency.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}, first_charge_authorization_only:"\ " #{@first_charge_authorization_only.inspect}, first_charge_capture_after:"\ " #{@first_charge_capture_after.inspect}, metadata: #{@metadata.inspect}, three_ds:"\ " #{@three_ds.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
191 192 193 194 195 196 197 198 199 200 |
# File 'lib/univapay_client_sdk/models/subscription_create_request.rb', line 191 def to_s class_name = self.class.name.split('::').last "<#{class_name} transaction_token_id: #{@transaction_token_id}, amount: #{@amount},"\ " currency: #{@currency}, initial_amount: #{@initial_amount}, period: #{@period},"\ " cyclical_period: #{@cyclical_period}, schedule_settings: #{@schedule_settings},"\ " installment_plan: #{@installment_plan}, subscription_plan: #{@subscription_plan},"\ " first_charge_authorization_only: #{@first_charge_authorization_only},"\ " first_charge_capture_after: #{@first_charge_capture_after}, metadata: #{@metadata},"\ " three_ds: #{@three_ds}, additional_properties: #{@additional_properties}>" end |