Class: DnaPaymentsPartnerReportingSettlementApIs::Settlement

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb

Overview

Settlement Model.

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(processed_date: SKIP, settlement_date: SKIP, merchant_id: SKIP, merchant_name: SKIP, amount: SKIP, acquirer_fee: SKIP, amount_to_merchant: SKIP, currency: SKIP, operation: SKIP, transaction_id: SKIP, transaction_date: SKIP, transaction_type: SKIP, merchant_reference: SKIP, card_scheme: SKIP, card_type: SKIP, is_european_card: SKIP, is_corporate_card: SKIP, card_mask: SKIP, capture_method: SKIP, issuer_country: SKIP, merchant_custom_data: SKIP, additional_properties: nil) ⇒ Settlement

Returns a new instance of Settlement.



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
199
200
201
202
203
204
205
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 171

def initialize(processed_date: SKIP, settlement_date: SKIP,
               merchant_id: SKIP, merchant_name: SKIP, amount: SKIP,
               acquirer_fee: SKIP, amount_to_merchant: SKIP, currency: SKIP,
               operation: SKIP, transaction_id: SKIP,
               transaction_date: SKIP, transaction_type: SKIP,
               merchant_reference: SKIP, card_scheme: SKIP, card_type: SKIP,
               is_european_card: SKIP, is_corporate_card: SKIP,
               card_mask: SKIP, capture_method: SKIP, issuer_country: SKIP,
               merchant_custom_data: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @processed_date = processed_date unless processed_date == SKIP
  @settlement_date = settlement_date unless settlement_date == SKIP
  @merchant_id = merchant_id unless merchant_id == SKIP
  @merchant_name = merchant_name unless merchant_name == SKIP
  @amount = amount unless amount == SKIP
  @acquirer_fee = acquirer_fee unless acquirer_fee == SKIP
  @amount_to_merchant = amount_to_merchant unless amount_to_merchant == SKIP
  @currency = currency unless currency == SKIP
  @operation = operation unless operation == SKIP
  @transaction_id = transaction_id unless transaction_id == SKIP
  @transaction_date = transaction_date unless transaction_date == SKIP
  @transaction_type = transaction_type unless transaction_type == SKIP
  @merchant_reference = merchant_reference unless merchant_reference == SKIP
  @card_scheme = card_scheme unless card_scheme == SKIP
  @card_type = card_type unless card_type == SKIP
  @is_european_card = is_european_card unless is_european_card == SKIP
  @is_corporate_card = is_corporate_card unless is_corporate_card == SKIP
  @card_mask = card_mask unless card_mask == SKIP
  @capture_method = capture_method unless capture_method == SKIP
  @issuer_country = issuer_country unless issuer_country == SKIP
  @merchant_custom_data = merchant_custom_data unless merchant_custom_data == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#acquirer_feeFloat

Acquiring fee charged for processing the transaction.

Returns:

  • (Float)


35
36
37
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 35

def acquirer_fee
  @acquirer_fee
end

#amountFloat

Original requested transaction amount.

Returns:

  • (Float)


31
32
33
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 31

def amount
  @amount
end

#amount_to_merchantFloat

Amount settled to the merchant.

Returns:

  • (Float)


39
40
41
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 39

def amount_to_merchant
  @amount_to_merchant
end

#capture_methodCaptureMethod

Capture method for the transaction.

Returns:



89
90
91
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 89

def capture_method
  @capture_method
end

#card_maskString

Masked PAN for the payment card used; contains the first six and last four digits.

Returns:

  • (String)


85
86
87
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 85

def card_mask
  @card_mask
end

#card_schemeString

Card scheme used in the transaction.

Returns:

  • (String)


68
69
70
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 68

def card_scheme
  @card_scheme
end

#card_typeCardType

Type of card used in the transaction.

Returns:



72
73
74
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 72

def card_type
  @card_type
end

#currencyString

Currency of the transaction, e.g. GBP.

Returns:

  • (String)


43
44
45
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 43

def currency
  @currency
end

#is_corporate_cardTrueClass | FalseClass

Whether the card used is a corporate card.

Returns:

  • (TrueClass | FalseClass)


80
81
82
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 80

def is_corporate_card
  @is_corporate_card
end

#is_european_cardTrueClass | FalseClass

Whether the card used is issued in Europe (including the UK).

Returns:

  • (TrueClass | FalseClass)


76
77
78
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 76

def is_european_card
  @is_european_card
end

#issuer_countryString

Country in which the payment card was issued. ISO 3166-1 alpha-3. Null if it cannot be determined.

Returns:

  • (String)


94
95
96
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 94

def issuer_country
  @issuer_country
end

#merchant_custom_dataString

Custom data provided by the integrated solution for the transaction.

Returns:

  • (String)


98
99
100
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 98

def merchant_custom_data
  @merchant_custom_data
end

#merchant_idString

Unique ID for the merchant, allocated by DNA Payments.

Returns:

  • (String)


23
24
25
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 23

def merchant_id
  @merchant_id
end

#merchant_nameString

Name of the merchant who processed the transaction.

Returns:

  • (String)


27
28
29
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 27

def merchant_name
  @merchant_name
end

#merchant_referenceString

Unique order number allocated by the merchant.

Returns:

  • (String)


64
65
66
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 64

def merchant_reference
  @merchant_reference
end

#operationOperation

Confirmation of the operation performed.

Returns:



47
48
49
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 47

def operation
  @operation
end

#processed_dateDate

Date that the settlement process was started.

Returns:

  • (Date)


15
16
17
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 15

def processed_date
  @processed_date
end

#settlement_dateDate

Date that the transaction was settled.

Returns:

  • (Date)


19
20
21
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 19

def settlement_date
  @settlement_date
end

#transaction_dateDateTime

Date/time the transaction was processed.

Returns:

  • (DateTime)


55
56
57
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 55

def transaction_date
  @transaction_date
end

#transaction_idString

Unique transaction ID. Null for non-transactional fees.

Returns:

  • (String)


51
52
53
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 51

def transaction_id
  @transaction_id
end

#transaction_typeTransactionType

Type of transaction/fee recorded in the Settlement (and, by reference, POS Reporting) API.

Returns:



60
61
62
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 60

def transaction_type
  @transaction_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 208

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  processed_date = hash.key?('processedDate') ? hash['processedDate'] : SKIP
  settlement_date =
    hash.key?('settlementDate') ? hash['settlementDate'] : SKIP
  merchant_id = hash.key?('merchantId') ? hash['merchantId'] : SKIP
  merchant_name = hash.key?('merchantName') ? hash['merchantName'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  acquirer_fee = hash.key?('acquirerFee') ? hash['acquirerFee'] : SKIP
  amount_to_merchant =
    hash.key?('amountToMerchant') ? hash['amountToMerchant'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  operation = hash.key?('operation') ? hash['operation'] : SKIP
  transaction_id = hash.key?('transactionId') ? hash['transactionId'] : SKIP
  transaction_date = if hash.key?('transactionDate')
                       (DateTimeHelper.from_rfc3339(hash['transactionDate']) if hash['transactionDate'])
                     else
                       SKIP
                     end
  transaction_type =
    hash.key?('transactionType') ? hash['transactionType'] : SKIP
  merchant_reference =
    hash.key?('merchantReference') ? hash['merchantReference'] : SKIP
  card_scheme = hash.key?('cardScheme') ? hash['cardScheme'] : SKIP
  card_type = hash.key?('cardType') ? hash['cardType'] : SKIP
  is_european_card =
    hash.key?('isEuropeanCard') ? hash['isEuropeanCard'] : SKIP
  is_corporate_card =
    hash.key?('isCorporateCard') ? hash['isCorporateCard'] : SKIP
  card_mask = hash.key?('cardMask') ? hash['cardMask'] : SKIP
  capture_method = hash.key?('captureMethod') ? hash['captureMethod'] : SKIP
  issuer_country = hash.key?('issuerCountry') ? hash['issuerCountry'] : SKIP
  merchant_custom_data =
    hash.key?('merchantCustomData') ? hash['merchantCustomData'] : 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.
  Settlement.new(processed_date: processed_date,
                 settlement_date: settlement_date,
                 merchant_id: merchant_id,
                 merchant_name: merchant_name,
                 amount: amount,
                 acquirer_fee: acquirer_fee,
                 amount_to_merchant: amount_to_merchant,
                 currency: currency,
                 operation: operation,
                 transaction_id: transaction_id,
                 transaction_date: transaction_date,
                 transaction_type: transaction_type,
                 merchant_reference: merchant_reference,
                 card_scheme: card_scheme,
                 card_type: card_type,
                 is_european_card: is_european_card,
                 is_corporate_card: is_corporate_card,
                 card_mask: card_mask,
                 capture_method: capture_method,
                 issuer_country: issuer_country,
                 merchant_custom_data: merchant_custom_data,
                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['processed_date'] = 'processedDate'
  @_hash['settlement_date'] = 'settlementDate'
  @_hash['merchant_id'] = 'merchantId'
  @_hash['merchant_name'] = 'merchantName'
  @_hash['amount'] = 'amount'
  @_hash['acquirer_fee'] = 'acquirerFee'
  @_hash['amount_to_merchant'] = 'amountToMerchant'
  @_hash['currency'] = 'currency'
  @_hash['operation'] = 'operation'
  @_hash['transaction_id'] = 'transactionId'
  @_hash['transaction_date'] = 'transactionDate'
  @_hash['transaction_type'] = 'transactionType'
  @_hash['merchant_reference'] = 'merchantReference'
  @_hash['card_scheme'] = 'cardScheme'
  @_hash['card_type'] = 'cardType'
  @_hash['is_european_card'] = 'isEuropeanCard'
  @_hash['is_corporate_card'] = 'isCorporateCard'
  @_hash['card_mask'] = 'cardMask'
  @_hash['capture_method'] = 'captureMethod'
  @_hash['issuer_country'] = 'issuerCountry'
  @_hash['merchant_custom_data'] = 'merchantCustomData'
  @_hash
end

.nullablesObject

An array for nullable fields



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 155

def self.nullables
  %w[
    settlement_date
    transaction_id
    merchant_reference
    card_scheme
    card_type
    is_european_card
    is_corporate_card
    card_mask
    capture_method
    issuer_country
    merchant_custom_data
  ]
end

.optionalsObject

An array for optional fields



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
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 128

def self.optionals
  %w[
    processed_date
    settlement_date
    merchant_id
    merchant_name
    amount
    acquirer_fee
    amount_to_merchant
    currency
    operation
    transaction_id
    transaction_date
    transaction_type
    merchant_reference
    card_scheme
    card_type
    is_european_card
    is_corporate_card
    card_mask
    capture_method
    issuer_country
    merchant_custom_data
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 297

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} processed_date: #{@processed_date.inspect}, settlement_date:"\
  " #{@settlement_date.inspect}, merchant_id: #{@merchant_id.inspect}, merchant_name:"\
  " #{@merchant_name.inspect}, amount: #{@amount.inspect}, acquirer_fee:"\
  " #{@acquirer_fee.inspect}, amount_to_merchant: #{@amount_to_merchant.inspect}, currency:"\
  " #{@currency.inspect}, operation: #{@operation.inspect}, transaction_id:"\
  " #{@transaction_id.inspect}, transaction_date: #{@transaction_date.inspect},"\
  " transaction_type: #{@transaction_type.inspect}, merchant_reference:"\
  " #{@merchant_reference.inspect}, card_scheme: #{@card_scheme.inspect}, card_type:"\
  " #{@card_type.inspect}, is_european_card: #{@is_european_card.inspect}, is_corporate_card:"\
  " #{@is_corporate_card.inspect}, card_mask: #{@card_mask.inspect}, capture_method:"\
  " #{@capture_method.inspect}, issuer_country: #{@issuer_country.inspect},"\
  " merchant_custom_data: #{@merchant_custom_data.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_transaction_dateObject



277
278
279
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 277

def to_custom_transaction_date
  DateTimeHelper.to_rfc3339(transaction_date)
end

#to_sObject

Provides a human-readable string representation of the object.



282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb', line 282

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} processed_date: #{@processed_date}, settlement_date: #{@settlement_date},"\
  " merchant_id: #{@merchant_id}, merchant_name: #{@merchant_name}, amount: #{@amount},"\
  " acquirer_fee: #{@acquirer_fee}, amount_to_merchant: #{@amount_to_merchant}, currency:"\
  " #{@currency}, operation: #{@operation}, transaction_id: #{@transaction_id},"\
  " transaction_date: #{@transaction_date}, transaction_type: #{@transaction_type},"\
  " merchant_reference: #{@merchant_reference}, card_scheme: #{@card_scheme}, card_type:"\
  " #{@card_type}, is_european_card: #{@is_european_card}, is_corporate_card:"\
  " #{@is_corporate_card}, card_mask: #{@card_mask}, capture_method: #{@capture_method},"\
  " issuer_country: #{@issuer_country}, merchant_custom_data: #{@merchant_custom_data},"\
  " additional_properties: #{@additional_properties}>"
end