Class: PaysecureApiDocumentationLive::CancelException

Inherits:
APIException
  • Object
show all
Defined in:
lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb

Overview

Cancel class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ CancelException

The constructor.

Parameters:

  • reason (String)

    The reason for raising an exception.

  • response (HttpResponse)

    The HttpReponse of the API call.



219
220
221
222
223
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 219

def initialize(reason, response)
  super(reason, response)
  hash = APIHelper.json_deserialize(@response.raw_body)
  unbox(hash)
end

Instance Attribute Details

#amount_unitString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 34

def amount_unit
  @amount_unit
end

#brand_idString

TODO: Write general description for this method

Returns:

  • (String)


90
91
92
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 90

def brand_id
  @brand_id
end

#cancel_redirectString

TODO: Write general description for this method

Returns:

  • (String)


186
187
188
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 186

def cancel_redirect
  @cancel_redirect
end

#cc_descriptorString

TODO: Write general description for this method

Returns:

  • (String)


122
123
124
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 122

def cc_descriptor
  @cc_descriptor
end

#checkout_urlString

TODO: Write general description for this method

Returns:

  • (String)


206
207
208
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 206

def checkout_url
  @checkout_url
end

#clientClient52

TODO: Write general description for this method

Returns:



18
19
20
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 18

def client
  @client
end

#created_from_ipString

TODO: Write general description for this method

Returns:

  • (String)


202
203
204
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 202

def created_from_ip
  @created_from_ip
end

#created_onInteger

TODO: Write general description for this method

Returns:

  • (Integer)


50
51
52
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 50

def created_on
  @created_on
end

#direct_post_urlString

TODO: Write general description for this method

Returns:

  • (String)


210
211
212
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 210

def direct_post_url
  @direct_post_url
end

#dueInteger

TODO: Write general description for this method

Returns:

  • (Integer)


114
115
116
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 114

def due
  @due
end

#error_codeString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 42

def error_code
  @error_code
end

#error_msgString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 38

def error_msg
  @error_msg
end

#extra_feeString

TODO: Write general description for this method

Returns:

  • (String)


134
135
136
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 134

def extra_fee
  @extra_fee
end

#extra_paramExtraParam26

TODO: Write general description for this method

Returns:



54
55
56
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 54

def extra_param
  @extra_param
end

#failure_callbackString

TODO: Write general description for this method

Returns:

  • (String)


194
195
196
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 194

def failure_callback
  @failure_callback
end

#failure_redirectString

TODO: Write general description for this method

Returns:

  • (String)


182
183
184
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 182

def failure_redirect
  @failure_redirect
end

#force_recurringTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


46
47
48
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 46

def force_recurring
  @force_recurring
end

#fraud_scoreString

TODO: Write general description for this method

Returns:

  • (String)


126
127
128
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 126

def fraud_score
  @fraud_score
end

#is_recurring_tokenTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


98
99
100
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 98

def is_recurring_token
  @is_recurring_token
end

#is_testTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


86
87
88
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 86

def is_test
  @is_test
end

#issuedString

TODO: Write general description for this method

Returns:

  • (String)


110
111
112
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 110

def issued
  @issued
end

#issuer_detailsIssuerDetails

TODO: Write general description for this method

Returns:



70
71
72
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 70

def issuer_details
  @issuer_details
end

#merchant_refString

TODO: Write general description for this method

Returns:

  • (String)


58
59
60
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 58

def merchant_ref
  @merchant_ref
end

TODO: Write general description for this method

Returns:

  • (Integer)


146
147
148
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 146

def paid_on
  @paid_on
end

#pay_in_detailsObject

TODO: Write general description for this method

Returns:

  • (Object)


142
143
144
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 142

def pay_in_details
  @pay_in_details
end

#paymentPayment3

TODO: Write general description for this method

Returns:



66
67
68
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 66

def payment
  @payment
end

#payment_methodString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 30

def payment_method
  @payment_method
end

#payout_processTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


214
215
216
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 214

def payout_process
  @payout_process
end

#pix_payloadObject

TODO: Write general description for this method

Returns:

  • (Object)


138
139
140
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 138

def pix_payload
  @pix_payload
end

#platformString

