Class: FdxV660Api::RequestForPaymentEntity

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

Overview

Detailed values of a request for 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(rfp_id: SKIP, account_id: SKIP, amount: SKIP, currency_code: SKIP, payee: SKIP, due_date: SKIP, status: SKIP, description: SKIP, link: SKIP, payment_id: SKIP, submitted_timestamp: SKIP, authorized_timestamp: SKIP, additional_properties: nil) ⇒ RequestForPaymentEntity

Returns a new instance of RequestForPaymentEntity.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 104

def initialize(rfp_id: SKIP, account_id: SKIP, amount: SKIP,
               currency_code: SKIP, payee: SKIP, due_date: SKIP,
               status: SKIP, description: SKIP, link: SKIP,
               payment_id: SKIP, submitted_timestamp: SKIP,
               authorized_timestamp: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @rfp_id = rfp_id unless rfp_id == SKIP
  @account_id =  unless  == SKIP
  @amount = amount unless amount == SKIP
  @currency_code = currency_code unless currency_code == SKIP
  @payee = payee unless payee == SKIP
  @due_date = due_date unless due_date == SKIP
  @status = status unless status == SKIP
  @description = description unless description == SKIP
  @link = link unless link == SKIP
  @payment_id = payment_id unless payment_id == SKIP
  @submitted_timestamp =  unless  == SKIP
  @authorized_timestamp = authorized_timestamp unless authorized_timestamp == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

ID of the account used to source funds for payment

Returns:

  • (String)


19
20
21
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 19

def 
  @account_id
end

#amountFloat

Amount for the payment. Must be positive

Returns:

  • (Float)


23
24
25
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 23

def amount
  @amount
end

#authorized_timestampDateTime

The date-time when the request for payment was authorized

Returns:

  • (DateTime)


61
62
63
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 61

def authorized_timestamp
  @authorized_timestamp
end

#currency_codeIso4217CurrencyCode6

Currency code if it is different from the account's currency



27
28
29
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 27

def currency_code
  @currency_code
end

#descriptionString

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

Returns:

  • (String)


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

def description
  @description
end

#due_dateDate

Date that the funds are being requested to be delivered

Returns:

  • (Date)


36
37
38
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 36

def due_date
  @due_date
end

Resource URL for retrieving full request for payment details

Returns:



49
50
51
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 49

def link
  @link
end

#payeePayeeEntity1

The payee merchant to receive funds from the payment, can be extended to support additional types of payees

Returns:



32
33
34
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 32

def payee
  @payee
end

#payment_idString

Identifies the payment generated by this request for payment

Returns:

  • (String)


53
54
55
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 53

def payment_id
  @payment_id
end

#rfp_idString

Uniquely identifies a request for payment

Returns:

  • (String)


15
16
17
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 15

def rfp_id
  @rfp_id
end

#statusRequestForPaymentStatus2

The current status of the request for payment



40
41
42
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 40

def status
  @status
end

#submitted_timestampDateTime

The date-time when the request for payment was submitted

Returns:

  • (DateTime)


57
58
59
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 57

def 
  @submitted_timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



128
129
130
131
132
133
134
135
136
137
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
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 128

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  rfp_id = hash.key?('rfpId') ? hash['rfpId'] : SKIP
   = hash.key?('accountId') ? hash['accountId'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  currency_code = hash.key?('currencyCode') ? hash['currencyCode'] : SKIP
  payee = PayeeEntity1.from_hash(hash['payee']) if hash['payee']
  due_date = hash.key?('dueDate') ? hash['dueDate'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  link = HateoasLink7.from_hash(hash['link']) if hash['link']
  payment_id = hash.key?('paymentId') ? hash['paymentId'] : SKIP
   = if hash.key?('submittedTimestamp')
                          (DateTimeHelper.from_rfc3339(hash['submittedTimestamp']) if hash['submittedTimestamp'])
                        else
                          SKIP
                        end
  authorized_timestamp = if hash.key?('authorizedTimestamp')
                           (DateTimeHelper.from_rfc3339(hash['authorizedTimestamp']) if hash['authorizedTimestamp'])
                         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.
  RequestForPaymentEntity.new(rfp_id: rfp_id,
                              account_id: ,
                              amount: amount,
                              currency_code: currency_code,
                              payee: payee,
                              due_date: due_date,
                              status: status,
                              description: description,
                              link: link,
                              payment_id: payment_id,
                              submitted_timestamp: ,
                              authorized_timestamp: authorized_timestamp,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 64

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['rfp_id'] = 'rfpId'
  @_hash['account_id'] = 'accountId'
  @_hash['amount'] = 'amount'
  @_hash['currency_code'] = 'currencyCode'
  @_hash['payee'] = 'payee'
  @_hash['due_date'] = 'dueDate'
  @_hash['status'] = 'status'
  @_hash['description'] = 'description'
  @_hash['link'] = 'link'
  @_hash['payment_id'] = 'paymentId'
  @_hash['submitted_timestamp'] = 'submittedTimestamp'
  @_hash['authorized_timestamp'] = 'authorizedTimestamp'
  @_hash
end

.nullablesObject

An array for nullable fields



100
101
102
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 100

def self.nullables
  []
end

.optionalsObject

An array for optional fields



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 82

def self.optionals
  %w[
    rfp_id
    account_id
    amount
    currency_code
    payee
    due_date
    status
    description
    link
    payment_id
    submitted_timestamp
    authorized_timestamp
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



195
196
197
198
199
200
201
202
203
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 195

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} rfp_id: #{@rfp_id.inspect}, account_id: #{@account_id.inspect}, amount:"\
  " #{@amount.inspect}, currency_code: #{@currency_code.inspect}, payee: #{@payee.inspect},"\
  " due_date: #{@due_date.inspect}, status: #{@status.inspect}, description:"\
  " #{@description.inspect}, link: #{@link.inspect}, payment_id: #{@payment_id.inspect},"\
  " submitted_timestamp: #{@submitted_timestamp.inspect}, authorized_timestamp:"\
  " #{@authorized_timestamp.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_authorized_timestampObject



180
181
182
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 180

def to_custom_authorized_timestamp
  DateTimeHelper.to_rfc3339(authorized_timestamp)
end

#to_custom_submitted_timestampObject



176
177
178
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 176

def 
  DateTimeHelper.to_rfc3339()
end

#to_sObject

Provides a human-readable string representation of the object.



185
186
187
188
189
190
191
192
# File 'lib/fdx_v660_api/models/request_for_payment_entity.rb', line 185

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} rfp_id: #{@rfp_id}, account_id: #{@account_id}, amount: #{@amount},"\
  " currency_code: #{@currency_code}, payee: #{@payee}, due_date: #{@due_date}, status:"\
  " #{@status}, description: #{@description}, link: #{@link}, payment_id: #{@payment_id},"\
  " submitted_timestamp: #{@submitted_timestamp}, authorized_timestamp:"\
  " #{@authorized_timestamp}, additional_properties: #{@additional_properties}>"
end