Class: UnivapayClientSdk::SubscriptionUpdateNextPayment

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

Overview

Fields that can be updated on the next scheduled payment.

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, amount: SKIP, terminate_with_status: SKIP, additional_properties: nil) ⇒ SubscriptionUpdateNextPayment

Returns a new instance of SubscriptionUpdateNextPayment.



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

def initialize(due_date: SKIP, amount: SKIP, terminate_with_status: 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
  @amount = amount unless amount == SKIP
  @terminate_with_status = terminate_with_status unless terminate_with_status == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountInteger

Next payment amount. Not available for limited-cycle subscriptions. Only available for permitted merchants. This does not change subsequent cycle amounts.

Returns:

  • (Integer)


21
22
23
# File 'lib/univapay_client_sdk/models/subscription_update_next_payment.rb', line 21

def amount
  @amount
end

#due_dateDate

Next payment date (YYYY-MM-DD). Note: Only available for merchants permitted to edit next payment dates.

Returns:

  • (Date)


15
16
17
# File 'lib/univapay_client_sdk/models/subscription_update_next_payment.rb', line 15

def due_date
  @due_date
end

#terminate_with_statusSubscriptionTerminateWithStatus

Schedule a status transition on a payment's due date. Set to suspended or canceled to schedule termination. Send null to cancel a previously scheduled transition.



27
28
29
# File 'lib/univapay_client_sdk/models/subscription_update_next_payment.rb', line 27

def terminate_with_status
  @terminate_with_status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/univapay_client_sdk/models/subscription_update_next_payment.rb', line 66

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
# File 'lib/univapay_client_sdk/models/subscription_update_next_payment.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['due_date'] = 'due_date'
  @_hash['amount'] = 'amount'
  @_hash['terminate_with_status'] = 'terminate_with_status'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
51
52
# File 'lib/univapay_client_sdk/models/subscription_update_next_payment.rb', line 48

def self.nullables
  %w[
    terminate_with_status
  ]
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
# File 'lib/univapay_client_sdk/models/subscription_update_next_payment.rb', line 39

def self.optionals
  %w[
    due_date
    amount
    terminate_with_status
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



97
98
99
100
101
102
# File 'lib/univapay_client_sdk/models/subscription_update_next_payment.rb', line 97

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

#to_sObject

Provides a human-readable string representation of the object.



90
91
92
93
94
# File 'lib/univapay_client_sdk/models/subscription_update_next_payment.rb', line 90

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