Class: Payabli::MoneyIn::Client
- Inherits:
-
Object
- Object
- Payabli::MoneyIn::Client
- Defined in:
- lib/payabli/money_in/client.rb
Instance Method Summary collapse
-
#authorize(request_options: {}, **params) ⇒ Payabli::Types::AuthResponse
This endpoint is deprecated. -
#authorizev_2(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Authorize a card transaction.
-
#capture(request_options: {}, **params) ⇒ Payabli::Types::CaptureResponse
This endpoint is deprecated. -
#capture_auth(request_options: {}, **params) ⇒ Payabli::Types::CaptureResponse
This endpoint is deprecated. -
#capturev_2(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Capture an authorized transaction to complete the transaction and move funds from the customer to merchant account.
-
#credit(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse0
Make a temporary microdeposit in a customer account to verify the customer's ownership and access to the target account.
-
#details(request_options: {}, **params) ⇒ Payabli::Types::TransactionQueryRecordsCustomer
Retrieve a processed transaction's details.
-
#getpaid(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponseGetPaid
This endpoint is deprecated. -
#getpaidv_2(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Make a single transaction.
- #initialize(client:) ⇒ void constructor
-
#refund(request_options: {}, **params) ⇒ Payabli::Types::RefundResponse
This endpoint is deprecated. -
#refund_with_instructions(request_options: {}, **params) ⇒ Payabli::Types::RefundWithInstructionsResponse
This endpoint is deprecated. -
#refundv_2(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Give a full refund for a transaction that has settled and send money back to the account holder.
-
#refundv_2_amount(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Refund a transaction that has settled and send money back to the account holder.
-
#reverse(request_options: {}, **params) ⇒ Payabli::Types::ReverseResponse
This endpoint is deprecated and only works on transactions created with the legacy endpoints. -
#reverse_credit(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse
Reverse microdeposits that are used to verify customer account ownership and access.
-
#send_receipt_2_trans(request_options: {}, **params) ⇒ Payabli::Types::ReceiptResponse
Send a payment receipt for a transaction.
-
#validate(request_options: {}, **params) ⇒ Payabli::Types::ValidateResponse
Validates a card number without running a transaction or authorizing a charge.
-
#void(request_options: {}, **params) ⇒ Payabli::Types::VoidResponse
This endpoint is deprecated. -
#voidv_2(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Cancel a transaction that hasn't been settled yet.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/payabli/money_in/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#authorize(request_options: {}, **params) ⇒ Payabli::Types::AuthResponse
Authorize a card transaction. This returns an authorization code and reserves funds for the merchant. Authorized transactions aren't flagged for settlement until captured.
Only card transactions can be authorized. This endpoint can't be used for ACH transactions.
60 61 62 63 64 65 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 |
# File 'lib/payabli/money_in/client.rb', line 60 def (request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[force_customer_creation] query_params = {} query_params["forceCustomerCreation"] = params[:force_customer_creation] if params.key?(:force_customer_creation) 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: [:base_url], method: "POST", path: "MoneyIn/authorize", headers: headers, query: query_params, body: Payabli::Types::TransRequestBody.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::AuthResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#authorizev_2(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Authorize a card transaction. This returns an authorization code and reserves funds for the merchant. Authorized
transactions aren't flagged for settlement until captured. This is the v2 version of the api/MoneyIn/authorize
endpoint, and returns the unified response format. See Pay In unified response codes
reference for more information.
Note: Only card transactions can be authorized. This endpoint can't be used for ACH transactions.
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 |
# File 'lib/payabli/money_in/client.rb', line 892 def (request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[force_customer_creation] query_params = {} query_params["forceCustomerCreation"] = params[:force_customer_creation] if params.key?(:force_customer_creation) 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: [:base_url], method: "POST", path: "v2/MoneyIn/authorize", headers: headers, query: query_params, body: Payabli::Types::TransRequestBody.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::V2TransactionResponseWrapper.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#capture(request_options: {}, **params) ⇒ Payabli::Types::CaptureResponse
Capture an [authorized
transaction](/developers/api-reference/moneyin/authorize-a-transaction) to complete the transaction and move funds from the customer to merchant account.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/payabli/money_in/client.rb', line 121 def capture(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: [:base_url], method: "GET", path: "MoneyIn/capture/#{URI.encode_uri_component(params[:trans_id].to_s)}/#{URI.encode_uri_component(params[:amount].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::CaptureResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#capture_auth(request_options: {}, **params) ⇒ Payabli::Types::CaptureResponse
Capture an authorized transaction to complete the transaction and move funds from the customer to merchant account.
You can use this endpoint to capture both full and partial amounts of the original authorized transaction. See Capture an authorized transaction for more information about this endpoint.
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/payabli/money_in/client.rb', line 179 def capture_auth(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[trans_id] body_params = params.except(*path_param_names) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "MoneyIn/capture/#{URI.encode_uri_component(params[:trans_id].to_s)}", headers: headers, body: Payabli::Types::CaptureRequest.new(body_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::CaptureResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#capturev_2(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Capture an authorized transaction to complete the transaction and move funds from the customer to merchant
account. This is the v2 version of the api/MoneyIn/capture/{transId} endpoint, and returns the unified
response format. See Pay In unified response codes reference
for more information.
950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 |
# File 'lib/payabli/money_in/client.rb', line 950 def capturev_2(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[trans_id] body_params = params.except(*path_param_names) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v2/MoneyIn/capture/#{URI.encode_uri_component(params[:trans_id].to_s)}", headers: headers, body: Payabli::Types::CaptureRequest.new(body_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::V2TransactionResponseWrapper.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#credit(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse0
Make a temporary microdeposit in a customer account to verify the customer's ownership and access to the target
account. Reverse the microdeposit with reverseCredit. Payabli doesn't automatically make microdeposits when
you add a bank account, you must manually make the requests.
This feature must be enabled by Payabli on a per-merchant basis. Contact support for help.
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 |
# File 'lib/payabli/money_in/client.rb', line 245 def credit(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request_data = Payabli::MoneyIn::Types::RequestCredit.new(params).to_h non_body_param_names = %w[forceCustomerCreation idempotencyKey] body = request_data.except(*non_body_param_names) query_params = {} query_params["forceCustomerCreation"] = params[:force_customer_creation] if params.key?(:force_customer_creation) 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: [:base_url], method: "POST", path: "MoneyIn/makecredit", 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::PayabliApiResponse0.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#details(request_options: {}, **params) ⇒ Payabli::Types::TransactionQueryRecordsCustomer
Retrieve a processed transaction's details.
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/payabli/money_in/client.rb', line 296 def 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: [:base_url], method: "GET", path: "MoneyIn/details/#{URI.encode_uri_component(params[:trans_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::TransactionQueryRecordsCustomer.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#getpaid(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponseGetPaid
Make a single transaction. This method authorizes and captures a payment in one step.
365 366 367 368 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 |
# File 'lib/payabli/money_in/client.rb', line 365 def getpaid(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ach_validation force_customer_creation include_details] query_params = {} query_params["achValidation"] = params[:ach_validation] if params.key?(:ach_validation) query_params["forceCustomerCreation"] = params[:force_customer_creation] if params.key?(:force_customer_creation) query_params["includeDetails"] = params[:include_details] if params.key?(:include_details) params = params.except(*query_param_names) headers = {} headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key] headers["validationCode"] = params[:validation_code] if params[:validation_code] headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]).merge(headers) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "MoneyIn/getpaid", headers: headers, query: query_params, body: Payabli::Types::TransRequestBody.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::PayabliApiResponseGetPaid.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#getpaidv_2(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Make a single transaction. This method authorizes and captures a payment in one step. This is the v2 version of
the api/MoneyIn/getpaid endpoint, and returns the unified response format. See Pay In unified response codes
reference for more information.
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 |
# File 'lib/payabli/money_in/client.rb', line 816 def getpaidv_2(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ach_validation force_customer_creation] query_params = {} query_params["achValidation"] = params[:ach_validation] if params.key?(:ach_validation) query_params["forceCustomerCreation"] = params[:force_customer_creation] if params.key?(:force_customer_creation) params = params.except(*query_param_names) headers = {} headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key] headers["validationCode"] = params[:validation_code] if params[:validation_code] headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]).merge(headers) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v2/MoneyIn/getpaid", headers: headers, query: query_params, body: Payabli::Types::TransRequestBody.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::V2TransactionResponseWrapper.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#refund(request_options: {}, **params) ⇒ Payabli::Types::RefundResponse
Refund a transaction that has settled and send money back to the account holder. If a transaction hasn't been settled, void it instead.
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
# File 'lib/payabli/money_in/client.rb', line 486 def refund(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: [:base_url], method: "GET", path: "MoneyIn/refund/#{URI.encode_uri_component(params[:trans_id].to_s)}/#{URI.encode_uri_component(params[:amount].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::RefundResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#refund_with_instructions(request_options: {}, **params) ⇒ Payabli::Types::RefundWithInstructionsResponse
Refunds a settled transaction with split instructions.
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
# File 'lib/payabli/money_in/client.rb', line 554 def refund_with_instructions(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request_data = Payabli::MoneyIn::Types::RequestRefund.new(params).to_h non_body_param_names = %w[transId idempotencyKey] body = request_data.except(*non_body_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: [:base_url], method: "POST", path: "MoneyIn/refund/#{URI.encode_uri_component(params[:trans_id].to_s)}", headers: headers, 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::RefundWithInstructionsResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#refundv_2(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Give a full refund for a transaction that has settled and send money back to the account holder. To perform a partial refund, see Partially refund a transaction.
This is the v2 version of the refund endpoint, and returns the unified response format. See Pay In unified response codes reference for more information.
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 |
# File 'lib/payabli/money_in/client.rb', line 1021 def refundv_2(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[trans_id] body_params = params.except(*path_param_names) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v2/MoneyIn/refund/#{URI.encode_uri_component(params[:trans_id].to_s)}", headers: headers, body: body_params.empty? ? nil : Payabli::Types::RefundV2Request.new(body_params).to_h, omit_content_type_without_body: true, 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::V2TransactionResponseWrapper.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#refundv_2_amount(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Refund a transaction that has settled and send money back to the account holder. If amount is set to 0,
performs a full refund. When a non-zero amount is provided, this endpoint performs a partial refund.
This is the v2 version of the refund endpoint, and returns the unified response format. See Pay In unified response codes reference for more information.
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 |
# File 'lib/payabli/money_in/client.rb', line 1093 def refundv_2_amount(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[trans_id amount] body_params = params.except(*path_param_names) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v2/MoneyIn/refund/#{URI.encode_uri_component(params[:trans_id].to_s)}/#{URI.encode_uri_component(params[:amount].to_s)}", headers: headers, body: body_params.empty? ? nil : Payabli::Types::RefundV2Request.new(body_params).to_h, omit_content_type_without_body: true, 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::V2TransactionResponseWrapper.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#reverse(request_options: {}, **params) ⇒ Payabli::Types::ReverseResponse
A reversal either refunds or voids a transaction independent of the transaction's settlement status. Send a reversal request for a transaction, and Payabli automatically determines whether it's a refund or void. You don't need to know whether the transaction is settled or not. This endpoint only works on transactions made with the legacy endpoints. For transactions made with the current endpoints, check the transaction's settlement status and call void or refund based on the result.
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/payabli/money_in/client.rb', line 434 def reverse(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: [:base_url], method: "GET", path: "MoneyIn/reverse/#{URI.encode_uri_component(params[:trans_id].to_s)}/#{URI.encode_uri_component(params[:amount].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::ReverseResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#reverse_credit(request_options: {}, **params) ⇒ Payabli::Types::PayabliApiResponse
Reverse microdeposits that are used to verify customer account ownership and access. The transId value is
returned in the success response for the original credit transaction made with api/MoneyIn/makecredit.
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 |
# File 'lib/payabli/money_in/client.rb', line 602 def reverse_credit(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: [:base_url], method: "GET", path: "MoneyIn/reverseCredit/#{URI.encode_uri_component(params[:trans_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::PayabliApiResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#send_receipt_2_trans(request_options: {}, **params) ⇒ Payabli::Types::ReceiptResponse
Send a payment receipt for a transaction.
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 |
# File 'lib/payabli/money_in/client.rb', line 645 def send_receipt_2_trans(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["email"] = params[:email] if params.key?(:email) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "MoneyIn/sendreceipt/#{URI.encode_uri_component(params[:trans_id].to_s)}", headers: headers, query: query_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::ReceiptResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#validate(request_options: {}, **params) ⇒ Payabli::Types::ValidateResponse
Validates a card number without running a transaction or authorizing a charge.
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 |
# File 'lib/payabli/money_in/client.rb', line 698 def validate(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request_data = Payabli::MoneyIn::Types::RequestPaymentValidate.new(params).to_h non_body_param_names = %w[idempotencyKey] body = request_data.except(*non_body_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: [:base_url], method: "POST", path: "MoneyIn/validate", headers: headers, 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::ValidateResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#void(request_options: {}, **params) ⇒ Payabli::Types::VoidResponse
Cancel a transaction that hasn't been settled yet. Voiding non-captured authorizations prevents future captures. If a transaction has been settled, refund it instead.
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 |
# File 'lib/payabli/money_in/client.rb', line 753 def void(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: [:base_url], method: "GET", path: "MoneyIn/void/#{URI.encode_uri_component(params[:trans_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::VoidResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#voidv_2(request_options: {}, **params) ⇒ Payabli::Types::V2TransactionResponseWrapper
Cancel a transaction that hasn't been settled yet. Voiding non-captured authorizations prevents future captures.
This is the v2 version of the api/MoneyIn/void/{transId} endpoint, and returns the unified response format.
See Pay In unified response codes reference for more
information.
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 |
# File 'lib/payabli/money_in/client.rb', line 1140 def voidv_2(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: [:base_url], method: "POST", path: "v2/MoneyIn/void/#{URI.encode_uri_component(params[:trans_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::V2TransactionResponseWrapper.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |