payabli 2.1.5 → 2.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.fern/metadata.json +4 -3
  3. data/.fernignore +1 -0
  4. data/LICENSE.md +8 -0
  5. data/README.md +85 -0
  6. data/lib/payabli/bill/client.rb +19 -6
  7. data/lib/payabli/boarding/client.rb +15 -8
  8. data/lib/payabli/charge_backs/client.rb +11 -5
  9. data/lib/payabli/check_capture/client.rb +2 -4
  10. data/lib/payabli/client.rb +2 -2
  11. data/lib/payabli/cloud/client.rb +12 -6
  12. data/lib/payabli/customer/client.rb +10 -1
  13. data/lib/payabli/export/client.rb +29 -29
  14. data/lib/payabli/hosted_payment_pages/client.rb +7 -0
  15. data/lib/payabli/import/client.rb +3 -0
  16. data/lib/payabli/internal/http/base_request.rb +6 -0
  17. data/lib/payabli/internal/http/raw_client.rb +104 -14
  18. data/lib/payabli/internal/types/model.rb +9 -1
  19. data/lib/payabli/internal/types/union.rb +31 -3
  20. data/lib/payabli/internal/types/utils.rb +17 -2
  21. data/lib/payabli/invoice/client.rb +15 -6
  22. data/lib/payabli/invoice/types/get_invoice_record.rb +1 -1
  23. data/lib/payabli/line_item/client.rb +9 -1
  24. data/lib/payabli/money_in/client.rb +336 -24
  25. data/lib/payabli/money_in/types/get_paid_response_data.rb +1 -1
  26. data/lib/payabli/money_in/types/request_payment_authorize_v_2.rb +13 -0
  27. data/lib/payabli/money_in/types/request_payment_v_2.rb +15 -0
  28. data/lib/payabli/money_in/types/transaction_detail_response_data.rb +2 -0
  29. data/lib/payabli/money_out/client.rb +73 -5
  30. data/lib/payabli/money_out_types/types/allowed_check_payment_status.rb +14 -0
  31. data/lib/payabli/notification/client.rb +5 -0
  32. data/lib/payabli/notificationlogs/client.rb +4 -1
  33. data/lib/payabli/ocr/client.rb +2 -0
  34. data/lib/payabli/organization/client.rb +19 -8
  35. data/lib/payabli/payment_link/client.rb +21 -10
  36. data/lib/payabli/payment_method_domain/client.rb +12 -10
  37. data/lib/payabli/paypoint/client.rb +8 -1
  38. data/lib/payabli/query/client.rb +175 -33
  39. data/lib/payabli/query/types/list_transfer_details_out_request.rb +16 -0
  40. data/lib/payabli/query/types/list_transfers_out_org_request.rb +15 -0
  41. data/lib/payabli/query/types/list_transfers_out_paypoint_request.rb +15 -0
  42. data/lib/payabli/query_types/types/transfer_out_bank_account.rb +14 -0
  43. data/lib/payabli/query_types/types/transfer_out_detail_bill.rb +26 -0
  44. data/lib/payabli/query_types/types/transfer_out_detail_bill_attachment.rb +16 -0
  45. data/lib/payabli/query_types/types/transfer_out_detail_check_data.rb +13 -0
  46. data/lib/payabli/query_types/types/transfer_out_detail_event.rb +14 -0
  47. data/lib/payabli/query_types/types/transfer_out_detail_payment_data.rb +29 -0
  48. data/lib/payabli/query_types/types/transfer_out_detail_query_response.rb +13 -0
  49. data/lib/payabli/query_types/types/transfer_out_detail_record.rb +74 -0
  50. data/lib/payabli/query_types/types/transfer_out_detail_vendor.rb +56 -0
  51. data/lib/payabli/query_types/types/transfer_out_detail_vendor_billing_data.rb +26 -0
  52. data/lib/payabli/query_types/types/transfer_out_event_data.rb +16 -0
  53. data/lib/payabli/query_types/types/transfer_out_message.rb +19 -0
  54. data/lib/payabli/query_types/types/transfer_out_message_properties.rb +13 -0
  55. data/lib/payabli/query_types/types/transfer_out_query_response.rb +13 -0
  56. data/lib/payabli/query_types/types/transfer_out_record.rb +45 -0
  57. data/lib/payabli/query_types/types/transfer_out_summary.rb +14 -0
  58. data/lib/payabli/statistic/client.rb +4 -4
  59. data/lib/payabli/subscription/client.rb +12 -6
  60. data/lib/payabli/templates/client.rb +4 -1
  61. data/lib/payabli/token_storage/client.rb +8 -3
  62. data/lib/payabli/token_storage/types/get_method_response_response_data.rb +3 -0
  63. data/lib/payabli/token_storage/types/get_method_response_response_data_vendors_item.rb +55 -0
  64. data/lib/payabli/token_storage/types/request_token_storage.rb +1 -0
  65. data/lib/payabli/token_storage/types/vendor_data_request.rb +14 -0
  66. data/lib/payabli/types/application_data.rb +1 -0
  67. data/lib/payabli/types/application_data_managed.rb +1 -0
  68. data/lib/payabli/types/application_data_odp.rb +1 -0
  69. data/lib/payabli/types/application_data_pay_in.rb +1 -0
  70. data/lib/payabli/types/{avsresponsetext.rb → avs_response.rb} +2 -2
  71. data/lib/payabli/types/{cvvresponsetext.rb → avs_response_text.rb} +2 -2
  72. data/lib/payabli/types/bill_data.rb +1 -1
  73. data/lib/payabli/types/customer_vault_id.rb +23 -0
  74. data/lib/payabli/types/cvv_response.rb +23 -0
  75. data/lib/payabli/types/cvv_response_text.rb +23 -0
  76. data/lib/payabli/types/emv_auth_response_data.rb +23 -0
  77. data/lib/payabli/types/max_ticket.rb +23 -0
  78. data/lib/payabli/types/min_ticket.rb +23 -0
  79. data/lib/payabli/types/on_create.rb +23 -0
  80. data/lib/payabli/types/query_response_data.rb +2 -0
  81. data/lib/payabli/types/query_subscription_response.rb +1 -1
  82. data/lib/payabli/types/query_transaction_payor_data.rb +1 -1
  83. data/lib/payabli/types/result_code_text.rb +23 -0
  84. data/lib/payabli/types/result_codev_2.rb +23 -0
  85. data/lib/payabli/types/transaction_query_records_customer.rb +1 -1
  86. data/lib/payabli/types/transfer_bank_account.rb +1 -0
  87. data/lib/payabli/user/client.rb +21 -20
  88. data/lib/payabli/v_2_money_in_types/types/v_2_bad_request_error.rb +20 -0
  89. data/lib/payabli/v_2_money_in_types/types/v_2_bad_request_error_detail.rb +13 -0
  90. data/lib/payabli/v_2_money_in_types/types/v_2_declined_transaction_response_wrapper.rb +19 -0
  91. data/lib/payabli/v_2_money_in_types/types/v_2_internal_server_error.rb +16 -0
  92. data/lib/payabli/v_2_money_in_types/types/v_2_response_action.rb +25 -0
  93. data/lib/payabli/v_2_money_in_types/types/v_2_response_code.rb +25 -0
  94. data/lib/payabli/v_2_money_in_types/types/v_2_response_explanation.rb +25 -0
  95. data/lib/payabli/v_2_money_in_types/types/v_2_response_reason.rb +25 -0
  96. data/lib/payabli/v_2_money_in_types/types/v_2_transaction_detail_response_data.rb +27 -0
  97. data/lib/payabli/v_2_money_in_types/types/v_2_transaction_details.rb +64 -0
  98. data/lib/payabli/v_2_money_in_types/types/v_2_transaction_response_wrapper.rb +19 -0
  99. data/lib/payabli/vendor/client.rb +4 -0
  100. data/lib/payabli/version.rb +1 -1
  101. data/lib/payabli/wallet/client.rb +8 -16
  102. data/lib/payabli.rb +51 -7
  103. data/reference.md +3313 -2335
  104. data/wiremock/wiremock-mappings.json +1 -1
  105. metadata +49 -4
