pq-api-matic-sdk 1.0.0
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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +208 -0
- data/bin/console +15 -0
- data/lib/pay_quicker_sdk/api_helper.rb +10 -0
- data/lib/pay_quicker_sdk/client.rb +205 -0
- data/lib/pay_quicker_sdk/configuration.rb +229 -0
- data/lib/pay_quicker_sdk/controllers/agreements_controller.rb +129 -0
- data/lib/pay_quicker_sdk/controllers/balances_controller.rb +156 -0
- data/lib/pay_quicker_sdk/controllers/bank_accounts_controller.rb +587 -0
- data/lib/pay_quicker_sdk/controllers/base_controller.rb +60 -0
- data/lib/pay_quicker_sdk/controllers/client_side_controller.rb +237 -0
- data/lib/pay_quicker_sdk/controllers/compliance_controller.rb +77 -0
- data/lib/pay_quicker_sdk/controllers/documents_controller.rb +233 -0
- data/lib/pay_quicker_sdk/controllers/electronic_wallets_controller.rb +280 -0
- data/lib/pay_quicker_sdk/controllers/events_controller.rb +75 -0
- data/lib/pay_quicker_sdk/controllers/invitations_controller.rb +179 -0
- data/lib/pay_quicker_sdk/controllers/jobs_controller.rb +154 -0
- data/lib/pay_quicker_sdk/controllers/o_auth_authorization_controller.rb +43 -0
- data/lib/pay_quicker_sdk/controllers/payments_controller.rb +217 -0
- data/lib/pay_quicker_sdk/controllers/prepaid_cards_controller.rb +262 -0
- data/lib/pay_quicker_sdk/controllers/program_controller.rb +88 -0
- data/lib/pay_quicker_sdk/controllers/receipts_controller.rb +287 -0
- data/lib/pay_quicker_sdk/controllers/spendback_controller.rb +201 -0
- data/lib/pay_quicker_sdk/controllers/spendback_refunds_controller.rb +232 -0
- data/lib/pay_quicker_sdk/controllers/statements_controller.rb +197 -0
- data/lib/pay_quicker_sdk/controllers/transfers_controller.rb +259 -0
- data/lib/pay_quicker_sdk/controllers/users_controller.rb +151 -0
- data/lib/pay_quicker_sdk/controllers/webhooks_controller.rb +173 -0
- data/lib/pay_quicker_sdk/exceptions/api_error_result_exception.rb +80 -0
- data/lib/pay_quicker_sdk/exceptions/api_exception.rb +21 -0
- data/lib/pay_quicker_sdk/exceptions/o_auth_provider_exception.rb +64 -0
- data/lib/pay_quicker_sdk/http/auth/clientside.rb +53 -0
- data/lib/pay_quicker_sdk/http/auth/server.rb +156 -0
- data/lib/pay_quicker_sdk/http/http_call_back.rb +10 -0
- data/lib/pay_quicker_sdk/http/http_method_enum.rb +10 -0
- data/lib/pay_quicker_sdk/http/http_request.rb +10 -0
- data/lib/pay_quicker_sdk/http/http_response.rb +10 -0
- data/lib/pay_quicker_sdk/http/proxy_settings.rb +22 -0
- data/lib/pay_quicker_sdk/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/pay_quicker_sdk/logging/sdk_logger.rb +17 -0
- data/lib/pay_quicker_sdk/models/addresses.rb +45 -0
- data/lib/pay_quicker_sdk/models/agreement_list_result_json.rb +106 -0
- data/lib/pay_quicker_sdk/models/agreement_object.rb +120 -0
- data/lib/pay_quicker_sdk/models/agreement_result.rb +130 -0
- data/lib/pay_quicker_sdk/models/agreement_types.rb +64 -0
- data/lib/pay_quicker_sdk/models/authorization_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/authorization_object.rb +194 -0
- data/lib/pay_quicker_sdk/models/balance_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/balance_object.rb +118 -0
- data/lib/pay_quicker_sdk/models/balance_result.rb +128 -0
- data/lib/pay_quicker_sdk/models/bank_account_address.rb +132 -0
- data/lib/pay_quicker_sdk/models/bank_account_field.rb +83 -0
- data/lib/pay_quicker_sdk/models/bank_account_fields.rb +195 -0
- data/lib/pay_quicker_sdk/models/bank_account_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/bank_account_object.rb +226 -0
- data/lib/pay_quicker_sdk/models/bank_account_ownership.rb +36 -0
- data/lib/pay_quicker_sdk/models/bank_account_required_fields.rb +125 -0
- data/lib/pay_quicker_sdk/models/bank_account_requirement.rb +142 -0
- data/lib/pay_quicker_sdk/models/bank_account_requirement_format.rb +93 -0
- data/lib/pay_quicker_sdk/models/bank_account_requirement_format_legend.rb +93 -0
- data/lib/pay_quicker_sdk/models/bank_account_requirement_list_result.rb +110 -0
- data/lib/pay_quicker_sdk/models/bank_account_requirement_validator.rb +86 -0
- data/lib/pay_quicker_sdk/models/bank_account_result.rb +234 -0
- data/lib/pay_quicker_sdk/models/bank_account_statuses.rb +49 -0
- data/lib/pay_quicker_sdk/models/bank_account_types.rb +47 -0
- data/lib/pay_quicker_sdk/models/bank_types.rb +68 -0
- data/lib/pay_quicker_sdk/models/base_model.rb +122 -0
- data/lib/pay_quicker_sdk/models/business_contact_roles.rb +44 -0
- data/lib/pay_quicker_sdk/models/card_networks.rb +36 -0
- data/lib/pay_quicker_sdk/models/card_processors.rb +52 -0
- data/lib/pay_quicker_sdk/models/category_types.rb +36 -0
- data/lib/pay_quicker_sdk/models/countries.rb +1031 -0
- data/lib/pay_quicker_sdk/models/countries_alpha_code3.rb +1028 -0
- data/lib/pay_quicker_sdk/models/create_invitation.rb +614 -0
- data/lib/pay_quicker_sdk/models/create_or_update_bank_account.rb +163 -0
- data/lib/pay_quicker_sdk/models/create_or_update_document.rb +82 -0
- data/lib/pay_quicker_sdk/models/create_or_update_document_fields.rb +81 -0
- data/lib/pay_quicker_sdk/models/create_or_update_electronic_wallet.rb +126 -0
- data/lib/pay_quicker_sdk/models/create_or_update_user.rb +614 -0
- data/lib/pay_quicker_sdk/models/create_spendback_refund_quote.rb +173 -0
- data/lib/pay_quicker_sdk/models/create_webhook_request.rb +82 -0
- data/lib/pay_quicker_sdk/models/currencies.rb +700 -0
- data/lib/pay_quicker_sdk/models/delivery_details.rb +119 -0
- data/lib/pay_quicker_sdk/models/document_details.rb +81 -0
- data/lib/pay_quicker_sdk/models/document_list_result.rb +108 -0
- data/lib/pay_quicker_sdk/models/document_object.rb +147 -0
- data/lib/pay_quicker_sdk/models/document_requirements_list_result.rb +91 -0
- data/lib/pay_quicker_sdk/models/document_result.rb +157 -0
- data/lib/pay_quicker_sdk/models/document_status_types.rb +48 -0
- data/lib/pay_quicker_sdk/models/document_types.rb +264 -0
- data/lib/pay_quicker_sdk/models/electronic_funds_transfer_types.rb +36 -0
- data/lib/pay_quicker_sdk/models/electronic_transfer_failure_types.rb +97 -0
- data/lib/pay_quicker_sdk/models/electronic_transfer_status_types.rb +46 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_field.rb +83 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_fields.rb +41 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_object.rb +186 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_required_fields.rb +125 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_requirement.rb +166 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_requirement_format.rb +93 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_requirement_format_legend.rb +93 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_requirement_list_result.rb +110 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_requirement_validator.rb +86 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_result.rb +195 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_statuses.rb +48 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_type.rb +99 -0
- data/lib/pay_quicker_sdk/models/electronic_wallet_types.rb +368 -0
- data/lib/pay_quicker_sdk/models/event_category_types.rb +40 -0
- data/lib/pay_quicker_sdk/models/event_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/event_object.rb +191 -0
- data/lib/pay_quicker_sdk/models/event_requirement_categories.rb +56 -0
- data/lib/pay_quicker_sdk/models/event_requirements.rb +105 -0
- data/lib/pay_quicker_sdk/models/event_statuses.rb +52 -0
- data/lib/pay_quicker_sdk/models/event_types.rb +36 -0
- data/lib/pay_quicker_sdk/models/expected_delivery_types.rb +36 -0
- data/lib/pay_quicker_sdk/models/fee_configuration.rb +154 -0
- data/lib/pay_quicker_sdk/models/fee_distribution.rb +159 -0
- data/lib/pay_quicker_sdk/models/fee_responsibility_parties.rb +44 -0
- data/lib/pay_quicker_sdk/models/fee_responsibility_sources.rb +36 -0
- data/lib/pay_quicker_sdk/models/fee_sources.rb +40 -0
- data/lib/pay_quicker_sdk/models/fee_values.rb +36 -0
- data/lib/pay_quicker_sdk/models/fees.rb +222 -0
- data/lib/pay_quicker_sdk/models/fx_rate.rb +144 -0
- data/lib/pay_quicker_sdk/models/gateway_payment_job.rb +131 -0
- data/lib/pay_quicker_sdk/models/gateway_payment_job_quote.rb +167 -0
- data/lib/pay_quicker_sdk/models/gateway_payment_quote.rb +220 -0
- data/lib/pay_quicker_sdk/models/gateway_spendback_quote.rb +167 -0
- data/lib/pay_quicker_sdk/models/gateway_transfer_quote.rb +195 -0
- data/lib/pay_quicker_sdk/models/genders.rb +48 -0
- data/lib/pay_quicker_sdk/models/government_ids.rb +45 -0
- data/lib/pay_quicker_sdk/models/hateoas_relationship.rb +69 -0
- data/lib/pay_quicker_sdk/models/hateoas_self_ref.rb +84 -0
- data/lib/pay_quicker_sdk/models/identity_verification_providers.rb +62 -0
- data/lib/pay_quicker_sdk/models/identity_verification_result_sub_types.rb +38 -0
- data/lib/pay_quicker_sdk/models/identity_verification_result_types.rb +57 -0
- data/lib/pay_quicker_sdk/models/idv_check_list_result.rb +108 -0
- data/lib/pay_quicker_sdk/models/idv_check_object.rb +209 -0
- data/lib/pay_quicker_sdk/models/idv_check_result.rb +221 -0
- data/lib/pay_quicker_sdk/models/invitation_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/invitation_object.rb +262 -0
- data/lib/pay_quicker_sdk/models/invitation_result.rb +272 -0
- data/lib/pay_quicker_sdk/models/job_status_types.rb +68 -0
- data/lib/pay_quicker_sdk/models/job_types.rb +36 -0
- data/lib/pay_quicker_sdk/models/languages.rb +101 -0
- data/lib/pay_quicker_sdk/models/list_metadata.rb +116 -0
- data/lib/pay_quicker_sdk/models/lock_side_types.rb +37 -0
- data/lib/pay_quicker_sdk/models/metadata.rb +72 -0
- data/lib/pay_quicker_sdk/models/metadata_items.rb +80 -0
- data/lib/pay_quicker_sdk/models/o_auth_provider_error.rb +62 -0
- data/lib/pay_quicker_sdk/models/o_auth_scope_server.rb +36 -0
- data/lib/pay_quicker_sdk/models/o_auth_token.rb +106 -0
- data/lib/pay_quicker_sdk/models/occupations.rb +100 -0
- data/lib/pay_quicker_sdk/models/operation_result.rb +72 -0
- data/lib/pay_quicker_sdk/models/order_prepaid_card.rb +97 -0
- data/lib/pay_quicker_sdk/models/payment_job_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/payment_job_object.rb +211 -0
- data/lib/pay_quicker_sdk/models/payment_job_result.rb +220 -0
- data/lib/pay_quicker_sdk/models/payment_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/payment_object.rb +263 -0
- data/lib/pay_quicker_sdk/models/payment_purposes.rb +58 -0
- data/lib/pay_quicker_sdk/models/payment_result.rb +272 -0
- data/lib/pay_quicker_sdk/models/portal_payment_job.rb +131 -0
- data/lib/pay_quicker_sdk/models/portal_payment_job_quote.rb +176 -0
- data/lib/pay_quicker_sdk/models/portal_payment_quote.rb +228 -0
- data/lib/pay_quicker_sdk/models/portal_spendback_quote.rb +177 -0
- data/lib/pay_quicker_sdk/models/portal_transfer_quote.rb +204 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_authorizations.rb +129 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_capabilities.rb +69 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_data_object.rb +136 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_data_result.rb +146 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_data_token_object.rb +134 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_data_token_result.rb +145 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_data_type.rb +36 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_image_side.rb +36 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_object.rb +243 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_pin_object.rb +108 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_pin_result.rb +121 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_pin_token_object.rb +128 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_pin_token_result.rb +139 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_replacement_reasons.rb +48 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_result.rb +254 -0
- data/lib/pay_quicker_sdk/models/prepaid_card_statuses.rb +71 -0
- data/lib/pay_quicker_sdk/models/program_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/program_object.rb +138 -0
- data/lib/pay_quicker_sdk/models/program_result.rb +147 -0
- data/lib/pay_quicker_sdk/models/program_types.rb +44 -0
- data/lib/pay_quicker_sdk/models/receipt_descriptions.rb +84 -0
- data/lib/pay_quicker_sdk/models/receipt_details.rb +439 -0
- data/lib/pay_quicker_sdk/models/receipt_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/receipt_object.rb +241 -0
- data/lib/pay_quicker_sdk/models/receipt_result.rb +251 -0
- data/lib/pay_quicker_sdk/models/receipt_statuses.rb +76 -0
- data/lib/pay_quicker_sdk/models/replace_prepaid_card.rb +85 -0
- data/lib/pay_quicker_sdk/models/retrieve_card_data.rb +73 -0
- data/lib/pay_quicker_sdk/models/retrieve_card_pin.rb +76 -0
- data/lib/pay_quicker_sdk/models/sandbox_instance.rb +76 -0
- data/lib/pay_quicker_sdk/models/signs.rb +40 -0
- data/lib/pay_quicker_sdk/models/spendback_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/spendback_object.rb +291 -0
- data/lib/pay_quicker_sdk/models/spendback_quote_accept_result.rb +301 -0
- data/lib/pay_quicker_sdk/models/spendback_refund_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/spendback_refund_object.rb +251 -0
- data/lib/pay_quicker_sdk/models/spendback_refund_result.rb +262 -0
- data/lib/pay_quicker_sdk/models/spendback_result.rb +301 -0
- data/lib/pay_quicker_sdk/models/statement_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/statement_object.rb +183 -0
- data/lib/pay_quicker_sdk/models/statement_result.rb +192 -0
- data/lib/pay_quicker_sdk/models/tax_resident_statuses.rb +40 -0
- data/lib/pay_quicker_sdk/models/token_purposes.rb +36 -0
- data/lib/pay_quicker_sdk/models/transfer_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/transfer_method_types.rb +48 -0
- data/lib/pay_quicker_sdk/models/transfer_object.rb +309 -0
- data/lib/pay_quicker_sdk/models/transfer_result.rb +318 -0
- data/lib/pay_quicker_sdk/models/transfer_statuses.rb +76 -0
- data/lib/pay_quicker_sdk/models/transfer_types.rb +112 -0
- data/lib/pay_quicker_sdk/models/translation.rb +85 -0
- data/lib/pay_quicker_sdk/models/uat_instance.rb +48 -0
- data/lib/pay_quicker_sdk/models/update_card_pin.rb +87 -0
- data/lib/pay_quicker_sdk/models/update_prepaid_card.rb +85 -0
- data/lib/pay_quicker_sdk/models/upload_fields.rb +40 -0
- data/lib/pay_quicker_sdk/models/user_action.rb +40 -0
- data/lib/pay_quicker_sdk/models/user_doc_req_item_docs_items_metadata_items.rb +101 -0
- data/lib/pay_quicker_sdk/models/user_doc_req_item_docs_items_metadata_items_name_items.rb +83 -0
- data/lib/pay_quicker_sdk/models/user_doc_req_item_docs_items_supplemental_docs_items.rb +92 -0
- data/lib/pay_quicker_sdk/models/user_document_requirement_item.rb +105 -0
- data/lib/pay_quicker_sdk/models/user_document_requirement_item_documents_items.rb +132 -0
- data/lib/pay_quicker_sdk/models/user_event_result.rb +201 -0
- data/lib/pay_quicker_sdk/models/user_impact.rb +48 -0
- data/lib/pay_quicker_sdk/models/user_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/user_object.rb +676 -0
- data/lib/pay_quicker_sdk/models/user_result.rb +686 -0
- data/lib/pay_quicker_sdk/models/user_statuses.rb +40 -0
- data/lib/pay_quicker_sdk/models/user_types.rb +36 -0
- data/lib/pay_quicker_sdk/models/validator_types.rb +50 -0
- data/lib/pay_quicker_sdk/models/webhook_namespaces.rb +307 -0
- data/lib/pay_quicker_sdk/models/webhook_subscription_list_result.rb +106 -0
- data/lib/pay_quicker_sdk/models/webhook_subscription_object.rb +158 -0
- data/lib/pay_quicker_sdk/models/webhook_subscription_result.rb +167 -0
- data/lib/pay_quicker_sdk/models/webhook_subscription_statuses.rb +44 -0
- data/lib/pay_quicker_sdk/utilities/date_time_helper.rb +11 -0
- data/lib/pay_quicker_sdk/utilities/file_wrapper.rb +28 -0
- data/lib/pay_quicker_sdk/utilities/union_type_lookup.rb +62 -0
- data/lib/pay_quicker_sdk.rb +274 -0
- data/test/controllers/controller_test_base.rb +24 -0
- data/test/controllers/test_agreements_controller.rb +108 -0
- data/test/controllers/test_balances_controller.rb +132 -0
- data/test/controllers/test_bank_accounts_controller.rb +645 -0
- data/test/controllers/test_client_side_controller.rb +295 -0
- data/test/controllers/test_compliance_controller.rb +86 -0
- data/test/controllers/test_documents_controller.rb +212 -0
- data/test/controllers/test_electronic_wallets_controller.rb +292 -0
- data/test/controllers/test_events_controller.rb +138 -0
- data/test/controllers/test_invitations_controller.rb +162 -0
- data/test/controllers/test_jobs_controller.rb +114 -0
- data/test/controllers/test_payments_controller.rb +323 -0
- data/test/controllers/test_prepaid_cards_controller.rb +351 -0
- data/test/controllers/test_program_controller.rb +134 -0
- data/test/controllers/test_receipts_controller.rb +813 -0
- data/test/controllers/test_spendback_controller.rb +302 -0
- data/test/controllers/test_spendback_refunds_controller.rb +128 -0
- data/test/controllers/test_statements_controller.rb +192 -0
- data/test/controllers/test_transfers_controller.rb +613 -0
- data/test/controllers/test_users_controller.rb +483 -0
- data/test/controllers/test_webhooks_controller.rb +402 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +379 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# pay_quicker_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for PayQuicker by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require_relative 'controller_test_base'
|
|
7
|
+
|
|
8
|
+
class SpendbackControllerTest < ControllerTestBase
|
|
9
|
+
# Called only once for the class before any test has executed
|
|
10
|
+
def setup
|
|
11
|
+
setup_class
|
|
12
|
+
@controller = @client.spendback
|
|
13
|
+
@response_catcher = @controller.http_call_back
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Retrieve a list of [spendbacks](page:resources/spendbacks) that supports filtering, sorting, and pagination through existing mechanisms.
|
|
17
|
+
#
|
|
18
|
+
def test_list_spendbacks
|
|
19
|
+
# Parameters for the API call
|
|
20
|
+
page = 1
|
|
21
|
+
page_size = 20
|
|
22
|
+
filter = 'string'
|
|
23
|
+
sort = 'string'
|
|
24
|
+
language = 'en-US'
|
|
25
|
+
|
|
26
|
+
# Perform the API call through the SDK function
|
|
27
|
+
result = @controller.list_spendbacks(page, page_size, filter: filter,
|
|
28
|
+
sort: sort, language: language)
|
|
29
|
+
|
|
30
|
+
# Test response code
|
|
31
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
32
|
+
# Test headers
|
|
33
|
+
expected_headers = {}
|
|
34
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
35
|
+
|
|
36
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
37
|
+
|
|
38
|
+
# Test whether the captured response is as we expected
|
|
39
|
+
refute_nil(result)
|
|
40
|
+
expected_body = JSON.parse(
|
|
41
|
+
'{"payload":[{"token":"spnd-c62fd949-78ef-4f32-aef7-5de8d0c6f4a7","amoun'\
|
|
42
|
+
't":300,"autoAcceptQuote":false,"clientSpendbackId":"8c3b61d7-1f5a-4bb9-'\
|
|
43
|
+
'8ffc-ac756c27a3e1","created":"2021-06-08T19:30:03Z","currency":"USD","d'\
|
|
44
|
+
'estinationToken":"acct-3908ab5a-6ce1-474d-8b80-a63a7b147860","memo":"Sp'\
|
|
45
|
+
'endback 1 Memo","note":"Spendback 1 Note","purpose":"EXPENSE","sourceTo'\
|
|
46
|
+
'ken":"user-b41dee0e-f1ca-4e1b-9e1e-e95d13ad8fa2","status":"ACCEPTED","r'\
|
|
47
|
+
'eceiptToken":"rcpt-4aaa0738-24d9-40bd-a548-18932a6c7f5c","links":[{"hre'\
|
|
48
|
+
'f":"https://api.sandbox.payquicker.io/api/v2/spend-back/spnd-c62fd949-7'\
|
|
49
|
+
'8ef-4f32-aef7-5de8d0c6f4a7","params":{"rel":"self"}}]},{"token":"spnd-9'\
|
|
50
|
+
'd769a60-4d59-4905-bb46-8f6856121f2a","amount":35,"autoAcceptQuote":fals'\
|
|
51
|
+
'e,"clientSpendbackId":"37ebee96-eb48-4689-8079-b650e2a4e753","created":'\
|
|
52
|
+
'"2021-06-08T19:31:56Z","currency":"USD","destinationToken":"acct-3908ab'\
|
|
53
|
+
'5a-6ce1-474d-8b80-a63a7b147860","memo":"Spendback 1 Memo","note":"Spend'\
|
|
54
|
+
'back 1 Note","purpose":"EXPENSE","sourceToken":"user-b41dee0e-f1ca-4e1b'\
|
|
55
|
+
'-9e1e-e95d13ad8fa2","status":"CANCELLED","links":[{"href":"https://api.'\
|
|
56
|
+
'sandbox.payquicker.io/api/v2/spend-back/spnd-9d769a60-4d59-4905-bb46-8f'\
|
|
57
|
+
'6856121f2a","params":{"rel":"self"}}]},{"token":"spnd-bc16fb78-e391-479'\
|
|
58
|
+
'6-8a82-4fe7d7473c1a","amount":100,"autoAcceptQuote":true,"clientSpendba'\
|
|
59
|
+
'ckId":"35bc04d0-e98f-4ca9-817b-d62c3b320d6f","created":"2021-06-08T19:3'\
|
|
60
|
+
'3:18Z","currency":"USD","destinationToken":"acct-3908ab5a-6ce1-474d-8b8'\
|
|
61
|
+
'0-a63a7b147860","memo":"Spendback 1 Memo","note":"Spendback 1 Note","pu'\
|
|
62
|
+
'rpose":"EXPENSE","sourceToken":"user-b41dee0e-f1ca-4e1b-9e1e-e95d13ad8f'\
|
|
63
|
+
'a2","status":"ACCEPTED","receiptToken":"rcpt-6dbd9a70-75c9-49b7-aff6-34'\
|
|
64
|
+
'708ed491df","links":[{"href":"https://api.sandbox.payquicker.io/api/v2/'\
|
|
65
|
+
'spend-back/spnd-bc16fb78-e391-4796-8a82-4fe7d7473c1a","params":{"rel":"'\
|
|
66
|
+
'self"}}]},{"token":"spnd-4d14117c-3e8b-4275-9863-f85762ac32fb","amount"'\
|
|
67
|
+
':100,"autoAcceptQuote":true,"clientSpendbackId":"SPENDBACKRETURN-79f612'\
|
|
68
|
+
'6943bd451f99bb38649da1ea10","created":"2021-06-08T19:34:33Z","currency"'\
|
|
69
|
+
':"USD","destinationToken":"acct-70739320-c917-425c-a77a-d647c65fd175","'\
|
|
70
|
+
'sourceToken":"acct-3908ab5a-6ce1-474d-8b80-a63a7b147860","status":"FAIL'\
|
|
71
|
+
'ED","links":[{"href":"https://api.sandbox.payquicker.io/api/v2/spend-ba'\
|
|
72
|
+
'ck/spnd-4d14117c-3e8b-4275-9863-f85762ac32fb","params":{"rel":"self"}}]'\
|
|
73
|
+
'},{"token":"spnd-25b877b2-fb00-4c9a-a464-f91a6597e752","amount":20,"aut'\
|
|
74
|
+
'oAcceptQuote":true,"clientSpendbackId":"9b97af1c-53b6-42a0-b19c-eaffdc4'\
|
|
75
|
+
'8a854","created":"2021-06-08T19:35:00Z","currency":"USD","destinationTo'\
|
|
76
|
+
'ken":"acct-3908ab5a-6ce1-474d-8b80-a63a7b147860","memo":"Spendback 1 Me'\
|
|
77
|
+
'mo","note":"Spendback 1 Note","purpose":"EXPENSE","sourceToken":"user-b'\
|
|
78
|
+
'41dee0e-f1ca-4e1b-9e1e-e95d13ad8fa2","status":"ACCEPTED","receiptToken"'\
|
|
79
|
+
':"rcpt-e69b9edb-23c3-4a47-900c-60b7addbbae2","links":[{"href":"https://'\
|
|
80
|
+
'api.sandbox.payquicker.io/api/v2/spend-back/spnd-25b877b2-fb00-4c9a-a46'\
|
|
81
|
+
'4-f91a6597e752","params":{"rel":"self"}}]}],"meta":{"pageNo":"1","pageS'\
|
|
82
|
+
'ize":"5","pageCount":"13","recordCount":"64","timezone":"GMT","requestR'\
|
|
83
|
+
'ef":"request-reference-value"},"links":[{"href":"https://api.sandbox.pa'\
|
|
84
|
+
'yquicker.io/api/v2/spend-back?page=1&pageSize=5&language=en-US","params'\
|
|
85
|
+
'":{"rel":"self"}}]}'
|
|
86
|
+
)
|
|
87
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
88
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Create a [spendback](page:resources/spendbacks) quote.
|
|
92
|
+
#
|
|
93
|
+
def test_create_spendback_quote
|
|
94
|
+
# Parameters for the API call
|
|
95
|
+
body = nil
|
|
96
|
+
|
|
97
|
+
# Perform the API call through the SDK function
|
|
98
|
+
result = @controller.create_spendback_quote(body: body)
|
|
99
|
+
|
|
100
|
+
# Test response code
|
|
101
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
102
|
+
# Test headers
|
|
103
|
+
expected_headers = {}
|
|
104
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
105
|
+
|
|
106
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
107
|
+
|
|
108
|
+
# Test whether the captured response is as we expected
|
|
109
|
+
refute_nil(result)
|
|
110
|
+
expected_body = JSON.parse(
|
|
111
|
+
'{"token":"spnd-4c414196-d3dd-4233-a729-6fc2da0810eb","amount":300,"auto'\
|
|
112
|
+
'AcceptQuote":false,"clientSpendbackId":"08c6d59d-a04d-4603-8104-10c9d4c'\
|
|
113
|
+
'61f0d","created":"2022-05-02T16:45:09Z","currency":"USD","destinationTo'\
|
|
114
|
+
'ken":"acct-3908ab5a-6ce1-474d-8b80-a63a7b147860","memo":"Spendback 1 Me'\
|
|
115
|
+
'mo","note":"Spendback 1 Note","purpose":"EXPENSE","sourceToken":"user-2'\
|
|
116
|
+
'bbfc967-d12e-4647-a887-d905172fb4bc","status":"PENDING_ACCEPTANCE","lin'\
|
|
117
|
+
'ks":[{"href":"https://api.sandbox.payquicker.io/api/v2/spend-back/spnd-'\
|
|
118
|
+
'4c414196-d3dd-4233-a729-6fc2da0810eb","params":{"rel":"self"}}],"meta":'\
|
|
119
|
+
'{"timezone":"GMT","requestRef":"request-reference-value"}}'
|
|
120
|
+
)
|
|
121
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
122
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Create a [spendback](page:resources/spendbacks) quote.
|
|
126
|
+
#
|
|
127
|
+
def test_create_spendback_quote1
|
|
128
|
+
# Parameters for the API call
|
|
129
|
+
body = nil
|
|
130
|
+
|
|
131
|
+
# Perform the API call through the SDK function
|
|
132
|
+
result = @controller.create_spendback_quote(body: body)
|
|
133
|
+
|
|
134
|
+
# Test response code
|
|
135
|
+
assert_equal(201, @response_catcher.response.status_code)
|
|
136
|
+
# Test headers
|
|
137
|
+
expected_headers = {}
|
|
138
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
139
|
+
|
|
140
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
141
|
+
|
|
142
|
+
# Test whether the captured response is as we expected
|
|
143
|
+
refute_nil(result)
|
|
144
|
+
expected_body = JSON.parse(
|
|
145
|
+
'{"token":"spnd-4c414196-d3dd-4233-a729-6fc2da0810eb","amount":300,"auto'\
|
|
146
|
+
'AcceptQuote":false,"clientSpendbackId":"08c6d59d-a04d-4603-8104-10c9d4c'\
|
|
147
|
+
'61f0d","created":"2022-05-02T16:45:09Z","currency":"USD","destinationTo'\
|
|
148
|
+
'ken":"acct-3908ab5a-6ce1-474d-8b80-a63a7b147860","memo":"Spendback 1 Me'\
|
|
149
|
+
'mo","note":"Spendback 1 Note","purpose":"EXPENSE","sourceToken":"user-2'\
|
|
150
|
+
'bbfc967-d12e-4647-a887-d905172fb4bc","status":"PENDING_ACCEPTANCE","lin'\
|
|
151
|
+
'ks":[{"href":"https://api.sandbox.payquicker.io/api/v2/spend-back/spnd-'\
|
|
152
|
+
'4c414196-d3dd-4233-a729-6fc2da0810eb","params":{"rel":"self"}}],"meta":'\
|
|
153
|
+
'{"timezone":"GMT","requestRef":"request-reference-value"}}'
|
|
154
|
+
)
|
|
155
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
156
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Retrieve a single [spendbacks](page:resources/spendbacks) quote using the spendback token.
|
|
160
|
+
#
|
|
161
|
+
def test_retrieve_spendback
|
|
162
|
+
# Parameters for the API call
|
|
163
|
+
spendback_token = 'spnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
164
|
+
page = 1
|
|
165
|
+
page_size = 20
|
|
166
|
+
filter = 'string'
|
|
167
|
+
sort = 'string'
|
|
168
|
+
language = 'en-US'
|
|
169
|
+
|
|
170
|
+
# Perform the API call through the SDK function
|
|
171
|
+
result = @controller.retrieve_spendback(spendback_token, page, page_size,
|
|
172
|
+
filter: filter, sort: sort,
|
|
173
|
+
language: language)
|
|
174
|
+
|
|
175
|
+
# Test response code
|
|
176
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
177
|
+
# Test headers
|
|
178
|
+
expected_headers = {}
|
|
179
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
180
|
+
|
|
181
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
182
|
+
|
|
183
|
+
# Test whether the captured response is as we expected
|
|
184
|
+
refute_nil(result)
|
|
185
|
+
expected_body = JSON.parse(
|
|
186
|
+
'{"token":"spnd-4c414196-d3dd-4233-a729-6fc2da0810eb","amount":300,"auto'\
|
|
187
|
+
'AcceptQuote":false,"clientSpendbackId":"08c6d59d-a04d-4603-8104-10c9d4c'\
|
|
188
|
+
'61f0d","created":"2022-05-02T16:45:09Z","currency":"USD","destinationTo'\
|
|
189
|
+
'ken":"acct-3908ab5a-6ce1-474d-8b80-a63a7b147860","memo":"Spendback 1 Me'\
|
|
190
|
+
'mo","note":"Spendback 1 Note","purpose":"EXPENSE","sourceToken":"user-2'\
|
|
191
|
+
'bbfc967-d12e-4647-a887-d905172fb4bc","status":"PENDING_ACCEPTANCE","lin'\
|
|
192
|
+
'ks":[{"href":"https://api.sandbox.payquicker.io/api/v2/spend-back/spnd-'\
|
|
193
|
+
'4c414196-d3dd-4233-a729-6fc2da0810eb","params":{"rel":"self"}}],"meta":'\
|
|
194
|
+
'{"timezone":"GMT","requestRef":"request-reference-value"}}'
|
|
195
|
+
)
|
|
196
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
197
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Accept an open [spendback](page:resources/spendbacks) quote.
|
|
201
|
+
#
|
|
202
|
+
def test_accept_spendback_quote
|
|
203
|
+
# Parameters for the API call
|
|
204
|
+
spendback_token = 'spnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
205
|
+
|
|
206
|
+
# Perform the API call through the SDK function
|
|
207
|
+
result = @controller.accept_spendback_quote(spendback_token)
|
|
208
|
+
|
|
209
|
+
# Test response code
|
|
210
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
211
|
+
# Test headers
|
|
212
|
+
expected_headers = {}
|
|
213
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
214
|
+
|
|
215
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
216
|
+
|
|
217
|
+
# Test whether the captured response is as we expected
|
|
218
|
+
refute_nil(result)
|
|
219
|
+
expected_body = JSON.parse(
|
|
220
|
+
'{"token":"spnd-4c414196-d3dd-4233-a729-6fc2da0810eb","amount":300,"auto'\
|
|
221
|
+
'AcceptQuote":false,"clientSpendbackId":"08c6d59d-a04d-4603-8104-10c9d4c'\
|
|
222
|
+
'61f0d","created":"2022-05-02T16:45:09Z","currency":"USD","destinationTo'\
|
|
223
|
+
'ken":"acct-3908ab5a-6ce1-474d-8b80-a63a7b147860","memo":"Spendback 1 Me'\
|
|
224
|
+
'mo","note":"Spendback 1 Note","purpose":"EXPENSE","sourceToken":"user-2'\
|
|
225
|
+
'bbfc967-d12e-4647-a887-d905172fb4bc","status":"PENDING_ACCEPTANCE","lin'\
|
|
226
|
+
'ks":[{"href":"https://api.sandbox.payquicker.io/api/v2/spend-back/spnd-'\
|
|
227
|
+
'4c414196-d3dd-4233-a729-6fc2da0810eb","params":{"rel":"self"}}],"meta":'\
|
|
228
|
+
'{"timezone":"GMT","requestRef":"request-reference-value"}}'
|
|
229
|
+
)
|
|
230
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
231
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Accept an open [spendback](page:resources/spendbacks) quote.
|
|
235
|
+
#
|
|
236
|
+
def test_accept_spendback_quote1
|
|
237
|
+
# Parameters for the API call
|
|
238
|
+
spendback_token = 'spnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
239
|
+
|
|
240
|
+
# Perform the API call through the SDK function
|
|
241
|
+
result = @controller.accept_spendback_quote(spendback_token)
|
|
242
|
+
|
|
243
|
+
# Test response code
|
|
244
|
+
assert_equal(201, @response_catcher.response.status_code)
|
|
245
|
+
# Test headers
|
|
246
|
+
expected_headers = {}
|
|
247
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
248
|
+
|
|
249
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
250
|
+
|
|
251
|
+
# Test whether the captured response is as we expected
|
|
252
|
+
refute_nil(result)
|
|
253
|
+
expected_body = JSON.parse(
|
|
254
|
+
'{"token":"spnd-4c414196-d3dd-4233-a729-6fc2da0810eb","amount":300,"auto'\
|
|
255
|
+
'AcceptQuote":false,"clientSpendbackId":"08c6d59d-a04d-4603-8104-10c9d4c'\
|
|
256
|
+
'61f0d","created":"2022-05-02T16:45:09Z","currency":"USD","destinationTo'\
|
|
257
|
+
'ken":"acct-3908ab5a-6ce1-474d-8b80-a63a7b147860","memo":"Spendback 1 Me'\
|
|
258
|
+
'mo","note":"Spendback 1 Note","purpose":"EXPENSE","sourceToken":"user-2'\
|
|
259
|
+
'bbfc967-d12e-4647-a887-d905172fb4bc","status":"PENDING_ACCEPTANCE","lin'\
|
|
260
|
+
'ks":[{"href":"https://api.sandbox.payquicker.io/api/v2/spend-back/spnd-'\
|
|
261
|
+
'4c414196-d3dd-4233-a729-6fc2da0810eb","params":{"rel":"self"}}],"meta":'\
|
|
262
|
+
'{"timezone":"GMT","requestRef":"request-reference-value"}}'
|
|
263
|
+
)
|
|
264
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
265
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
# Cancel an open [spendback](page:resources/spendbacks) quote.
|
|
269
|
+
#
|
|
270
|
+
def test_cancel_spendback_quote
|
|
271
|
+
# Parameters for the API call
|
|
272
|
+
spendback_token = 'spnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
273
|
+
|
|
274
|
+
# Perform the API call through the SDK function
|
|
275
|
+
result = @controller.cancel_spendback_quote(spendback_token)
|
|
276
|
+
|
|
277
|
+
# Test response code
|
|
278
|
+
assert_equal(201, @response_catcher.response.status_code)
|
|
279
|
+
# Test headers
|
|
280
|
+
expected_headers = {}
|
|
281
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
282
|
+
|
|
283
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
284
|
+
|
|
285
|
+
# Test whether the captured response is as we expected
|
|
286
|
+
refute_nil(result)
|
|
287
|
+
expected_body = JSON.parse(
|
|
288
|
+
'{"token":"spnd-4c414196-d3dd-4233-a729-6fc2da0810eb","amount":300,"auto'\
|
|
289
|
+
'AcceptQuote":false,"clientSpendbackId":"08c6d59d-a04d-4603-8104-10c9d4c'\
|
|
290
|
+
'61f0d","created":"2022-05-02T16:45:09Z","currency":"USD","destinationTo'\
|
|
291
|
+
'ken":"acct-3908ab5a-6ce1-474d-8b80-a63a7b147860","memo":"Spendback 1 Me'\
|
|
292
|
+
'mo","note":"Spendback 1 Note","purpose":"EXPENSE","sourceToken":"user-2'\
|
|
293
|
+
'bbfc967-d12e-4647-a887-d905172fb4bc","status":"PENDING_ACCEPTANCE","lin'\
|
|
294
|
+
'ks":[{"href":"https://api.sandbox.payquicker.io/api/v2/spend-back/spnd-'\
|
|
295
|
+
'4c414196-d3dd-4233-a729-6fc2da0810eb","params":{"rel":"self"}}],"meta":'\
|
|
296
|
+
'{"timezone":"GMT","requestRef":"request-reference-value"}}'
|
|
297
|
+
)
|
|
298
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
299
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
end
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# pay_quicker_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for PayQuicker by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require_relative 'controller_test_base'
|
|
7
|
+
|
|
8
|
+
class SpendbackRefundsControllerTest < ControllerTestBase
|
|
9
|
+
# Called only once for the class before any test has executed
|
|
10
|
+
def setup
|
|
11
|
+
setup_class
|
|
12
|
+
@controller = @client.spendback_refunds
|
|
13
|
+
@response_catcher = @controller.http_call_back
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Retrieve a list of [spendbacks](page:resources/spendbacks) refunds that supports filtering, sorting, and pagination through existing mechanisms.
|
|
17
|
+
#
|
|
18
|
+
def test_list_spendback_refunds
|
|
19
|
+
# Parameters for the API call
|
|
20
|
+
spendback_token = 'spnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
21
|
+
page = 1
|
|
22
|
+
page_size = 20
|
|
23
|
+
filter = 'string'
|
|
24
|
+
sort = 'string'
|
|
25
|
+
language = 'en-US'
|
|
26
|
+
|
|
27
|
+
# Perform the API call through the SDK function
|
|
28
|
+
result = @controller.list_spendback_refunds(spendback_token, page,
|
|
29
|
+
page_size, filter: filter,
|
|
30
|
+
sort: sort, language: language)
|
|
31
|
+
|
|
32
|
+
# Test response code
|
|
33
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
34
|
+
# Test headers
|
|
35
|
+
expected_headers = {}
|
|
36
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
37
|
+
|
|
38
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Perform a [spendback](page:resources/spendbacks) refund for a partial amount.
|
|
42
|
+
#
|
|
43
|
+
def test_create_spendback_refund_quote
|
|
44
|
+
# Parameters for the API call
|
|
45
|
+
spendback_token = 'spnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
46
|
+
body = CreateSpendbackRefundQuote.from_hash(APIHelper.json_deserialize(
|
|
47
|
+
'{"amount":1.13}', false))
|
|
48
|
+
|
|
49
|
+
# Perform the API call through the SDK function
|
|
50
|
+
result = @controller.create_spendback_refund_quote(spendback_token,
|
|
51
|
+
body: body)
|
|
52
|
+
|
|
53
|
+
# Test response code
|
|
54
|
+
assert_equal(201, @response_catcher.response.status_code)
|
|
55
|
+
# Test headers
|
|
56
|
+
expected_headers = {}
|
|
57
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
58
|
+
|
|
59
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Cancel an spendback refund quote.
|
|
63
|
+
#
|
|
64
|
+
def test_cancel_spendback_refund_quote
|
|
65
|
+
# Parameters for the API call
|
|
66
|
+
spendback_token = 'spnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
67
|
+
refund_token = 'rfnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
68
|
+
|
|
69
|
+
# Perform the API call through the SDK function
|
|
70
|
+
result = @controller.cancel_spendback_refund_quote(spendback_token,
|
|
71
|
+
refund_token)
|
|
72
|
+
|
|
73
|
+
# Test response code
|
|
74
|
+
assert_equal(201, @response_catcher.response.status_code)
|
|
75
|
+
# Test headers
|
|
76
|
+
expected_headers = {}
|
|
77
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
78
|
+
|
|
79
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Retrieve a single spendback refund using the rfnd token
|
|
83
|
+
def test_retrieve_spendback_refund
|
|
84
|
+
# Parameters for the API call
|
|
85
|
+
spendback_token = 'spnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
86
|
+
refund_token = 'rfnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
87
|
+
page = 1
|
|
88
|
+
page_size = 20
|
|
89
|
+
filter = 'string'
|
|
90
|
+
sort = 'string'
|
|
91
|
+
language = 'en-US'
|
|
92
|
+
|
|
93
|
+
# Perform the API call through the SDK function
|
|
94
|
+
result = @controller.retrieve_spendback_refund(spendback_token,
|
|
95
|
+
refund_token, page,
|
|
96
|
+
page_size, filter: filter,
|
|
97
|
+
sort: sort,
|
|
98
|
+
language: language)
|
|
99
|
+
|
|
100
|
+
# Test response code
|
|
101
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
102
|
+
# Test headers
|
|
103
|
+
expected_headers = {}
|
|
104
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
105
|
+
|
|
106
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Accept a spendback return quote.
|
|
110
|
+
def test_accept_spendback_refund_quote
|
|
111
|
+
# Parameters for the API call
|
|
112
|
+
spendback_token = 'spnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
113
|
+
refund_token = 'rfnd-c39437e1-dc80-4293-8211-c14b5a32f762'
|
|
114
|
+
|
|
115
|
+
# Perform the API call through the SDK function
|
|
116
|
+
result = @controller.accept_spendback_refund_quote(spendback_token,
|
|
117
|
+
refund_token)
|
|
118
|
+
|
|
119
|
+
# Test response code
|
|
120
|
+
assert_equal(201, @response_catcher.response.status_code)
|
|
121
|
+
# Test headers
|
|
122
|
+
expected_headers = {}
|
|
123
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
124
|
+
|
|
125
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
end
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# pay_quicker_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for PayQuicker by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require_relative 'controller_test_base'
|
|
7
|
+
|
|
8
|
+
class StatementsControllerTest < ControllerTestBase
|
|
9
|
+
# Called only once for the class before any test has executed
|
|
10
|
+
def setup
|
|
11
|
+
setup_class
|
|
12
|
+
@controller = @client.statements
|
|
13
|
+
@response_catcher = @controller.http_call_back
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# List Prepaid Card Statements for specific user
|
|
17
|
+
def test_list_prepaid_card_statements
|
|
18
|
+
# Parameters for the API call
|
|
19
|
+
user_token = 'user-2bbfc967-d12e-4647-a887-d905172fb4bc'
|
|
20
|
+
destination_token = 'dest-4aed86e2-4929-45bf-814d-9030aef21e79'
|
|
21
|
+
page = 1
|
|
22
|
+
page_size = 20
|
|
23
|
+
filter = 'string'
|
|
24
|
+
sort = 'string'
|
|
25
|
+
language = 'en-US'
|
|
26
|
+
|
|
27
|
+
# Perform the API call through the SDK function
|
|
28
|
+
result = @controller.list_prepaid_card_statements(user_token,
|
|
29
|
+
destination_token, page,
|
|
30
|
+
page_size, filter: filter,
|
|
31
|
+
sort: sort,
|
|
32
|
+
language: language)
|
|
33
|
+
|
|
34
|
+
# Test response code
|
|
35
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
36
|
+
# Test headers
|
|
37
|
+
expected_headers = {}
|
|
38
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
39
|
+
|
|
40
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
41
|
+
|
|
42
|
+
# Test whether the captured response is as we expected
|
|
43
|
+
refute_nil(result)
|
|
44
|
+
expected_body = JSON.parse(
|
|
45
|
+
'{"payload":[{"token":"docu-17a0da7e-dd4a-44ab-9bc5-73554d9c4b48","userT'\
|
|
46
|
+
'oken":"user-02e4d25a-af16-4e74-8b8d-6fa45b78af72","prepaidCardToken":"d'\
|
|
47
|
+
'est-0aeed588-494c-444a-8c76-d5df54bdc435","from":"2021-10-18T00:00:00Z"'\
|
|
48
|
+
',"to":"2021-11-17T00:00:00Z","links":[{"href":"https://api.sandbox.payq'\
|
|
49
|
+
'uicker.io/api/v2/users/user-631b200f-665d-4dbe-bd01-3063c9dec97d/prepai'\
|
|
50
|
+
'd-cards/dest-0aeed588-494c-444a-8c76-d5df54bdc435/statements/docu-17a0d'\
|
|
51
|
+
'a7e-dd4a-44ab-9bc5-73554d9c4b48","params":{"rel":"self"}}]},{"token":"d'\
|
|
52
|
+
'ocu-b4879d40-372f-4dc5-ac85-c83b662a240e","userToken":"user-02e4d25a-af'\
|
|
53
|
+
'16-4e74-8b8d-6fa45b78af72","prepaidCardToken":"dest-0aeed588-494c-444a-'\
|
|
54
|
+
'8c76-d5df54bdc435","from":"2021-11-18T00:00:00Z","to":"2021-12-17T00:00'\
|
|
55
|
+
':00Z","links":[{"href":"https://api.sandbox.payquicker.io/api/v2/users/'\
|
|
56
|
+
'user-631b200f-665d-4dbe-bd01-3063c9dec97d/prepaid-cards/dest-0aeed588-4'\
|
|
57
|
+
'94c-444a-8c76-d5df54bdc435/statements/docu-b4879d40-372f-4dc5-ac85-c83b'\
|
|
58
|
+
'662a240e","params":{"rel":"self"}}]}],"meta":{"pageNo":"1","pageSize":"'\
|
|
59
|
+
'100","pageCount":"0","recordCount":"0","timezone":"GMT","requestRef":"r'\
|
|
60
|
+
'equest-reference-value"},"links":[{"href":"https://api.sandbox.payquick'\
|
|
61
|
+
'er.io/api/v2/users/user-631b200f-665d-4dbe-bd01-3063c9dec97d/prepaid-ca'\
|
|
62
|
+
'rds/dest-0aeed588-494c-444a-8c76-d5df54bdc435/statements","params":{"re'\
|
|
63
|
+
'l":"self"}}]}'
|
|
64
|
+
)
|
|
65
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
66
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Retrieve a single prepaid card agreement.
|
|
70
|
+
def test_retrieve_prepaid_card_statement
|
|
71
|
+
# Parameters for the API call
|
|
72
|
+
user_token = 'user-2bbfc967-d12e-4647-a887-d905172fb4bc'
|
|
73
|
+
destination_token = 'dest-4aed86e2-4929-45bf-814d-9030aef21e79'
|
|
74
|
+
document_token = 'docu-6e582242-5dd4-4883-b0c2-488e09a26595'
|
|
75
|
+
|
|
76
|
+
# Perform the API call through the SDK function
|
|
77
|
+
result = @controller.retrieve_prepaid_card_statement(user_token,
|
|
78
|
+
destination_token,
|
|
79
|
+
document_token)
|
|
80
|
+
|
|
81
|
+
# Test response code
|
|
82
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
83
|
+
# Test headers
|
|
84
|
+
expected_headers = {}
|
|
85
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
86
|
+
|
|
87
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
88
|
+
|
|
89
|
+
# Test whether the captured response is as we expected
|
|
90
|
+
refute_nil(result)
|
|
91
|
+
expected_body = JSON.parse(
|
|
92
|
+
'{"fileContents":"JVBERi0xLj........QKg2MjcKJSVFT0YK","filename":"Statem'\
|
|
93
|
+
'ent-9506c668-11-17-2021.pdf","mimeType":"application/pdf","token":"docu'\
|
|
94
|
+
'-17a0da7e-dd4a-44ab-9bc5-73554d9c4b48","userToken":"user-02e4d25a-af16-'\
|
|
95
|
+
'4e74-8b8d-6fa45b78af72","prepaidCardToken":"dest-0aeed588-494c-444a-8c7'\
|
|
96
|
+
'6-d5df54bdc435","from":"2021-10-18T00:00:00Z","to":"2021-11-17T00:00:00'\
|
|
97
|
+
'Z","links":[{"href":"https://api.sandbox.payquicker.io/api/v2/users/use'\
|
|
98
|
+
'r-ae92315b-6190-4e56-bdf5-c0189ac420a1/prepaid-cards/dest-0aeed588-494c'\
|
|
99
|
+
'-444a-8c76-d5df54bdc435/statements/docu-17a0da7e-dd4a-44ab-9bc5-73554d9'\
|
|
100
|
+
'c4b48","params":{"rel":"self"}}],"meta":{"timezone":"GMT","requestRef":'\
|
|
101
|
+
'"request-reference-value"}}'
|
|
102
|
+
)
|
|
103
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
104
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Returns all statements for the specified user
|
|
108
|
+
def test_list_statements
|
|
109
|
+
# Parameters for the API call
|
|
110
|
+
user_token = 'user-2bbfc967-d12e-4647-a887-d905172fb4bc'
|
|
111
|
+
page = 1
|
|
112
|
+
page_size = 20
|
|
113
|
+
filter = 'string'
|
|
114
|
+
sort = 'string'
|
|
115
|
+
language = 'en-US'
|
|
116
|
+
|
|
117
|
+
# Perform the API call through the SDK function
|
|
118
|
+
result = @controller.list_statements(user_token, page, page_size,
|
|
119
|
+
filter: filter, sort: sort,
|
|
120
|
+
language: language)
|
|
121
|
+
|
|
122
|
+
# Test response code
|
|
123
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
124
|
+
# Test headers
|
|
125
|
+
expected_headers = {}
|
|
126
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
127
|
+
|
|
128
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
129
|
+
|
|
130
|
+
# Test whether the captured response is as we expected
|
|
131
|
+
refute_nil(result)
|
|
132
|
+
expected_body = JSON.parse(
|
|
133
|
+
'{"payload":[{"token":"docu-17a0da7e-dd4a-44ab-9bc5-73554d9c4b48","userT'\
|
|
134
|
+
'oken":"user-02e4d25a-af16-4e74-8b8d-6fa45b78af72","prepaidCardToken":"d'\
|
|
135
|
+
'est-0aeed588-494c-444a-8c76-d5df54bdc435","from":"2021-10-18T00:00:00Z"'\
|
|
136
|
+
',"to":"2021-11-17T00:00:00Z","links":[{"href":"https://api.sandbox.payq'\
|
|
137
|
+
'uicker.io/api/v2/users/user-631b200f-665d-4dbe-bd01-3063c9dec97d/prepai'\
|
|
138
|
+
'd-cards/dest-0aeed588-494c-444a-8c76-d5df54bdc435/statements/docu-17a0d'\
|
|
139
|
+
'a7e-dd4a-44ab-9bc5-73554d9c4b48","params":{"rel":"self"}}]},{"token":"d'\
|
|
140
|
+
'ocu-b4879d40-372f-4dc5-ac85-c83b662a240e","userToken":"user-02e4d25a-af'\
|
|
141
|
+
'16-4e74-8b8d-6fa45b78af72","prepaidCardToken":"dest-0aeed588-494c-444a-'\
|
|
142
|
+
'8c76-d5df54bdc435","from":"2021-11-18T00:00:00Z","to":"2021-12-17T00:00'\
|
|
143
|
+
':00Z","links":[{"href":"https://api.sandbox.payquicker.io/api/v2/users/'\
|
|
144
|
+
'user-631b200f-665d-4dbe-bd01-3063c9dec97d/prepaid-cards/dest-0aeed588-4'\
|
|
145
|
+
'94c-444a-8c76-d5df54bdc435/statements/docu-b4879d40-372f-4dc5-ac85-c83b'\
|
|
146
|
+
'662a240e","params":{"rel":"self"}}]}],"meta":{"pageNo":"1","pageSize":"'\
|
|
147
|
+
'100","pageCount":"0","recordCount":"0","timezone":"GMT","requestRef":"r'\
|
|
148
|
+
'equest-reference-value"},"links":[{"href":"https://api.sandbox.payquick'\
|
|
149
|
+
'er.io/api/v2/users/user-631b200f-665d-4dbe-bd01-3063c9dec97d/prepaid-ca'\
|
|
150
|
+
'rds/dest-0aeed588-494c-444a-8c76-d5df54bdc435/statements","params":{"re'\
|
|
151
|
+
'l":"self"}}]}'
|
|
152
|
+
)
|
|
153
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
154
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Return a specific statement
|
|
158
|
+
def test_retrieve_statement
|
|
159
|
+
# Parameters for the API call
|
|
160
|
+
user_token = 'user-2bbfc967-d12e-4647-a887-d905172fb4bc'
|
|
161
|
+
document_token = 'docu-6e582242-5dd4-4883-b0c2-488e09a26595'
|
|
162
|
+
|
|
163
|
+
# Perform the API call through the SDK function
|
|
164
|
+
result = @controller.retrieve_statement(user_token, document_token)
|
|
165
|
+
|
|
166
|
+
# Test response code
|
|
167
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
168
|
+
# Test headers
|
|
169
|
+
expected_headers = {}
|
|
170
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
171
|
+
|
|
172
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
173
|
+
|
|
174
|
+
# Test whether the captured response is as we expected
|
|
175
|
+
refute_nil(result)
|
|
176
|
+
expected_body = JSON.parse(
|
|
177
|
+
'{"fileContents":"JVBERi0xLj........QKg2MjcKJSVFT0YK","filename":"Statem'\
|
|
178
|
+
'ent-9506c668-11-17-2021.pdf","mimeType":"application/pdf","token":"docu'\
|
|
179
|
+
'-17a0da7e-dd4a-44ab-9bc5-73554d9c4b48","userToken":"user-02e4d25a-af16-'\
|
|
180
|
+
'4e74-8b8d-6fa45b78af72","prepaidCardToken":"dest-0aeed588-494c-444a-8c7'\
|
|
181
|
+
'6-d5df54bdc435","from":"2021-10-18T00:00:00Z","to":"2021-11-17T00:00:00'\
|
|
182
|
+
'Z","links":[{"href":"https://api.sandbox.payquicker.io/api/v2/users/use'\
|
|
183
|
+
'r-ae92315b-6190-4e56-bdf5-c0189ac420a1/prepaid-cards/dest-0aeed588-494c'\
|
|
184
|
+
'-444a-8c76-d5df54bdc435/statements/docu-17a0da7e-dd4a-44ab-9bc5-73554d9'\
|
|
185
|
+
'c4b48","params":{"rel":"self"}}],"meta":{"timezone":"GMT","requestRef":'\
|
|
186
|
+
'"request-reference-value"}}'
|
|
187
|
+
)
|
|
188
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
189
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
end
|