TODO: Write general description for this method

Returns:

  • (String)


198
199
200
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 198

def platform
  @platform
end

#purchasePurchase1

TODO: Write general description for this method

Returns:



62
63
64
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 62

def purchase
  @purchase
end

#purchase_idString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 14

def purchase_id
  @purchase_id
end

#received_amtFloat

TODO: Write general description for this method

Returns:

  • (Float)


150
151
152
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 150

def received_amt
  @received_amt
end

#reference_generatedString

TODO: Write general description for this method

Returns:

  • (String)


106
107
108
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 106

def reference_generated
  @reference_generated
end

#refund_availabilityString

TODO: Write general description for this method

Returns:

  • (String)


170
171
172
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 170

def refund_availability
  @refund_availability
end

#refund_uptoInteger

TODO: Write general description for this method

Returns:

  • (Integer)


118
119
120
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 118

def refund_upto
  @refund_upto
end

#refundable_amountFloat

TODO: Write general description for this method

Returns:

  • (Float)


174
175
176
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 174

def refundable_amount
  @refundable_amount
end

#send_receiptTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


94
95
96
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 94

def send_receipt
  @send_receipt
end

#session_idString

TODO: Write general description for this method

Returns:

  • (String)


166
167
168
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 166

def session_id
  @session_id
end

#skip_captureTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


102
103
104
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 102

def skip_capture
  @skip_capture
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


78
79
80
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 78

def status
  @status
end

#status_historyArray[StatusHistory]

TODO: Write general description for this method

Returns:



82
83
84
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 82

def status_history
  @status_history
end

#success_callbackString

TODO: Write general description for this method

Returns:

  • (String)


190
191
192
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 190

def success_callback
  @success_callback
end

#success_redirectString

TODO: Write general description for this method

Returns:

  • (String)


178
179
180
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 178

def success_redirect
  @success_redirect
end

#surchargeFloat

TODO: Write general description for this method

Returns:

  • (Float)


158
159
160
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 158

def surcharge
  @surcharge
end

#surcharge_typeString

TODO: Write general description for this method

Returns:

  • (String)


162
163
164
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 162

def surcharge_type
  @surcharge_type
end

#tax_amountFloat

TODO: Write general description for this method

Returns:

  • (Float)


154
155
156
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 154

def tax_amount
  @tax_amount
end

#transaction_dataTransactionData40

TODO: Write general description for this method

Returns:



74
75
76
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 74

def transaction_data
  @transaction_data
end

#trust_scoreString

TODO: Write general description for this method

Returns:

  • (String)


130
131
132
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 130

def trust_score
  @trust_score
end

#typeString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 26

def type
  @type
end

#updated_onInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 22