@@ -12,9 +12,12 @@ module Payabli
12
12
 
13
13
  # Authorize a card transaction. This returns an authorization code and reserves funds for the merchant. Authorized
14
14
  # transactions aren't flagged for settlement until
15
- # [captured](/api-reference/moneyin/capture-an-authorized-transaction).
16
- #
17
- # **Note**: Only card transactions can be authorized. This endpoint can't be used for ACH transactions.
15
+ # [captured](/developers/api-reference/moneyin/capture-an-authorized-transaction).
16
+ # Only card transactions can be authorized. This endpoint can't be used for ACH transactions.
17
+ # <Tip>
18
+ # Consider migrating to the [v2 Authorize endpoint](/developers/api-reference/moneyinV2/authorize-a-transaction)
19
+ # to take advantage of unified response codes and improved response consistency.
20
+ # </Tip>
18
21
  #
19
22
  # @param request_options [Hash]
20
23
  # @param params [Payabli::MoneyIn::Types::TransRequestBody]
@@ -28,16 +31,20 @@ module Payabli
28
31
  #
29
32
  # @return [Payabli::MoneyIn::Types::AuthResponse]
30
33
  def authorize(request_options: {}, **params)
31
- params = Payabli::Internal::Types::Utils.symbolize_keys(params)
34
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
32
35
  query_param_names = %i[force_customer_creation]
