Class: Payabli::MoneyOut::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/payabli/money_out/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ void

Parameters:



9
10
11
# File 'lib/payabli/money_out/client.rb', line 9

def initialize(client:)
  @client = client
end

Instance Method Details

#authorize_out(request_options: {}, **params) ⇒ Payabli::Types::AuthCapturePayoutResponse

Authorizes a transaction for payout.

If you don't pass autoCapture with a value of true, authorized transactions aren't flagged for settlement until captured. Use the referenceId returned in the response to capture the transaction.

When autoCapture is true, Payabli captures the transaction asynchronously after authorization. The response confirms only that the transaction was authorized; it doesn't confirm that capture succeeded. To confirm capture, listen for the payout_transaction_approvedcaptured webhook event.

If a velocity fraud alert is triggered, the endpoint returns a 202 response with responseCode 9051, and the authorization is held for risk review rather than rejected. If a risk policy blocks the transaction, the endpoint returns a 422 response with responseCode 9005, a terminal rejection.

For check payouts, Payabli validates the remit (mailing) address at authorization. If the address fails deliverability validation, the endpoint returns a 422 response and doesn't charge the paypoint. Correct the address and re-authorize. Other payout rails (ACH, RTP, virtual card, wire, and managed payables) aren't affected.

Examples:

client.money_out.authorize_out(
  entry_point: "8cfec329267",
  order_description: "Window Painting",
  payment_method: {
    method_: "managed"
  },
  payment_details: {
    total_amount: 47,
    unbundled: false
  },
  vendor_data: {
    vendor_number: "VEN-123"
  },
  invoice_data: [{
    bill_id: 54323
  }],
  auto_capture: true
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :allow_duplicated_bills (Boolean, nil)
  • :do_not_create_bills (Boolean, nil)
  • :same_day_ach (Boolean, nil)
  • :idempotency_key (String, nil)

Returns:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/payabli/money_out/client.rb', line 66

def authorize_out(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[allow_duplicated_bills do_not_create_bills same_day_ach]
  query_params = {}
  query_params["allowDuplicatedBills"] = params[:allow_duplicated_bills] if params.key?(:allow_duplicated_bills)
  query_params["doNotCreateBills"] = params[:do_not_create_bills] if params.key?(:do_not_create_bills)
  query_params["sameDayACH"] = params[:same_day_ach] if params.key?(:same_day_ach)
  params = params.except(*query_param_names)

  headers = {}
  headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]).merge(headers)
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "MoneyOut/authorize",
    headers: headers,
    query: query_params,
    body: Payabli::Types::AuthorizePayoutBody.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::AuthCapturePayoutResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#cancel_all_out(request_options: {}, **params) ⇒ Payabli::Types::CaptureAllOutResponse

Cancels an array of payout transactions.

Examples:

client.money_out.cancel_all_out(request: %w[2-29 2-28 2-27])

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/payabli/money_out/client.rb', line 116