def updated_on
  @updated_on
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 332

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} purchase_id: #{@purchase_id.inspect}, client: #{@client.inspect},"\
  " updated_on: #{@updated_on.inspect}, type: #{@type.inspect}, payment_method:"\
  " #{@payment_method.inspect}, amount_unit: #{@amount_unit.inspect}, error_msg:"\
  " #{@error_msg.inspect}, error_code: #{@error_code.inspect}, force_recurring:"\
  " #{@force_recurring.inspect}, created_on: #{@created_on.inspect}, extra_param:"\
  " #{@extra_param.inspect}, merchant_ref: #{@merchant_ref.inspect}, purchase:"\
  " #{@purchase.inspect}, payment: #{@payment.inspect}, issuer_details:"\
  " #{@issuer_details.inspect}, transaction_data: #{@transaction_data.inspect}, status:"\
  " #{@status.inspect}, status_history: #{@status_history.inspect}, is_test:"\
  " #{@is_test.inspect}, brand_id: #{@brand_id.inspect}, send_receipt:"\
  " #{@send_receipt.inspect}, is_recurring_token: #{@is_recurring_token.inspect},"\
  " skip_capture: #{@skip_capture.inspect}, reference_generated:"\
  " #{@reference_generated.inspect}, issued: #{@issued.inspect}, due: #{@due.inspect},"\
  " refund_upto: #{@refund_upto.inspect}, cc_descriptor: #{@cc_descriptor.inspect},"\
  " fraud_score: #{@fraud_score.inspect}, trust_score: #{@trust_score.inspect}, extra_fee:"\
  " #{@extra_fee.inspect}, pix_payload: #{@pix_payload.inspect}, pay_in_details:"\
  " #{@pay_in_details.inspect}, paid_on: #{@paid_on.inspect}, received_amt:"\
  " #{@received_amt.inspect}, tax_amount: #{@tax_amount.inspect}, surcharge:"\
  " #{@surcharge.inspect}, surcharge_type: #{@surcharge_type.inspect}, session_id:"\
  " #{@session_id.inspect}, refund_availability: #{@refund_availability.inspect},"\
  " refundable_amount: #{@refundable_amount.inspect}, success_redirect:"\
  " #{@success_redirect.inspect}, failure_redirect: #{@failure_redirect.inspect},"\
  " cancel_redirect: #{@cancel_redirect.inspect}, success_callback:"\
  " #{@success_callback.inspect}, failure_callback: #{@failure_callback.inspect}, platform:"\
  " #{@platform.inspect}, created_from_ip: #{@created_from_ip.inspect}, checkout_url:"\
  " #{@checkout_url.inspect}, direct_post_url: #{@direct_post_url.inspect}, payout_process:"\
  " #{@payout_process.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 307

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} purchase_id: #{@purchase_id}, client: #{@client}, updated_on:"\
  " #{@updated_on}, type: #{@type}, payment_method: #{@payment_method}, amount_unit:"\
  " #{@amount_unit}, error_msg: #{@error_msg}, error_code: #{@error_code}, force_recurring:"\
  " #{@force_recurring}, created_on: #{@created_on}, extra_param: #{@extra_param},"\
  " merchant_ref: #{@merchant_ref}, purchase: #{@purchase}, payment: #{@payment},"\
  " issuer_details: #{@issuer_details}, transaction_data: #{@transaction_data}, status:"\
  " #{@status}, status_history: #{@status_history}, is_test: #{@is_test}, brand_id:"\
  " #{@brand_id}, send_receipt: #{@send_receipt}, is_recurring_token: #{@is_recurring_token},"\
  " skip_capture: #{@skip_capture}, reference_generated: #{@reference_generated}, issued:"\
  " #{@issued}, due: #{@due}, refund_upto: #{@refund_upto}, cc_descriptor: #{@cc_descriptor},"\
  " fraud_score: #{@fraud_score}, trust_score: #{@trust_score}, extra_fee: #{@extra_fee},"\
  " pix_payload: #{@pix_payload}, pay_in_details: #{@pay_in_details}, paid_on: #{@paid_on},"\
  " received_amt: #{@received_amt}, tax_amount: #{@tax_amount}, surcharge: #{@surcharge},"\
  " surcharge_type: #{@surcharge_type}, session_id: #{@session_id}, refund_availability:"\
  " #{@refund_availability}, refundable_amount: #{@refundable_amount}, success_redirect:"\
  " #{@success_redirect}, failure_redirect: #{@failure_redirect}, cancel_redirect:"\
  " #{@cancel_redirect}, success_callback: #{@success_callback}, failure_callback:"\
  " #{@failure_callback}, platform: #{@platform}, created_from_ip: #{@created_from_ip},"\
  " checkout_url: #{@checkout_url}, direct_post_url: #{@direct_post_url}, payout_process:"\
  " #{@payout_process}>"
end

#unbox(hash) ⇒ Object

Populates this object by extracting properties from a hash. response body.

Parameters:

  • hash (Hash)

    The deserialized response sent by the server in the



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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb', line 228

