diff --git a/.rubocop.yml b/.rubocop.yml index f4ae116..d0e4eb6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -26,4 +26,8 @@ RSpec/MultipleMemoizedHelpers: Max: 7 RSpec/Rails/HaveHttpStatus: - Enabled: false \ No newline at end of file + Enabled: false + +Metrics/ModuleLength: + Exclude: + - "spec/fixtures/**/*" diff --git a/CHANGELOG.md b/CHANGELOG.md index bf08b64..9ca2c88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ ## [Released] -## [0.13.0] - 2025-08-1 +## [0.14.0] - 2026-03-18 + +- Add uids_export request + +## [0.13.0] - 2025-08-01 - Add aggregation request diff --git a/Gemfile.lock b/Gemfile.lock index bf27078..8ed5975 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - boapi (0.12.0) + boapi (0.14.0) faraday (> 0.7.6, < 1.0) faraday_middleware (> 0.1, < 1.0) diff --git a/lib/boapi/client.rb b/lib/boapi/client.rb index e547255..794512d 100644 --- a/lib/boapi/client.rb +++ b/lib/boapi/client.rb @@ -41,6 +41,10 @@ def transactions_export(params) send_request(:post, '/api/v2/transactions/export', params) end + def transactions_uids_export(params) + send_request(:post, '/api/v2/transactions/uids_export', params) + end + def psp_balances(params) send_request(:post, '/api/v2/psp/balances', params) end diff --git a/lib/boapi/version.rb b/lib/boapi/version.rb index 1fcd357..cd97221 100644 --- a/lib/boapi/version.rb +++ b/lib/boapi/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Boapi - VERSION = '0.13.0' + VERSION = '0.14.0' end diff --git a/spec/boapi/client_spec.rb b/spec/boapi/client_spec.rb index 2417709..9034be2 100644 --- a/spec/boapi/client_spec.rb +++ b/spec/boapi/client_spec.rb @@ -173,6 +173,39 @@ end end + describe '.transactions_uids_export' do + let(:response) do + Boapi::Client.new(account_id: account_id, account_secret: account_secret).transactions_uids_export(params) + end + + let(:url) { "#{Boapi.configuration.api_host}/api/v2/transactions/uids_export" } + + context 'when valid params given' do + let(:params) do + { + response_parameters: 'main', + filter: { + uids: ['2362e0a1-6b5c-4128-9169-8a02122965b9'] + } + } + end + let(:http_status) { 200 } + + before do + stub_request(:post, url) + .to_return(status: http_status, body: TransactionFixtures.successful_transactions_uids_export_response) + end + + it 'returns successful response' do + expect(response.status).to be http_status + + expect(response.success?).to be true + expect(response.error?).to be false + expect(response.data).to eq(TransactionFixtures.successful_transactions_uids_export_response_message) + end + end + end + describe '.transactions_search' do let(:response) do Boapi::Client.new(account_id: account_id, account_secret: account_secret).transactions_search(params) diff --git a/spec/fixtures/transaction_fixtures.rb b/spec/fixtures/transaction_fixtures.rb index 084bcd9..dd371ea 100644 --- a/spec/fixtures/transaction_fixtures.rb +++ b/spec/fixtures/transaction_fixtures.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# rubocop:disable Metrics/MethodLength module TransactionFixtures module_function @@ -22,11 +23,13 @@ def failed_transactions_count_response %({"error":#{failed_transactions_count_response_message.to_json}}) end - # rubocop:disable Metrics/MethodLength def successful_transactions_list_response_message { 'pagination' => { - 'date_from' => '2023-02-20T09:02:54.516000Z', 'date_to' => '2023-02-20T11:13:43.748000Z', - 'date_type' => 'created_at', 'has_next_page' => true, 'next_date' => '2023-02-20T11:21:05.639000Z' + 'date_from' => '2023-02-20T09:02:54.516000Z', + 'date_to' => '2023-02-20T11:13:43.748000Z', + 'date_type' => 'created_at', + 'has_next_page' => true, + 'next_date' => '2023-02-20T11:21:05.639000Z' }, 'transactions' => [ { 'amount' => 200, 'created_at' => '2023-02-20T09:02:54.516000Z', 'currency' => 'BYN', @@ -40,13 +43,11 @@ def successful_transactions_list_response_message 'type' => 'tokenization', 'uid' => 'a1b993aa-d340-4d52-a0ce-92e5a30ab6a6' } ] } end - # rubocop:enable Metrics/MethodLength def successful_transactions_list_response %({"data":#{successful_transactions_list_response_message.to_json}}) end - # rubocop:disable Metrics/MethodLength def successful_transactions_export_response_message { 'transactions' => [ @@ -70,13 +71,39 @@ def successful_transactions_export_response_message } } end - # rubocop:enable Metrics/MethodLength + + def successful_transactions_uids_export_response + %({"data":#{successful_transactions_uids_export_response_message.to_json}}) + end + + def successful_transactions_uids_export_response_message + [ + { + 'amount' => 123, + 'closed_at' => nil, + 'code' => 'S.0000', + 'created_at' => '2025-06-19T10:47:19.959000Z', + 'currency' => 'BYN', + 'description' => 'Transaction with test flag', + 'expired_at' => nil, + 'fraud' => '', + 'friendly_message' => 'The transaction is successfully processed.', + 'language' => 'en', + 'manually_corrected_at' => nil, + 'merchant_id' => 222, + 'message' => 'Transaction is successful.', + 'paid_at' => nil, + 'type' => 'fraud_advice', + 'uid' => '2362e0a1-4444-3333-2222-8a02222965b9', + 'updated_at' => '2025-06-19T10:47:20.082000Z' + } + ] + end def successful_transactions_export_response %({"data":#{successful_transactions_export_response_message.to_json}}) end - # rubocop:disable Metrics/MethodLength def successful_preadjustments_surcharges_max_response_message { 'code' => 'S.0000', @@ -100,9 +127,9 @@ def successful_preadjustments_surcharges_max_response_message } } end - # rubocop:enable Metrics/MethodLength def successful_preadjustments_surcharges_max_response %({"data":#{successful_preadjustments_surcharges_max_response_message.to_json}}) end end +# rubocop:enable Metrics/MethodLength