Class: FdxV660Api::RecurringPaymentForUpdateEntity2

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb

Overview

The data of the Recurring Payment to be updated

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(frequency:, from_account_id:, to_payee_id:, amount:, due_date:, duration: SKIP, description: SKIP, merchant_account_id: SKIP, additional_properties: nil) ⇒ RecurringPaymentForUpdateEntity2

Returns a new instance of RecurringPaymentForUpdateEntity2.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 73

def initialize(frequency:, from_account_id:, to_payee_id:, amount:,
               due_date:, duration: SKIP, description: SKIP,
               merchant_account_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @frequency = frequency
  @duration = duration unless duration == SKIP
  @from_account_id = 
  @to_payee_id = to_payee_id
  @description = description unless description == SKIP
  @amount = amount
  @merchant_account_id =  unless  == SKIP
  @due_date = due_date
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountFloat

Amount for the payment. Must be positive

Returns:

  • (Float)


35
36
37
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 35

def amount
  @amount
end

#descriptionString

The purpose of the payment as provided by consumer or payment-requesting app

Returns:

  • (String)


31
32
33
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 31

def description
  @description
end

#due_dateDate

Date that the funds are scheduled to be delivered

Returns:

  • (Date)


43
44
45
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 43

def due_date
  @due_date
end

#durationRecurringPaymentDurationEntity2

Defines how long the payment repeats for



18
19
20
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 18

def duration
  @duration
end

#frequencyEventFrequency3

Defines how often the payment repeats

Returns:



14
15
16
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 14

def frequency
  @frequency
end

#from_account_idString

ID of the account used to source funds for payment

Returns:

  • (String)


22
23
24
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 22

def 
  @from_account_id
end

#merchant_account_idString

User's account identifier with the merchant

Returns:

  • (String)


39
40
41
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 39

def 
  @merchant_account_id
end

#to_payee_idString

ID of the payee to receive funds for the payment

Returns:

  • (String)


26
27
28
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 26

def to_payee_id
  @to_payee_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 91

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  frequency = hash.key?('frequency') ? hash['frequency'] : nil
   = hash.key?('fromAccountId') ? hash['fromAccountId'] : nil
  to_payee_id = hash.key?('toPayeeId') ? hash['toPayeeId'] : nil
  amount = hash.key?('amount') ? hash['amount'] : nil
  due_date = hash.key?('dueDate') ? hash['dueDate'] : nil
  duration = RecurringPaymentDurationEntity2.from_hash(hash['duration']) if hash['duration']
  description = hash.key?('description') ? hash['description'] : SKIP
   =
    hash.key?('merchantAccountId') ? hash['merchantAccountId'] : 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.
  RecurringPaymentForUpdateEntity2.new(frequency: frequency,
                                       from_account_id: ,
                                       to_payee_id: to_payee_id,
                                       amount: amount,
                                       due_date: due_date,
                                       duration: duration,
                                       description: description,
                                       merchant_account_id: ,
                                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['frequency'] = 'frequency'
  @_hash['duration'] = 'duration'
  @_hash['from_account_id'] = 'fromAccountId'
  @_hash['to_payee_id'] = 'toPayeeId'
  @_hash['description'] = 'description'
  @_hash['amount'] = 'amount'
  @_hash['merchant_account_id'] = 'merchantAccountId'
  @_hash['due_date'] = 'dueDate'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
63
64
65
66
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 60

def self.optionals
  %w[
    duration
    description
    merchant_account_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



134
135
136
137
138
139
140
141
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 134

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} frequency: #{@frequency.inspect}, duration: #{@duration.inspect},"\
  " from_account_id: #{@from_account_id.inspect}, to_payee_id: #{@to_payee_id.inspect},"\
  " description: #{@description.inspect}, amount: #{@amount.inspect}, merchant_account_id:"\
  " #{@merchant_account_id.inspect}, due_date: #{@due_date.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



125
126
127
128
129
130
131
# File 'lib/fdx_v660_api/models/recurring_payment_for_update_entity2.rb', line 125

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} frequency: #{@frequency}, duration: #{@duration}, from_account_id:"\
  " #{@from_account_id}, to_payee_id: #{@to_payee_id}, description: #{@description}, amount:"\
  " #{@amount}, merchant_account_id: #{@merchant_account_id}, due_date: #{@due_date},"\
  " additional_properties: #{@additional_properties}>"
end