Class: UnivapayClientSdk::SubscriptionSimulationPayment

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

Overview

A single scheduled payment produced by the subscription plan simulation.

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(due_date: SKIP, zone_id: SKIP, amount: SKIP, currency: SKIP, is_paid: SKIP, is_last_payment: SKIP, successful_payment_date: SKIP, terminate_with_status: SKIP, retry_interval: SKIP, additional_properties: nil) ⇒ SubscriptionSimulationPayment

Returns a new instance of SubscriptionSimulationPayment.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/univapay_client_sdk/models/subscription_simulation_payment.rb', line 90

def initialize(due_date: SKIP, zone_id: SKIP, amount: SKIP, currency: SKIP,
               is_paid: SKIP, is_last_payment: SKIP,
               successful_payment_date: SKIP, terminate_with_status: SKIP,
               retry_interval: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @due_date = due_date unless due_date == SKIP
  @zone_id = zone_id unless zone_id == SKIP
  @amount = amount unless amount == SKIP
  @currency = currency unless currency == SKIP
  @is_paid = is_paid unless is_paid == SKIP
  @is_last_payment = is_last_payment unless is_last_payment == SKIP
  @successful_payment_date = successful_payment_date unless successful_payment_date == SKIP
  @terminate_with_status = terminate_with_status unless terminate_with_status == SKIP
  @retry_interval = retry_interval unless retry_interval == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountInteger

Amount to be charged on this cycle, in the smallest currency unit.

Returns:

  • (Integer)


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

def amount
  @amount
end

#currencyString

ISO-4217 currency code.

Returns:

  • (String)


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

def currency
  @currency
end

#due_dateDate

Scheduled due date for this simulated payment (YYYY-MM-DD).

Returns:

  • (Date)


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

def due_date
  @due_date
end

#is_last_paymentTrueClass | FalseClass

Whether this is the final payment in the simulated schedule.

Returns:

  • (TrueClass | FalseClass)


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

def is_last_payment
  @is_last_payment
end

#is_paidTrueClass | FalseClass

Always false for simulated payments — no real payment has been made.

Returns:

  • (TrueClass | FalseClass)


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

def is_paid
  @is_paid
end

#retry_intervalString

ISO-8601 Duration for the retry interval applied if this payment fails (e.g., P5D). null if no retry interval is configured.

Returns:

  • (String)


49
50
51
# File 'lib/univapay_client_sdk/models/subscription_simulation_payment.rb', line 49

def retry_interval
  @retry_interval
end

#successful_payment_dateDate

Always null for simulated payments — populated only once a real payment settles.

Returns:

  • (Date)


39
40
41
# File 'lib/univapay_client_sdk/models/subscription_simulation_payment.rb', line 39

def successful_payment_date
  @successful_payment_date
end

#terminate_with_statusTerminateWithStatus

The status the subscription would transition to on this payment's due date, if a termination is scheduled. null when no termination applies.

Returns:



44
45
46
# File 'lib/univapay_client_sdk/models/subscription_simulation_payment.rb', line 44

def terminate_with_status
  @terminate_with_status
end

#zone_idString

IANA timezone identifier used to resolve the due date.

Returns:

  • (String)


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

def zone_id
  @zone_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
138
139
140
141
142
143
144
145
146
# File 'lib/univapay_client_sdk/models/subscription_simulation_payment.rb', line 110

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  due_date = hash.key?('due_date') ? hash['due_date'] : SKIP
  zone_id = hash.key?('zone_id') ? hash['zone_id'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  is_paid = hash.key?('is_paid') ? hash['is_paid'] : SKIP
  is_last_payment =
    hash.key?('is_last_payment') ? hash['is_last_payment'] : SKIP
  successful_payment_date =
    hash.key?('successful_payment_date') ? hash['successful_payment_date'] : SKIP
  terminate_with_status =
    hash.key?('terminate_with_status') ? hash['terminate_with_status'] : SKIP
  retry_interval =
    hash.key?('retry_interval') ? hash['retry_interval'] : 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.
  SubscriptionSimulationPayment.new(due_date: due_date,
                                    zone_id: zone_id,
                                    amount: amount,
                                    currency: currency,
                                    is_paid: is_paid,
                                    is_last_payment: is_last_payment,
                                    successful_payment_date: successful_payment_date,
                                    terminate_with_status: terminate_with_status,
                                    retry_interval: retry_interval,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['due_date'] = 'due_date'
  @_hash['zone_id'] = 'zone_id'
  @_hash['amount'] = 'amount'
  @_hash['currency'] = 'currency'
  @_hash['is_paid'] = 'is_paid'
  @_hash['is_last_payment'] = 'is_last_payment'
  @_hash['successful_payment_date'] = 'successful_payment_date'
  @_hash['terminate_with_status'] = 'terminate_with_status'
  @_hash['retry_interval'] = 'retry_interval'
  @_hash
end

.nullablesObject

An array for nullable fields



82
83
84
85
86
87
88
# File 'lib/univapay_client_sdk/models/subscription_simulation_payment.rb', line 82

def self.nullables
  %w[
    successful_payment_date
    terminate_with_status
    retry_interval
  ]
end

.optionalsObject

An array for optional fields



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/univapay_client_sdk/models/subscription_simulation_payment.rb', line 67

def self.optionals
  %w[
    due_date
    zone_id
    amount
    currency
    is_paid
    is_last_payment
    successful_payment_date
    terminate_with_status
    retry_interval
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



159
160
161
162
163
164
165
166
167
# File 'lib/univapay_client_sdk/models/subscription_simulation_payment.rb', line 159

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} due_date: #{@due_date.inspect}, zone_id: #{@zone_id.inspect}, amount:"\
  " #{@amount.inspect}, currency: #{@currency.inspect}, is_paid: #{@is_paid.inspect},"\
  " is_last_payment: #{@is_last_payment.inspect}, successful_payment_date:"\
  " #{@successful_payment_date.inspect}, terminate_with_status:"\
  " #{@terminate_with_status.inspect}, retry_interval: #{@retry_interval.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



149
150
151
152
153
154
155
156
# File 'lib/univapay_client_sdk/models/subscription_simulation_payment.rb', line 149

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} due_date: #{@due_date}, zone_id: #{@zone_id}, amount: #{@amount}, currency:"\
  " #{@currency}, is_paid: #{@is_paid}, is_last_payment: #{@is_last_payment},"\
  " successful_payment_date: #{@successful_payment_date}, terminate_with_status:"\
  " #{@terminate_with_status}, retry_interval: #{@retry_interval}, additional_properties:"\
  " #{@additional_properties}>"
end