33
36
  query_params = {}
34
37
  query_params["forceCustomerCreation"] = params[:force_customer_creation] if params.key?(:force_customer_creation)
35
38
  params = params.except(*query_param_names)
36
39
 
40
+ headers = {}
41
+ headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]
42
+
37
43
  request = Payabli::Internal::JSON::Request.new(
38
44
  base_url: request_options[:base_url],
39
45
  method: "POST",
40
46
  path: "MoneyIn/authorize",
47
+ headers: headers,
41
48
  query: query_params,
42
49
  body: Payabli::MoneyIn::Types::TransRequestBody.new(params).to_h,
43
50
  request_options: request_options
@@ -58,12 +65,12 @@ module Payabli
58
65
 
59
66
  # <Warning>
60
67
  # This endpoint is deprecated and will be sunset on November 24, 2025. Migrate to [POST
61
- # `/capture/{transId}`](/api-reference/moneyin/capture-an-authorized-transaction)`.
68
+ # `/capture/{transId}`](/developers/api-reference/moneyin/capture-an-authorized-transaction)`.
62
69
  # </Warning>
63
70
  #
64
71
  # Capture an [authorized
65
- # transaction](/api-reference/moneyin/authorize-a-transaction) to complete the transaction and move funds from the
66
- # customer to merchant account.
72
+ # transaction](/developers/api-reference/moneyin/authorize-a-transaction) to complete the transaction and move
73
+ # funds from the customer to merchant account.
67
74
  #
68
75
  # @param request_options [Hash]
69
76
  # @param params [Hash]
@@ -77,6 +84,7 @@ module Payabli
77
84
  #
78
85
  # @return [Payabli::MoneyIn::Types::CaptureResponse]
79
86
  def capture(request_options: {}, **params)
87
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
80
88
  request = Payabli::Internal::JSON::Request.new(
81
89
  base_url: request_options[:base_url],
82
90
  method: "GET",
@@ -97,13 +105,19 @@ module Payabli
97
105
  end
98
106
  end
99
107
 
100
- # Capture an [authorized transaction](/api-reference/moneyin/authorize-a-transaction) to complete the transaction
101
- # and move funds from the customer to merchant account.
108
+ # Capture an [authorized transaction](/developers/api-reference/moneyin/authorize-a-transaction) to complete the
109
+ # transaction and move funds from the customer to merchant account.
102
110
  #
103
111
  # You can use this endpoint to capture both full and partial amounts of the original authorized transaction. See
104
112
  # [Capture an authorized transaction](/developers/developer-guides/pay-in-auth-and-capture) for more information
105
113
  # about this endpoint.
106
114
  #
115
+ # <Tip>
116
+ # Consider migrating to the [v2 Capture
117
+ # endpoint](/developers/api-reference/moneyinV2/capture-an-authorized-transaction) to take advantage of unified
118
+ # response codes and improved response consistency.
119
+ # </Tip>
120
+ #
107
121
  # @param request_options [Hash]
108
122
  # @param params [Payabli::MoneyIn::Types::CaptureRequest]
109
123
  # @option request_options [String] :base_url
@@ -115,6 +129,7 @@ module Payabli
115
129
  #
116
130
  # @return [Payabli::MoneyIn::Types::CaptureResponse]
117
131
  def capture_auth(request_options: {}, **params)
132
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
118
133
  request = Payabli::Internal::JSON::Request.new(
119
134
  base_url: request_options[:base_url],
120
135
  method: "POST",
@@ -153,21 +168,26 @@ module Payabli
153
168
  #
154
169
  # @return [Payabli::Types::PayabliApiResponse0]
155
170
  def credit(request_options: {}, **params)
156
- body_prop_names = %i[account_id customer_data entrypoint order_description order_id payment_details payment_method source subdomain]
157
- body_bag = params.slice(*body_prop_names)
171
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
172
+ request_data = Payabli::MoneyIn::Types::RequestCredit.new(params).to_h
173
+ non_body_param_names = %w[forceCustomerCreation idempotencyKey]
174
+ body = request_data.except(*non_body_param_names)
158
175
 
159
- params = Payabli::Internal::Types::Utils.symbolize_keys(params)
160
176
  query_param_names = %i[force_customer_creation]
161
177
  query_params = {}
162
178
  query_params["forceCustomerCreation"] = params[:force_customer_creation] if params.key?(:force_customer_creation)
163
- params.except(*query_param_names)
179
+ params = params.except(*query_param_names)
180
+
181
+ headers = {}
182
+ headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]
164
183
 
165
184
  request = Payabli::Internal::JSON::Request.new(
166
185
  base_url: request_options[:base_url],
167
186
  method: "POST",
168
187
  path: "MoneyIn/makecredit",
188
+ headers: headers,
169
189
  query: query_params,
170
- body: Payabli::MoneyIn::Types::RequestCredit.new(body_bag).to_h,
190
+ body: body,
171
191
  request_options: request_options
172
192
  )
173
193
  begin
@@ -197,6 +217,7 @@ module Payabli
197
217
  #
198
218
  # @return [Payabli::Types::TransactionQueryRecordsCustomer]
199
219
  def details(request_options: {}, **params)
220
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
200
221
  request = Payabli::Internal::JSON::Request.new(
201
222
  base_url: request_options[:base_url],
202
223
  method: "GET",
@@ -219,6 +240,12 @@ module Payabli
219
240
 
220
241
  # Make a single transaction. This method authorizes and captures a payment in one step.
221
242
  #
243
+ # <Tip>
244
+ # Consider migrating to the [v2 Make a transaction
245
+ # endpoint](/developers/api-reference/moneyinV2/make-a-transaction) to take advantage of unified response codes
246
+ # and improved response consistency.
247
+ # </Tip>
248
+ #
222
249
  # @param request_options [Hash]
223
250
  # @param params [Payabli::MoneyIn::Types::TransRequestBody]
224
251
  # @option request_options [String] :base_url
@@ -234,7 +261,7 @@ module Payabli
234
261
  #
235
262
  # @return [Payabli::MoneyIn::Types::PayabliApiResponseGetPaid]
236
263
  def getpaid(request_options: {}, **params)
237
- params = Payabli::Internal::Types::Utils.symbolize_keys(params)
264
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
238
265
  query_param_names = %i[ach_validation force_customer_creation include_details]
239
266
  query_params = {}
240
267
  query_params["achValidation"] = params[:ach_validation] if params.key?(:ach_validation)
@@ -242,10 +269,15 @@ module Payabli
242
269
  query_params["includeDetails"] = params[:include_details] if params.key?(:include_details)
243
270
  params = params.except(*query_param_names)
244
271
 
272
+ headers = {}
273
+ headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]
274
+ headers["validationCode"] = params[:validation_code] if params[:validation_code]
275
+
245
276
  request = Payabli::Internal::JSON::Request.new(
246
277
  base_url: request_options[:base_url],
247
278
  method: "POST",
248
279
  path: "MoneyIn/getpaid",
280
+ headers: headers,
249
281
  query: query_params,
250
282
  body: Payabli::MoneyIn::Types::TransRequestBody.new(params).to_h,
251
283
  request_options: request_options
@@ -280,6 +312,7 @@ module Payabli
280
312
  #
281
313
  # @return [Payabli::MoneyIn::Types::ReverseResponse]
282
314
  def reverse(request_options: {}, **params)
315
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
283
316
  request = Payabli::Internal::JSON::Request.new(
284
317
  base_url: request_options[:base_url],
285
318
  method: "GET",
@@ -303,6 +336,11 @@ module Payabli
303
336
  # Refund a transaction that has settled and send money back to the account holder. If a transaction hasn't been
304
337
  # settled, void it instead.
305
338
  #
339
+ # <Tip>
340
+ # Consider migrating to the [v2 Refund endpoint](/developers/api-reference/moneyinV2/refund-a-settled-transaction)
341
+ # to take advantage of unified response codes and improved response consistency.
342
+ # </Tip>
343
+ #
306
344
  # @param request_options [Hash]
307
345
  # @param params [Hash]
308
346
  # @option request_options [String] :base_url
@@ -315,6 +353,7 @@ module Payabli
315
353
  #
316
354
  # @return [Payabli::MoneyIn::Types::RefundResponse]
317
355
  def refund(request_options: {}, **params)
356
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
318
357
  request = Payabli::Internal::JSON::Request.new(
319
358
  base_url: request_options[:base_url],
320
359
  method: "GET",
@@ -349,16 +388,20 @@ module Payabli
349
388
  #
350
389
  # @return [Payabli::MoneyIn::Types::RefundWithInstructionsResponse]
351
390
  def refund_with_instructions(request_options: {}, **params)
352
- path_param_names = %i[trans_id]
353
- body_params = params.except(*path_param_names)
354
- body_prop_names = %i[amount ipaddress order_description order_id refund_details source]
355
- body_bag = body_params.slice(*body_prop_names)
391
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
392
+ request_data = Payabli::MoneyIn::Types::RequestRefund.new(params).to_h
393
+ non_body_param_names = %w[transId idempotencyKey]
394
+ body = request_data.except(*non_body_param_names)
395
+
396
+ headers = {}
397
+ headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]
356
398
 
357
399
  request = Payabli::Internal::JSON::Request.new(
358
400
  base_url: request_options[:base_url],
359
401
  method: "POST",
360
402
  path: "MoneyIn/refund/#{params[:trans_id]}",
361
- body: Payabli::MoneyIn::Types::RequestRefund.new(body_bag).to_h,
403
+ headers: headers,
404
+ body: body,
362
405
  request_options: request_options
363
406
  )
364
407
  begin
@@ -389,6 +432,7 @@ module Payabli
389
432
  #
390
433
  # @return [Payabli::Types::PayabliApiResponse]
391
434
  def reverse_credit(request_options: {}, **params)
435
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
392
436
  request = Payabli::Internal::JSON::Request.new(
393
437
  base_url: request_options[:base_url],
394
438
  method: "GET",
@@ -423,7 +467,7 @@ module Payabli
423
467
  #
424
468
  # @return [Payabli::MoneyIn::Types::ReceiptResponse]
425
469
  def send_receipt_2_trans(request_options: {}, **params)
426
- params = Payabli::Internal::Types::Utils.symbolize_keys(params)
470
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
427
471
  query_param_names = %i[email]
428
472
  query_params = {}
429
473
  query_params["email"] = params[:email] if params.key?(:email)
@@ -463,14 +507,20 @@ module Payabli
463
507
  #
464
508
  # @return [Payabli::MoneyIn::Types::ValidateResponse]
465
509
  def validate(request_options: {}, **params)
466
- body_prop_names = %i[account_id entry_point order_description order_id payment_method]
467
- body_bag = params.slice(*body_prop_names)
510
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
511
+ request_data = Payabli::MoneyIn::Types::RequestPaymentValidate.new(params).to_h
512
+ non_body_param_names = ["idempotencyKey"]
513
+ body = request_data.except(*non_body_param_names)
514
+
515
+ headers = {}
516
+ headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]
468
517
 
469
518
  request = Payabli::Internal::JSON::Request.new(
470
519
  base_url: request_options[:base_url],
471
520
  method: "POST",
472
521
  path: "MoneyIn/validate",
473
- body: Payabli::MoneyIn::Types::RequestPaymentValidate.new(body_bag).to_h,
522
+ headers: headers,
523
+ body: body,
474
524
  request_options: request_options
475
525
  )
476
526
  begin
@@ -490,6 +540,11 @@ module Payabli
490
540
  # Cancel a transaction that hasn't been settled yet. Voiding non-captured authorizations prevents future captures.
491
541
  # If a transaction has been settled, refund it instead.
492
542
  #
543
+ # <Tip>
544
+ # Consider migrating to the [v2 Void endpoint](/developers/api-reference/moneyinV2/void-a-transaction) to take
545
+ # advantage of unified response codes and improved response consistency.
546
+ # </Tip>
547
+ #
493
548
  # @param request_options [Hash]
494
549
  # @param params [Hash]
495
550
  # @option request_options [String] :base_url
@@ -501,6 +556,7 @@ module Payabli
501
556
  #
502
557
  # @return [Payabli::MoneyIn::Types::VoidResponse]
503
558
  def void(request_options: {}, **params)
559
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
504
560
  request = Payabli::Internal::JSON::Request.new(
505
561
  base_url: request_options[:base_url],
506
562
  method: "GET",
@@ -520,6 +576,262 @@ module Payabli
520
576
  raise error_class.new(response.body, code: code)
521
577
  end
522
578
  end
579
+
580
+ # Make a single transaction. This method authorizes and captures a payment in one step. This is the v2 version of
581
+ # the `api/MoneyIn/getpaid` endpoint, and returns the unified response format. See [Pay In unified response codes
582
+ # reference](/guides/pay-in-unified-response-codes-reference) for more information.
583
+ #
584
+ # @param request_options [Hash]
585
+ # @param params [Payabli::MoneyIn::Types::TransRequestBody]
586
+ # @option request_options [String] :base_url
587
+ # @option request_options [Hash{String => Object}] :additional_headers
588
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
589
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
590
+ # @option request_options [Integer] :timeout_in_seconds
591
+ # @option params [Boolean, nil] :ach_validation
592
+ # @option params [Boolean, nil] :force_customer_creation
593
+ # @option params [String, nil] :idempotency_key
594
+ # @option params [String, nil] :validation_code
595
+ #
596
+ # @return [Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper]
597
+ def getpaidv_2(request_options: {}, **params)
598
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
599
+ query_param_names = %i[ach_validation force_customer_creation]
600
+ query_params = {}
601
+ query_params["achValidation"] = params[:ach_validation] if params.key?(:ach_validation)
602
+ query_params["forceCustomerCreation"] = params[:force_customer_creation] if params.key?(:force_customer_creation)
603
+ params = params.except(*query_param_names)
604
+
605
+ headers = {}
606
+ headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]
607
+ headers["validationCode"] = params[:validation_code] if params[:validation_code]
608
+
609
+ request = Payabli::Internal::JSON::Request.new(
610
+ base_url: request_options[:base_url],
611
+ method: "POST",
612
+ path: "v2/MoneyIn/getpaid",
613
+ headers: headers,
614
+ query: query_params,
615
+ body: Payabli::MoneyIn::Types::TransRequestBody.new(params).to_h,
616
+ request_options: request_options
617
+ )
618
+ begin
619
+ response = @client.send(request)
620
+ rescue Net::HTTPRequestTimeout
621
+ raise Payabli::Errors::TimeoutError
622
+ end
623
+ code = response.code.to_i
624
+ if code.between?(200, 299)
625
+ Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper.load(response.body)
626
+ else
627
+ error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
628
+ raise error_class.new(response.body, code: code)
629
+ end
630
+ end
631
+
632
+ # Authorize a card transaction. This returns an authorization code and reserves funds for the merchant. Authorized
633
+ # transactions aren't flagged for settlement until captured. This is the v2 version of the `api/MoneyIn/authorize`
634
+ # endpoint, and returns the unified response format. See [Pay In unified response codes
635
+ # reference](/guides/pay-in-unified-response-codes-reference) for more information.
636
+ #
637
+ # **Note**: Only card transactions can be authorized. This endpoint can't be used for ACH transactions.
638
+ #
639
+ # @param request_options [Hash]
640
+ # @param params [Payabli::MoneyIn::Types::TransRequestBody]
641
+ # @option request_options [String] :base_url
642
+ # @option request_options [Hash{String => Object}] :additional_headers
643
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
644
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
645
+ # @option request_options [Integer] :timeout_in_seconds
646
+ # @option params [Boolean, nil] :force_customer_creation
647
+ # @option params [String, nil] :idempotency_key
648
+ #
649
+ # @return [Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper]
650
+ def authorizev_2(request_options: {}, **params)
651
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
652
+ query_param_names = %i[force_customer_creation]
653
+ query_params = {}
654
+ query_params["forceCustomerCreation"] = params[:force_customer_creation] if params.key?(:force_customer_creation)
655
+ params = params.except(*query_param_names)
656
+
657
+ headers = {}
658
+ headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]
659
+
660
+ request = Payabli::Internal::JSON::Request.new(
661
+ base_url: request_options[:base_url],
662
+ method: "POST",
663
+ path: "v2/MoneyIn/authorize",
664
+ headers: headers,
665
+ query: query_params,
666
+ body: Payabli::MoneyIn::Types::TransRequestBody.new(params).to_h,
667
+ request_options: request_options
668
+ )
669
+ begin
670
+ response = @client.send(request)
671
+ rescue Net::HTTPRequestTimeout
672
+ raise Payabli::Errors::TimeoutError
673
+ end
674
+ code = response.code.to_i
675
+ if code.between?(200, 299)
676
+ Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper.load(response.body)
677
+ else
678
+ error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
679
+ raise error_class.new(response.body, code: code)
680
+ end
681
+ end
682
+
683
+ # Capture an authorized transaction to complete the transaction and move funds from the customer to merchant
684
+ # account. This is the v2 version of the `api/MoneyIn/capture/{transId}` endpoint, and returns the unified
685
+ # response format. See [Pay In unified response codes reference](/guides/pay-in-unified-response-codes-reference)
686
+ # for more information.
687
+ #
688
+ # @param request_options [Hash]
689
+ # @param params [Payabli::MoneyIn::Types::CaptureRequest]
690
+ # @option request_options [String] :base_url
691
+ # @option request_options [Hash{String => Object}] :additional_headers
692
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
693
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
694
+ # @option request_options [Integer] :timeout_in_seconds
695
+ # @option params [String] :trans_id
696
+ #
697
+ # @return [Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper]
698
+ def capturev_2(request_options: {}, **params)
699
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
700
+ request = Payabli::Internal::JSON::Request.new(
701
+ base_url: request_options[:base_url],
702
+ method: "POST",
703
+ path: "v2/MoneyIn/capture/#{params[:trans_id]}",
704
+ body: Payabli::MoneyIn::Types::CaptureRequest.new(params).to_h,
705
+ request_options: request_options
706
+ )
707
+ begin
708
+ response = @client.send(request)
709
+ rescue Net::HTTPRequestTimeout
710
+ raise Payabli::Errors::TimeoutError
711
+ end
712
+ code = response.code.to_i
713
+ if code.between?(200, 299)
714
+ Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper.load(response.body)
715
+ else
716
+ error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
717
+ raise error_class.new(response.body, code: code)
718
+ end
719
+ end
720
+
721
+ # Give a full refund for a transaction that has settled and send money back to the account holder. To perform a
722
+ # partial refund, see [Partially refund a
723
+ # transaction](developers/api-reference/moneyinV2/partial-refund-a-settled-transaction).
724
+ #
725
+ # This is the v2 version of the refund endpoint, and returns the unified response format. See [Pay In unified
726
+ # response codes reference](/guides/pay-in-unified-response-codes-reference) for more information.
727
+ #
728
+ # @param request_options [Hash]
729
+ # @param params [Hash]
730
+ # @option request_options [String] :base_url
731
+ # @option request_options [Hash{String => Object}] :additional_headers
732
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
733
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
734
+ # @option request_options [Integer] :timeout_in_seconds
735
+ # @option params [String] :trans_id
736
+ #
737
+ # @return [Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper]
738
+ def refundv_2(request_options: {}, **params)
739
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
740
+ request = Payabli::Internal::JSON::Request.new(
741
+ base_url: request_options[:base_url],
742
+ method: "POST",
743
+ path: "v2/MoneyIn/refund/#{params[:trans_id]}",
744
+ request_options: request_options
745
+ )
746
+ begin
747
+ response = @client.send(request)
748
+ rescue Net::HTTPRequestTimeout
749
+ raise Payabli::Errors::TimeoutError
750
+ end
751
+ code = response.code.to_i
752
+ if code.between?(200, 299)
753
+ Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper.load(response.body)
754
+ else
755
+ error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
756
+ raise error_class.new(response.body, code: code)
757
+ end
758
+ end
759
+
760
+ # Refund a transaction that has settled and send money back to the account holder. If `amount` is omitted or set
761
+ # to 0, performs a full refund. When a non-zero `amount` is provided, this endpoint performs a partial refund.
762
+ #
763
+ # This is the v2 version of the refund endpoint, and returns the unified response format. See [Pay In unified
764
+ # response codes reference](/guides/pay-in-unified-response-codes-reference) for more information.
765
+ #
766
+ # @param request_options [Hash]
767
+ # @param params [Hash]
768
+ # @option request_options [String] :base_url
769
+ # @option request_options [Hash{String => Object}] :additional_headers
770
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
771
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
772
+ # @option request_options [Integer] :timeout_in_seconds
773
+ # @option params [String] :trans_id
774
+ # @option params [Integer] :amount
775
+ #
776
+ # @return [Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper]
777
+ def refundv_2_amount(request_options: {}, **params)
778
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
779
+ request = Payabli::Internal::JSON::Request.new(
780
+ base_url: request_options[:base_url],
781
+ method: "POST",
782
+ path: "v2/MoneyIn/refund/#{params[:trans_id]}/#{params[:amount]}",
783
+ request_options: request_options
784
+ )
785
+ begin
786
+ response = @client.send(request)
787
+ rescue Net::HTTPRequestTimeout
788
+ raise Payabli::Errors::TimeoutError
789
+ end
790
+ code = response.code.to_i
791
+ if code.between?(200, 299)
792
+ Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper.load(response.body)
793
+ else
794
+ error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
795
+ raise error_class.new(response.body, code: code)
796
+ end
797
+ end
798
+
799
+ # Cancel a transaction that hasn't been settled yet. Voiding non-captured authorizations prevents future captures.
800
+ # This is the v2 version of the `api/MoneyIn/void/{transId}` endpoint, and returns the unified response format.
801
+ # See [Pay In unified response codes reference](/guides/pay-in-unified-response-codes-reference) for more
802
+ # information.
803
+ #
804
+ # @param request_options [Hash]
805
+ # @param params [Hash]
806
+ # @option request_options [String] :base_url
807
+ # @option request_options [Hash{String => Object}] :additional_headers
808
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
809
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
810
+ # @option request_options [Integer] :timeout_in_seconds
811
+ # @option params [String] :trans_id
812
+ #
813
+ # @return [Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper]
814
+ def voidv_2(request_options: {}, **params)
815
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
816
+ request = Payabli::Internal::JSON::Request.new(
817
+ base_url: request_options[:base_url],
818
+ method: "POST",
819
+ path: "v2/MoneyIn/void/#{params[:trans_id]}",
820
+ request_options: request_options
821
+ )
822
+ begin
823
+ response = @client.send(request)
824
+ rescue Net::HTTPRequestTimeout
825
+ raise Payabli::Errors::TimeoutError
826
+ end
827
+ code = response.code.to_i
828
+ if code.between?(200, 299)
829
+ Payabli::V2MoneyInTypes::Types::V2TransactionResponseWrapper.load(response.body)
830
+ else
831
+ error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
832
+ raise error_class.new(response.body, code: code)
833
+ end
834
+ end
523
835
  end
524
836
  end
525
837
  end
@@ -5,8 +5,8 @@ module Payabli
5
5
  module Types
6
6
  # Response data for GetPaid transactions
7
7
  class GetPaidResponseData < Internal::Types::Model
8
+ field :auth_code, -> { String }, optional: false, nullable: true, api_name: "authCode"
8
9
  field :transaction_details, -> { Payabli::MoneyIn::Types::TransactionDetailRecord }, optional: true, nullable: false, api_name: "transactionDetails"
9
- field :auth_code, -> { String }, optional: true, nullable: false, api_name: "authCode"
10
10
  field :reference_id, -> { String }, optional: false, nullable: false, api_name: "referenceId"
11
11
  field :result_code, -> { Integer }, optional: false, nullable: false, api_name: "resultCode"
12
12
  field :result_text, -> { String }, optional: false, nullable: false, api_name: "resultText"
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Payabli
4
+ module MoneyIn
5
+ module Types
6
+ class RequestPaymentAuthorizeV2 < Internal::Types::Model
7
+ field :force_customer_creation, -> { Internal::Types::Boolean }, optional: true, nullable: false, api_name: "forceCustomerCreation"
8
+ field :idempotency_key, -> { String }, optional: true, nullable: false, api_name: "idempotencyKey"
9
+ field :body, -> { Payabli::MoneyIn::Types::TransRequestBody }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Payabli
4
+ module MoneyIn
5
+ module Types
6
+ class RequestPaymentV2 < Internal::Types::Model
7
+ field :ach_validation, -> { Internal::Types::Boolean }, optional: true, nullable: false, api_name: "achValidation"
8
+ field :force_customer_creation, -> { Internal::Types::Boolean }, optional: true, nullable: false, api_name: "forceCustomerCreation"
9
+ field :idempotency_key, -> { String }, optional: true, nullable: false, api_name: "idempotencyKey"
10
+ field :validation_code, -> { String }, optional: true, nullable: false, api_name: "validationCode"
11
+ field :body, -> { Payabli::MoneyIn::Types::TransRequestBody }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -5,6 +5,8 @@ module Payabli
5
5
  module Types
6
6
  # Response data from payment processor
7
7
  class TransactionDetailResponseData < Internal::Types::Model
8
+ field :result_code, -> { String }, optional: true, nullable: false, api_name: "resultCode"
9
+ field :result_code_text, -> { String }, optional: true, nullable: false, api_name: "resultCodeText"
8
10
  field :response, -> { String }, optional: false, nullable: true
9
11
  field :responsetext, -> { String }, optional: false, nullable: false
10
12
  field :authcode, -> { String }, optional: false, nullable: true