Class: FdxV660Api::RecurringPaymentEntity

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

Overview

A recurring payment. Financial institution is free to adjust the payment date to accommodate weekends and holidays

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:, status:, duration: SKIP, description: SKIP, merchant_account_id: SKIP, recurring_payment_id: SKIP, scheduled_timestamp: SKIP, cancelled_timestamp: SKIP, processed_timestamp: SKIP, failed_timestamp: SKIP, additional_properties: nil) ⇒ RecurringPaymentEntity

Returns a new instance of RecurringPaymentEntity.



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
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 111

def initialize(frequency:, from_account_id:, to_payee_id:, amount:,
               due_date:, status:, duration: SKIP, description: SKIP,
               merchant_account_id: SKIP, recurring_payment_id: SKIP,
               scheduled_timestamp: SKIP, cancelled_timestamp: SKIP,
               processed_timestamp: SKIP, failed_timestamp: 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
  @recurring_payment_id = recurring_payment_id unless recurring_payment_id == SKIP
  @scheduled_timestamp = scheduled_timestamp unless scheduled_timestamp == SKIP
  @cancelled_timestamp = cancelled_timestamp unless cancelled_timestamp == SKIP
  @processed_timestamp = processed_timestamp unless processed_timestamp == SKIP
  @failed_timestamp = failed_timestamp unless failed_timestamp == SKIP
  @status = status
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountFloat

Amount for the payment. Must be positive

Returns:

  • (Float)


37
38
39
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 37

def amount
  @amount
end

#cancelled_timestampDateTime

When the recurring payment was cancelled

Returns:

  • (DateTime)


58
59
60
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 58

def cancelled_timestamp
  @cancelled_timestamp
end

#descriptionString

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

Returns:

  • (String)


33
34
35
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 33

def description
  @description
end

#due_dateDate

Date that the funds are scheduled to be delivered

Returns:

  • (Date)


45
46
47
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 45

def due_date
  @due_date
end

#durationRecurringPaymentDurationEntity2

Defines how long the payment repeats for



20
21
22
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 20

def duration
  @duration
end

#failed_timestampDateTime

When the recurring payment failed

Returns:

  • (DateTime)


66
67
68
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 66

def failed_timestamp
  @failed_timestamp
end

#frequencyEventFrequency3

Defines how often the payment repeats

Returns:



16
17
18
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 16

def frequency
  @frequency
end

#from_account_idString

ID of the account used to source funds for payment

Returns:

  • (String)


24
25
26
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 24

def 
  @from_account_id
end

#merchant_account_idString

User's account identifier with the merchant

Returns:

  • (String)


41
42
43
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 41

def 
  @merchant_account_id
end

#processed_timestampDateTime

When the last payment executed

Returns:

  • (DateTime)


62
63
64
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 62

def processed_timestamp
  @processed_timestamp
end

#recurring_payment_idString

Uniquely identifies a recurring payment. Used within the API to reference a recurring payment

Returns:

  • (String)


50
51
52
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 50

def recurring_payment_id
  @recurring_payment_id
end

#scheduled_timestampDateTime

When the recurring payment was scheduled

Returns:

  • (DateTime)


54
55
56
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 54

def scheduled_timestamp
  @scheduled_timestamp
end

#statusRecurringPaymentStatus2

Defines the status of the recurring payment



70
71
72
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 70

def status
  @status
end

#to_payee_idString

ID of the payee to receive funds for the payment

Returns:

  • (String)


28
29
30
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 28

def to_payee_id
  @to_payee_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



138
139
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
189
190
191
192
193
194
195
196
197
198
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 138

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
  status = hash.key?('status') ? hash['status'] : nil
  duration = RecurringPaymentDurationEntity2.from_hash(hash['duration']) if hash['duration']
  description = hash.key?('description') ? hash['description'] : SKIP
   =
    hash.key?('merchantAccountId') ? hash['merchantAccountId'] : SKIP
  recurring_payment_id =
    hash.key?('recurringPaymentId') ? hash['recurringPaymentId'] : SKIP
  scheduled_timestamp = if hash.key?('scheduledTimestamp')
                          (DateTimeHelper.from_rfc3339(hash['scheduledTimestamp']) if hash['scheduledTimestamp'])
                        else
                          SKIP
                        end
  cancelled_timestamp = if hash.key?('cancelledTimestamp')
                          (DateTimeHelper.from_rfc3339(hash['cancelledTimestamp']) if hash['cancelledTimestamp'])
                        else
                          SKIP
                        end
  processed_timestamp = if hash.key?('processedTimestamp')
                          (DateTimeHelper.from_rfc3339(hash['processedTimestamp']) if hash['processedTimestamp'])
                        else
                          SKIP
                        end
  failed_timestamp = if hash.key?('failedTimestamp')
                       (DateTimeHelper.from_rfc3339(hash['failedTimestamp']) if hash['failedTimestamp'])
                     else
                       SKIP
                     end

  # 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.
  RecurringPaymentEntity.new(frequency: frequency,
                             from_account_id: ,
                             to_payee_id: to_payee_id,
                             amount: amount,
                             due_date: due_date,
                             status: status,
                             duration: duration,
                             description: description,
                             merchant_account_id: ,
                             recurring_payment_id: recurring_payment_id,
                             scheduled_timestamp: scheduled_timestamp,
                             cancelled_timestamp: cancelled_timestamp,
                             processed_timestamp: processed_timestamp,
                             failed_timestamp: failed_timestamp,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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['recurring_payment_id'] = 'recurringPaymentId'
  @_hash['scheduled_timestamp'] = 'scheduledTimestamp'
  @_hash['cancelled_timestamp'] = 'cancelledTimestamp'
  @_hash['processed_timestamp'] = 'processedTimestamp'
  @_hash['failed_timestamp'] = 'failedTimestamp'
  @_hash['status'] = 'status'
  @_hash
end

.nullablesObject

An array for nullable fields



107
108
109
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 107

def self.nullables
  []
end

.optionalsObject

An array for optional fields



93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 93

def self.optionals
  %w[
    duration
    description
    merchant_account_id
    recurring_payment_id
    scheduled_timestamp
    cancelled_timestamp
    processed_timestamp
    failed_timestamp
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



229
230
231
232
233
234
235
236
237
238
239
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 229

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}, recurring_payment_id:"\
  " #{@recurring_payment_id.inspect}, scheduled_timestamp: #{@scheduled_timestamp.inspect},"\
  " cancelled_timestamp: #{@cancelled_timestamp.inspect}, processed_timestamp:"\
  " #{@processed_timestamp.inspect}, failed_timestamp: #{@failed_timestamp.inspect}, status:"\
  " #{@status.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_cancelled_timestampObject



204
205
206
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 204

def to_custom_cancelled_timestamp
  DateTimeHelper.to_rfc3339(cancelled_timestamp)
end

#to_custom_failed_timestampObject



212
213
214
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 212

def to_custom_failed_timestamp
  DateTimeHelper.to_rfc3339(failed_timestamp)
end

#to_custom_processed_timestampObject



208
209
210
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 208

def to_custom_processed_timestamp
  DateTimeHelper.to_rfc3339(processed_timestamp)
end

#to_custom_scheduled_timestampObject



200
201
202
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 200

def to_custom_scheduled_timestamp
  DateTimeHelper.to_rfc3339(scheduled_timestamp)
end

#to_sObject

Provides a human-readable string representation of the object.



217
218
219
220
221
222
223
224
225
226
# File 'lib/fdx_v660_api/models/recurring_payment_entity.rb', line 217

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},"\
  " recurring_payment_id: #{@recurring_payment_id}, scheduled_timestamp:"\
  " #{@scheduled_timestamp}, cancelled_timestamp: #{@cancelled_timestamp},"\
  " processed_timestamp: #{@processed_timestamp}, failed_timestamp: #{@failed_timestamp},"\
  " status: #{@status}, additional_properties: #{@additional_properties}>"
end