Class: UnivapayClientSdk::SubscriptionPatchPaymentRequest

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

Overview

Request body for updating a scheduled payment. All fields are optional. Omitted fields are left unchanged.

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, is_paid: SKIP, terminate_with_status: SKIP, retry_interval: SKIP, additional_properties: nil) ⇒ SubscriptionPatchPaymentRequest

Returns a new instance of SubscriptionPatchPaymentRequest.



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/univapay_client_sdk/models/subscription_patch_payment_request.rb', line 62

def initialize(due_date: SKIP, is_paid: 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
  @is_paid = is_paid unless is_paid == 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

#due_dateDate

New due date for this payment (YYYY-MM-DD). Only available to merchants with permission to edit payment dates.

Returns:

  • (Date)


16
17
18
# File 'lib/univapay_client_sdk/models/subscription_patch_payment_request.rb', line 16

def due_date
  @due_date
end

#is_paidTrueClass | FalseClass

Mark this payment as paid. Setting to true will trigger scheduling of the next payment in the cycle.

Returns:

  • (TrueClass | FalseClass)


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

def is_paid
  @is_paid
end

#retry_intervalString

ISO-8601 Duration override for the retry interval on a scheduled payment (for example P3D). Send null to clear.

Returns:

  • (String)


32
33
34
# File 'lib/univapay_client_sdk/models/subscription_patch_payment_request.rb', line 32

def retry_interval
  @retry_interval
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_patch_payment_request.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.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/univapay_client_sdk/models/subscription_patch_payment_request.rb', line 75

def self.from_hash(hash)
  return nil unless hash

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



35
36
37
38
39
40
41
42
# File 'lib/univapay_client_sdk/models/subscription_patch_payment_request.rb', line 35

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

.nullablesObject

An array for nullable fields



55
56
57
58
59
60
# File 'lib/univapay_client_sdk/models/subscription_patch_payment_request.rb', line 55

def self.nullables
  %w[
    terminate_with_status
    retry_interval
  ]
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
# File 'lib/univapay_client_sdk/models/subscription_patch_payment_request.rb', line 45

def self.optionals
  %w[
    due_date
    is_paid
    terminate_with_status
    retry_interval
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



110
111
112
113
114
115
# File 'lib/univapay_client_sdk/models/subscription_patch_payment_request.rb', line 110

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} due_date: #{@due_date.inspect}, is_paid: #{@is_paid.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.



102
103
104
105
106
107
# File 'lib/univapay_client_sdk/models/subscription_patch_payment_request.rb', line 102

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