Class: Payabli::MoneyOut::Client
- Inherits:
-
Object
- Object
- Payabli::MoneyOut::Client
- Defined in:
- lib/payabli/money_out/client.rb
Instance Method Summary collapse
-
#authorize_out(request_options: {}, **params) ⇒ Payabli::Types::AuthCapturePayoutResponse
Authorizes a transaction for payout.
-
#cancel_all_out(request_options: {}, **params) ⇒ Payabli::Types::CaptureAllOutResponse
Cancels an array of payout transactions.
-
#cancel_out_delete(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse0000
Cancel a payout transaction by ID.
-
#cancel_out_get(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse0000
Cancel a payout transaction by ID.
-
#capture_all_out(request_options: {}, **params) ⇒ Payabli::Types::CaptureAllOutResponse
Captures an array of authorized payout transactions for settlement.
-
#capture_out(request_options: {}, **params) ⇒ Payabli::Types::AuthCapturePayoutResponse
Captures a single authorized payout transaction by ID.
-
#get_check_image(request_options: {}, **params) ⇒ String
Retrieve the image of a check associated with a processed transaction.
- #initialize(client:) ⇒ void constructor
-
#payout_details(request_options: {}, **params) ⇒ Payabli::Types::BillDetailResponse
Returns details for a processed money out transaction.
-
#reissue_out(request_options: {}, **params) ⇒ Payabli::Types::ReissuePayoutResponse
Reissues a payout transaction with a new payment method.
-
#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.
-
#send_v_card_link(request_options: {}, **params) ⇒ Payabli::Types::OperationResult
Sends a virtual card link via email to the vendor associated with the
transId. -
#update_check_payment_status(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse00Responsedatanonobject
Updates the status of a processed check payment transaction.
-
#v_card_get(request_options: {}, **params) ⇒ Payabli::Types::VCardGetResponse
Retrieves vCard details for a single card in an entrypoint.
Constructor Details
#initialize(client:) ⇒ void
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.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/payabli/money_out/client.rb', line 46 def (request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request_data = Payabli::MoneyOut::Types::RequestOutAuthorize.new(params).to_h non_body_param_names = %w[allowDuplicatedBills doNotCreateBills forceVendorCreation idempotencyKey] body = request_data.except(*non_body_param_names) 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["forceVendorCreation"] = params[:force_vendor_creation] if params.key?(:force_vendor_creation) headers = {} headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key] request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "MoneyOut/authorize", headers: headers, query: query_params, body: body, 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.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/payabli/money_out/client.rb', line 94 def cancel_all_out(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "MoneyOut/cancelAll", body: params, 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.
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/payabli/money_out/client.rb', line 163 def cancel_out_delete(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "MoneyOut/cancel/#{URI.encode_uri_component(params[:reference_id].to_s)}", 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.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/payabli/money_out/client.rb', line 129 def cancel_out_get(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "MoneyOut/cancel/#{URI.encode_uri_component(params[:reference_id].to_s)}", 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.
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 |
# File 'lib/payabli/money_out/client.rb', line 198 def capture_all_out(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) headers = {} headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key] request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "MoneyOut/captureAll", headers: headers, body: params, 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.
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 |
# File 'lib/payabli/money_out/client.rb', line 243 def capture_out(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) headers = {} headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key] request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "MoneyOut/capture/#{URI.encode_uri_component(params[:reference_id].to_s)}", headers: headers, 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.
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'lib/payabli/money_out/client.rb', line 432 def get_check_image(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "MoneyOut/checkimage/#{URI.encode_uri_component(params[:asset_name].to_s)}", 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_details(request_options: {}, **params) ⇒ Payabli::Types::BillDetailResponse
Returns details for a processed money out transaction.
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/payabli/money_out/client.rb', line 281 def payout_details(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "MoneyOut/details/#{URI.encode_uri_component(params[:trans_id].to_s)}", 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.
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
# File 'lib/payabli/money_out/client.rb', line 522 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] request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "MoneyOut/reissue", headers: headers, query: query_params, body: body, 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.
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/payabli/money_out/client.rb', line 357 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) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "MoneyOutCard/vcard/#{URI.encode_uri_component(params[:card_token].to_s)}/renew", body: body, 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 |
#send_v_card_link(request_options: {}, **params) ⇒ Payabli::Types::OperationResult
Sends a virtual card link via email to the vendor associated with the transId.
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/payabli/money_out/client.rb', line 395 def send_v_card_link(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "vcard/send-card-link", body: Payabli::MoneyOut::Types::SendVCardLinkRequest.new(params).to_h, 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. |
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/payabli/money_out/client.rb', line 480 def update_check_payment_status(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [: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)}", 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.
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/payabli/money_out/client.rb', line 315 def v_card_get(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "MoneyOut/vcard/#{URI.encode_uri_component(params[:card_token].to_s)}", 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 |