def unbox(hash)
  return nil unless hash

  @purchase_id = hash.key?('purchaseId') ? hash['purchaseId'] : nil
  @client = Client52.from_hash(hash['client']) if hash['client']
  @updated_on = hash.key?('updated_on') ? hash['updated_on'] : nil
  @type = hash.key?('type') ? hash['type'] : nil
  @payment_method = hash.key?('paymentMethod') ? hash['paymentMethod'] : nil
  @amount_unit = hash.key?('amountUnit') ? hash['amountUnit'] : nil
  @error_msg = hash.key?('errorMsg') ? hash['errorMsg'] : nil
  @error_code = hash.key?('errorCode') ? hash['errorCode'] : nil
  @force_recurring =
    hash.key?('force_recurring') ? hash['force_recurring'] : nil
  @created_on = hash.key?('created_on') ? hash['created_on'] : nil
  @extra_param = ExtraParam26.from_hash(hash['extraParam']) if hash['extraParam']
  @merchant_ref = hash.key?('merchantRef') ? hash['merchantRef'] : nil
  @purchase = Purchase1.from_hash(hash['purchase']) if hash['purchase']
  @payment = Payment3.from_hash(hash['payment']) if hash['payment']
  @issuer_details = IssuerDetails.from_hash(hash['issuer_details']) if hash['issuer_details']
  @transaction_data = TransactionData40.from_hash(hash['transaction_data']) if
    hash['transaction_data']
  @status = hash.key?('status') ? hash['status'] : nil
  # Parameter is an array, so we need to iterate through it
  @status_history = nil
  unless hash['status_history'].nil?
    @status_history = []
    hash['status_history'].each do |structure|
      @status_history << (StatusHistory.from_hash(structure) if structure)
    end
  end

  @status_history = nil unless hash.key?('status_history')
  @is_test = hash.key?('is_test') ? hash['is_test'] : nil
  @brand_id = hash.key?('brand_id') ? hash['brand_id'] : nil
  @send_receipt = hash.key?('send_receipt') ? hash['send_receipt'] : nil
  @is_recurring_token =
    hash.key?('is_recurring_token') ? hash['is_recurring_token'] : nil
  @skip_capture = hash.key?('skip_capture') ? hash['skip_capture'] : nil
  @reference_generated =
    hash.key?('reference_generated') ? hash['reference_generated'] : nil
  @issued = hash.key?('issued') ? hash['issued'] : nil
  @due = hash.key?('due') ? hash['due'] : nil
  @refund_upto = hash.key?('refund_upto') ? hash['refund_upto'] : nil
  @cc_descriptor = hash.key?('cc_descriptor') ? hash['cc_descriptor'] : nil
  @fraud_score = hash.key?('fraudScore') ? hash['fraudScore'] : nil
  @trust_score = hash.key?('trustScore') ? hash['trustScore'] : nil
  @extra_fee = hash.key?('extraFee') ? hash['extraFee'] : nil
  @pix_payload = hash.key?('pix_payload') ? hash['pix_payload'] : nil
  @pay_in_details = hash.key?('payInDetails') ? hash['payInDetails'] : nil
  @paid_on = hash.key?('paidOn') ? hash['paidOn'] : nil
  @received_amt = hash.key?('receivedAmt') ? hash['receivedAmt'] : nil
  @tax_amount = hash.key?('taxAmount') ? hash['taxAmount'] : nil
  @surcharge = hash.key?('surcharge') ? hash['surcharge'] : nil
  @surcharge_type = hash.key?('surchargeType') ? hash['surchargeType'] : nil
  @session_id = hash.key?('sessionId') ? hash['sessionId'] : nil
  @refund_availability =
    hash.key?('refund_availability') ? hash['refund_availability'] : nil
  @refundable_amount =
    hash.key?('refundable_amount') ? hash['refundable_amount'] : nil
  @success_redirect =
    hash.key?('success_redirect') ? hash['success_redirect'] : nil
  @failure_redirect =
    hash.key?('failure_redirect') ? hash['failure_redirect'] : nil
  @cancel_redirect =
    hash.key?('cancel_redirect') ? hash['cancel_redirect'] : nil
  @success_callback =
    hash.key?('success_callback') ? hash['success_callback'] : nil
  @failure_callback =
    hash.key?('failure_callback') ? hash['failure_callback'] : nil
  @platform = hash.key?('platform') ? hash['platform'] : nil
  @created_from_ip =
    hash.key?('created_from_ip') ? hash['created_from_ip'] : nil
  @checkout_url = hash.key?('checkout_url') ? hash['checkout_url'] : nil
  @direct_post_url =
    hash.key?('direct_post_url') ? hash['direct_post_url'] : nil
  @payout_process = hash.key?('payoutProcess') ? hash['payoutProcess'] : nil
end