Class: DnaPaymentsPartnerReportingSettlementApIs::PosTransaction
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- DnaPaymentsPartnerReportingSettlementApIs::PosTransaction
- Defined in:
- lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb
Overview
PosTransaction Model.
Instance Attribute Summary collapse
-
#amount ⇒ Float
Transaction amount.
-
#capture_method ⇒ CaptureMethod
Capture method for the transaction.
-
#card_mask ⇒ String
Masked PAN for the payment card used; contains the first six and last four digits.
-
#card_scheme ⇒ String
Card scheme used in the transaction, e.g.
-
#card_type ⇒ String
Type of card used in the transaction.
-
#currency ⇒ String
Transaction currency code.
-
#is_corporate_card ⇒ TrueClass | FalseClass
Whether the card used is a corporate card.
-
#is_european_card ⇒ TrueClass | FalseClass
Whether the card used was issued in Europe (including the UK).
-
#merchant_id ⇒ String
Unique ID for the merchant, allocated by DNA Payments.
-
#merchant_name ⇒ String
Name of the merchant.
-
#operation ⇒ Operation
Confirmation of the operation performed.
-
#return_code ⇒ String
Response code returned by the Acquirer during the authorisation process.
-
#return_code_description ⇒ String
Description of the returnCode returned by the Acquirer.
-
#status ⇒ Status1
success: successful transaction.
-
#terminal_id ⇒ String
Unique Terminal ID for the merchant, allocated by DNA Payments.
-
#transaction_city ⇒ String
City where the transaction was processed.
-
#transaction_country ⇒ String
Country where the transaction was processed.
-
#transaction_date ⇒ DateTime
Date/time the transaction was created on the DNA Platform.
-
#transaction_id ⇒ String
Unique ID allocated to the transaction.
-
#transaction_type ⇒ TransactionType
Type of transaction/fee recorded in the Settlement (and, by reference, POS Reporting) API.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(merchant_id: SKIP, merchant_name: SKIP, transaction_date: SKIP, amount: SKIP, currency: SKIP, status: SKIP, return_code: SKIP, return_code_description: SKIP, transaction_id: SKIP, terminal_id: SKIP, operation: SKIP, transaction_type: SKIP, transaction_country: SKIP, transaction_city: SKIP, card_scheme: SKIP, card_mask: SKIP, card_type: SKIP, is_european_card: SKIP, is_corporate_card: SKIP, capture_method: SKIP, additional_properties: nil) ⇒ PosTransaction
constructor
A new instance of PosTransaction.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_transaction_date ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(merchant_id: SKIP, merchant_name: SKIP, transaction_date: SKIP, amount: SKIP, currency: SKIP, status: SKIP, return_code: SKIP, return_code_description: SKIP, transaction_id: SKIP, terminal_id: SKIP, operation: SKIP, transaction_type: SKIP, transaction_country: SKIP, transaction_city: SKIP, card_scheme: SKIP, card_mask: SKIP, card_type: SKIP, is_european_card: SKIP, is_corporate_card: SKIP, capture_method: SKIP, additional_properties: nil) ⇒ PosTransaction
Returns a new instance of PosTransaction.
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 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 161 def initialize(merchant_id: SKIP, merchant_name: SKIP, transaction_date: SKIP, amount: SKIP, currency: SKIP, status: SKIP, return_code: SKIP, return_code_description: SKIP, transaction_id: SKIP, terminal_id: SKIP, operation: SKIP, transaction_type: SKIP, transaction_country: SKIP, transaction_city: SKIP, card_scheme: SKIP, card_mask: SKIP, card_type: SKIP, is_european_card: SKIP, is_corporate_card: SKIP, capture_method: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @merchant_id = merchant_id unless merchant_id == SKIP @merchant_name = merchant_name unless merchant_name == SKIP @transaction_date = transaction_date unless transaction_date == SKIP @amount = amount unless amount == SKIP @currency = currency unless currency == SKIP @status = status unless status == SKIP @return_code = return_code unless return_code == SKIP @return_code_description = return_code_description unless return_code_description == SKIP @transaction_id = transaction_id unless transaction_id == SKIP @terminal_id = terminal_id unless terminal_id == SKIP @operation = operation unless operation == SKIP @transaction_type = transaction_type unless transaction_type == SKIP @transaction_country = transaction_country unless transaction_country == SKIP @transaction_city = transaction_city unless transaction_city == SKIP @card_scheme = card_scheme unless card_scheme == SKIP @card_mask = card_mask unless card_mask == 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 @capture_method = capture_method unless capture_method == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Float
Transaction amount.
27 28 29 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 27 def amount @amount end |
#capture_method ⇒ CaptureMethod
Capture method for the transaction.
93 94 95 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 93 def capture_method @capture_method end |
#card_mask ⇒ String
Masked PAN for the payment card used; contains the first six and last four digits.
77 78 79 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 77 def card_mask @card_mask end |
#card_scheme ⇒ String
Card scheme used in the transaction, e.g. mastercard, visa.
72 73 74 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 72 def card_scheme @card_scheme end |
#card_type ⇒ String
Type of card used in the transaction.
81 82 83 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 81 def card_type @card_type end |
#currency ⇒ String
Transaction currency code. ISO 4217 format, e.g. GBP.
31 32 33 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 31 def currency @currency end |
#is_corporate_card ⇒ TrueClass | FalseClass
Whether the card used is a corporate card.
89 90 91 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 89 def is_corporate_card @is_corporate_card end |
#is_european_card ⇒ TrueClass | FalseClass
Whether the card used was issued in Europe (including the UK).
85 86 87 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 85 def is_european_card @is_european_card end |
#merchant_id ⇒ String
Unique ID for the merchant, allocated by DNA Payments.
15 16 17 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 15 def merchant_id @merchant_id end |
#merchant_name ⇒ String
Name of the merchant.
19 20 21 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 19 def merchant_name @merchant_name end |
#operation ⇒ Operation
Confirmation of the operation performed.
55 56 57 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 55 def operation @operation end |
#return_code ⇒ String
Response code returned by the Acquirer during the authorisation process.
39 40 41 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 39 def return_code @return_code end |
#return_code_description ⇒ String
Description of the returnCode returned by the Acquirer.
43 44 45 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 43 def return_code_description @return_code_description end |
#status ⇒ Status1
success: successful transaction. failed: failed transaction.
35 36 37 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 35 def status @status end |
#terminal_id ⇒ String
Unique Terminal ID for the merchant, allocated by DNA Payments.
51 52 53 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 51 def terminal_id @terminal_id end |
#transaction_city ⇒ String
City where the transaction was processed.
68 69 70 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 68 def transaction_city @transaction_city end |
#transaction_country ⇒ String
Country where the transaction was processed.
64 65 66 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 64 def transaction_country @transaction_country end |
#transaction_date ⇒ DateTime
Date/time the transaction was created on the DNA Platform.
23 24 25 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 23 def transaction_date @transaction_date end |
#transaction_id ⇒ String
Unique ID allocated to the transaction.
47 48 49 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 47 def transaction_id @transaction_id end |
#transaction_type ⇒ TransactionType
Type of transaction/fee recorded in the Settlement (and, by reference, POS Reporting) API.
60 61 62 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.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.
197 198 199 200 201 202 203 204 205 206 207 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 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 197 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. merchant_id = hash.key?('merchantId') ? hash['merchantId'] : SKIP merchant_name = hash.key?('merchantName') ? hash['merchantName'] : SKIP transaction_date = if hash.key?('transactionDate') (DateTimeHelper.from_rfc3339(hash['transactionDate']) if hash['transactionDate']) else SKIP end amount = hash.key?('amount') ? hash['amount'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP return_code = hash.key?('returnCode') ? hash['returnCode'] : SKIP return_code_description = hash.key?('returnCodeDescription') ? hash['returnCodeDescription'] : SKIP transaction_id = hash.key?('transactionId') ? hash['transactionId'] : SKIP terminal_id = hash.key?('terminalId') ? hash['terminalId'] : SKIP operation = hash.key?('operation') ? hash['operation'] : SKIP transaction_type = hash.key?('transactionType') ? hash['transactionType'] : SKIP transaction_country = hash.key?('transactionCountry') ? hash['transactionCountry'] : SKIP transaction_city = hash.key?('transactionCity') ? hash['transactionCity'] : SKIP card_scheme = hash.key?('cardScheme') ? hash['cardScheme'] : SKIP card_mask = hash.key?('cardMask') ? hash['cardMask'] : 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 capture_method = hash.key?('captureMethod') ? hash['captureMethod'] : 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. PosTransaction.new(merchant_id: merchant_id, merchant_name: merchant_name, transaction_date: transaction_date, amount: amount, currency: currency, status: status, return_code: return_code, return_code_description: return_code_description, transaction_id: transaction_id, terminal_id: terminal_id, operation: operation, transaction_type: transaction_type, transaction_country: transaction_country, transaction_city: transaction_city, card_scheme: card_scheme, card_mask: card_mask, card_type: card_type, is_european_card: is_european_card, is_corporate_card: is_corporate_card, capture_method: capture_method, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 96 def self.names @_hash = {} if @_hash.nil? @_hash['merchant_id'] = 'merchantId' @_hash['merchant_name'] = 'merchantName' @_hash['transaction_date'] = 'transactionDate' @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash['status'] = 'status' @_hash['return_code'] = 'returnCode' @_hash['return_code_description'] = 'returnCodeDescription' @_hash['transaction_id'] = 'transactionId' @_hash['terminal_id'] = 'terminalId' @_hash['operation'] = 'operation' @_hash['transaction_type'] = 'transactionType' @_hash['transaction_country'] = 'transactionCountry' @_hash['transaction_city'] = 'transactionCity' @_hash['card_scheme'] = 'cardScheme' @_hash['card_mask'] = 'cardMask' @_hash['card_type'] = 'cardType' @_hash['is_european_card'] = 'isEuropeanCard' @_hash['is_corporate_card'] = 'isCorporateCard' @_hash['capture_method'] = 'captureMethod' @_hash end |
.nullables ⇒ Object
An array for nullable fields
148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 148 def self.nullables %w[ transaction_country transaction_city card_scheme card_mask card_type is_european_card is_corporate_card capture_method ] end |
.optionals ⇒ Object
An array for optional fields
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 122 def self.optionals %w[ merchant_id merchant_name transaction_date amount currency status return_code return_code_description transaction_id terminal_id operation transaction_type transaction_country transaction_city card_scheme card_mask card_type is_european_card is_corporate_card capture_method ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 282 def inspect class_name = self.class.name.split('::').last "<#{class_name} merchant_id: #{@merchant_id.inspect}, merchant_name:"\ " #{@merchant_name.inspect}, transaction_date: #{@transaction_date.inspect}, amount:"\ " #{@amount.inspect}, currency: #{@currency.inspect}, status: #{@status.inspect},"\ " return_code: #{@return_code.inspect}, return_code_description:"\ " #{@return_code_description.inspect}, transaction_id: #{@transaction_id.inspect},"\ " terminal_id: #{@terminal_id.inspect}, operation: #{@operation.inspect}, transaction_type:"\ " #{@transaction_type.inspect}, transaction_country: #{@transaction_country.inspect},"\ " transaction_city: #{@transaction_city.inspect}, card_scheme: #{@card_scheme.inspect},"\ " card_mask: #{@card_mask.inspect}, card_type: #{@card_type.inspect}, is_european_card:"\ " #{@is_european_card.inspect}, is_corporate_card: #{@is_corporate_card.inspect},"\ " capture_method: #{@capture_method.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_transaction_date ⇒ Object
263 264 265 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 263 def to_custom_transaction_date DateTimeHelper.to_rfc3339(transaction_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb', line 268 def to_s class_name = self.class.name.split('::').last "<#{class_name} merchant_id: #{@merchant_id}, merchant_name: #{@merchant_name},"\ " transaction_date: #{@transaction_date}, amount: #{@amount}, currency: #{@currency},"\ " status: #{@status}, return_code: #{@return_code}, return_code_description:"\ " #{@return_code_description}, transaction_id: #{@transaction_id}, terminal_id:"\ " #{@terminal_id}, operation: #{@operation}, transaction_type: #{@transaction_type},"\ " transaction_country: #{@transaction_country}, transaction_city: #{@transaction_city},"\ " card_scheme: #{@card_scheme}, card_mask: #{@card_mask}, card_type: #{@card_type},"\ " is_european_card: #{@is_european_card}, is_corporate_card: #{@is_corporate_card},"\ " capture_method: #{@capture_method}, additional_properties: #{@additional_properties}>" end |