def cancel_all_out(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "MoneyOut/cancelAll",
    headers: headers,
    body: params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::CaptureAllOutResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#cancel_out_delete(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse0000

Cancel a payout transaction by ID.

Examples:

client.money_out.cancel_out_delete(reference_id: "129-219")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :reference_id (String)

Returns:



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/payabli/money_out/client.rb', line 195

def cancel_out_delete(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "DELETE",
    path: "MoneyOut/cancel/#{URI.encode_uri_component(params[:reference_id].to_s)}",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponse0000.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#cancel_out_get(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse0000

Cancel a payout transaction by ID.

Examples:

client.money_out.cancel_out_get(reference_id: "129-219")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :reference_id (String)

Returns:



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/payabli/money_out/client.rb', line 156

def cancel_out_get(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "MoneyOut/cancel/#{URI.encode_uri_component(params[:reference_id].to_s)}",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponse0000.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#capture_all_out(request_options: {}, **params) ⇒ Payabli::Types::CaptureAllOutResponse

Captures an array of authorized payout transactions for settlement. The maximum number of transactions that can be captured in a single request is 500.

Examples:

client.money_out.capture_all_out(body: %w[2-29 2-28 2-27])

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :auto_convert_same_day_ach (Boolean, nil)
  • :idempotency_key (String, nil)

Returns:



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
# File 'lib/payabli/money_out/client.rb', line 236

def capture_all_out(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[auto_convert_same_day_ach]
  query_params = {}
  query_params["autoConvertSameDayAch"] = params[:auto_convert_same_day_ach] if params.key?(:auto_convert_same_day_ach)
  params = params.except(*query_param_names)

  headers = {}
  headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]).merge(headers)
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "MoneyOut/captureAll",
    headers: headers,
    query: query_params,
    body: params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::CaptureAllOutResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#capture_out(request_options: {}, **params) ⇒ Payabli::Types::AuthCapturePayoutResponse

Captures a single authorized payout transaction by ID. If the transaction was authorized with autoCapture set to true, you don't need to call this endpoint to capture the transaction for processing.

If a velocity fraud alert is triggered, the endpoint returns a 202 response with responseCode 9051, and the capture is held for risk review rather than rejected. If a risk policy blocks the transaction, the endpoint returns a 422 response with responseCode 9005, a terminal rejection.

Examples:

client.money_out.capture_out(reference_id: "129-219")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :reference_id (String)
  • :auto_convert_same_day_ach (Boolean, nil)
  • :idempotency_key (String, nil)

Returns:



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/payabli/money_out/client.rb', line 292

def capture_out(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["autoConvertSameDayAch"] = params[:auto_convert_same_day_ach] if params.key?(:auto_convert_same_day_ach)

  headers = {}
  headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]).merge(headers)
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "MoneyOut/capture/#{URI.encode_uri_component(params[:reference_id].to_s)}",
    headers: headers,
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::AuthCapturePayoutResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_check_image(request_options: {}, **params) ⇒ String

Retrieve the image of a check associated with a processed transaction. The check image is returned in the response body as a base64-encoded string. The check image is only available for payouts that have been processed.

Examples:

client.money_out.get_check_image(asset_name: "check133832686289732320_01JKBNZ5P32JPTZY8XXXX000000.pdf")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :asset_name (String)

Returns:

  • (String)

Raises:

  • (error_class)


596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
# File 'lib/payabli/money_out/client.rb', line 596

def get_check_image(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "MoneyOut/checkimage/#{URI.encode_uri_component(params[:asset_name].to_s)}",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#payout(request_options: {}, **params) ⇒ Payabli::Types::AuthCapturePayoutResponse

Authorizes a payout and captures it in the same request, returning the capture result. Use this endpoint when you need the capture outcome synchronously: it does the same work as calling POST /MoneyOut/authorize followed by GET /MoneyOut/capture/{referenceId}, in a single call.

Risk and fraud review runs at both the authorize and capture stages, exactly as it does for the two-call flow.

Payabli ignores the autoCapture field in the request body, since this endpoint always captures inline.

If the capture fails, the payout stays authorized. Retry the capture with GET /MoneyOut/capture/{referenceId} using the referenceId from the error response rather than resubmitting, which would create a second payout. See the Manage payouts guide for details.

Examples:

client.money_out.payout(
  entry_point: "8cfec329267",
  order_description: "Window Painting",
  payment_method: {
    method_: "managed"
  },
  payment_details: {
    total_amount: 47
  },
  vendor_data: {
    vendor_number: "VEN-123"
  },
  invoice_data: [{
    bill_id: 54323
  }]
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :same_day_ach (Boolean, nil)
  • :do_not_create_bills (Boolean, nil)
  • :allow_duplicated_bills (Boolean, nil)
  • :update_vendor_payment_method (Boolean, nil)
  • :auto_convert_same_day_ach (Boolean, nil)
  • :idempotency_key (String, nil)

Returns:



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/payabli/money_out/client.rb', line 369

def payout(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[same_day_ach do_not_create_bills allow_duplicated_bills update_vendor_payment_method auto_convert_same_day_ach]
  query_params = {}
  query_params["sameDayACH"] = params[:same_day_ach] if params.key?(:same_day_ach)
  query_params["doNotCreateBills"] = params[:do_not_create_bills] if params.key?(:do_not_create_bills)
  query_params["allowDuplicatedBills"] = params[:allow_duplicated_bills] if params.key?(:allow_duplicated_bills)
  query_params["updateVendorPaymentMethod"] = params[:update_vendor_payment_method] if params.key?(:update_vendor_payment_method)
  query_params["autoConvertSameDayAch"] = params[:auto_convert_same_day_ach] if params.key?(:auto_convert_same_day_ach)
  params = params.except(*query_param_names)

  headers = {}
  headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]).merge(headers)
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "MoneyOut/payout",
    headers: headers,
    query: query_params,
    body: Payabli::Types::AuthorizePayoutBody.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::AuthCapturePayoutResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#payout_details(request_options: {}, **params) ⇒ Payabli::Types::BillDetailResponse

Returns details for a processed money out transaction.

Examples:

client.money_out.payout_details(trans_id: "45-as456777hhhhhhhhhh77777777-324")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :trans_id (String)

Returns:



422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/payabli/money_out/client.rb', line 422

def payout_details(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "MoneyOut/details/#{URI.encode_uri_component(params[:trans_id].to_s)}",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::BillDetailResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#reissue_out(request_options: {}, **params) ⇒ Payabli::Types::ReissuePayoutResponse

Reissues a payout transaction with a new payment method. This creates a new transaction linked to the original and marks the original transaction as reissued.

The original transaction must be in Processing or Processed status. The payment method in the request body is used directly. The endpoint doesn't fall back to vendor-managed payment methods.

The new transaction goes through the standard authorize-and-capture flow automatically. Both the original and new transactions are linked through their event histories for audit purposes.

Examples:

client.money_out.reissue_out(
  trans_id: "129-219",
  payment_method: {
    method_: "ach",
    ach_account: "9876543210",
    ach_account_type: "savings",
    ach_routing: "021000021",
    ach_holder: "Acme Corp",
    ach_holder_type: "business"
  }
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :trans_id (String)
  • :idempotency_key (String, nil)

Returns:



709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
# File 'lib/payabli/money_out/client.rb', line 709

def reissue_out(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  request_data = Payabli::MoneyOut::Types::ReissueOutRequest.new(params).to_h
  non_body_param_names = %w[transId idempotencyKey]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["transId"] = params[:trans_id] if params.key?(:trans_id)

  headers = {}
  headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]).merge(headers)
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "MoneyOut/reissue",
    headers: headers,
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::ReissuePayoutResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#renew_v_card(request_options: {}, **params) ⇒ Payabli::Types::RenewVCardResponse

Renews an expired or expiring virtual card by extending its expiration date to a future month.

The card must be a virtual card that hasn't been fully used. The new expiration date must be in MM-YYYY or MM/YYYY format and no more than 2 years and 363 days in the future. The card expires on the last day of the month you specify.

On success, referenceId holds the renewed card's token (the card processor may issue a new token). The response reuses the standard payout result object, so the payment-transaction fields it carries don't apply to renewal and always return null.

Examples:

client.money_out.renew_v_card(
  card_token: "20231206142225226104",
  expiration_date: "12-2027"
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :card_token (String)

Returns:



511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# File 'lib/payabli/money_out/client.rb', line 511

def renew_v_card(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  request_data = Payabli::MoneyOut::Types::RenewVCardRequest.new(params).to_h
  non_body_param_names = %w[cardToken]
  body = request_data.except(*non_body_param_names)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "MoneyOutCard/vcard/#{URI.encode_uri_component(params[:card_token].to_s)}/renew",
    headers: headers,
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::RenewVCardResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

Sends a virtual card link via email to the vendor associated with the transId.

Examples:

client.money_out.send_v_card_link(trans_id: "01K33Z6YQZ6GD5QVKZ856MJBSC")

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/payabli/money_out/client.rb', line 554

def send_v_card_link(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "MoneyOut/vcard/send-card-link",
    headers: headers,
    body: Payabli::MoneyOut::Types::SendVCardLinkRequest.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::OperationResult.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#update_check_payment_status(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse00Responsedatanonobject

Updates the status of a processed check payment transaction. This endpoint handles the status transition, updates related bills, creates audit events, and triggers notifications.

The transaction must meet all of the following criteria:

  • Status: Must be in Processing or Processed status.
  • Payment method: Must be a check payment method.

Allowed status values

Value Status Description
0 Cancelled/Voided Cancels the check transaction. Reverts associated bills to their previous state

(Approved or Active), creates "Cancelled" events, and sends a payout_transaction_voidedcancelled notification if the notification is enabled. | | 5 | Paid | Marks the check transaction as paid. Updates associated bills to "Paid" status, creates "Paid" events, and sends a payout_transaction_paid notification if the notification is enabled. |

Examples:

client.money_out.update_check_payment_status(
  trans_id: "TRANS123456",
  check_payment_status: "5"
)

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
# File 'lib/payabli/money_out/client.rb', line 652

def update_check_payment_status(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PATCH",
    path: "MoneyOut/status/#{URI.encode_uri_component(params[:trans_id].to_s)}/#{URI.encode_uri_component(params[:check_payment_status].to_s)}",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponse00Responsedatanonobject.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#v_card_get(request_options: {}, **params) ⇒ Payabli::Types::VCardGetResponse

Retrieves vCard details for a single card in an entrypoint.

Examples:

client.money_out.v_card_get(card_token: "20230403315245421165")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :card_token (String)

Returns:



461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/payabli/money_out/client.rb', line 461

def v_card_get(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "MoneyOut/vcard/#{URI.encode_uri_component(params[:card_token].to_s)}",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::VCardGetResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end