diff --git a/lib/fintoc/transfers/client/account_verifications_methods.rb b/lib/fintoc/transfers/client/account_verifications_methods.rb new file mode 100644 index 0000000..3f43e5b --- /dev/null +++ b/lib/fintoc/transfers/client/account_verifications_methods.rb @@ -0,0 +1,39 @@ +require 'fintoc/transfers/resources/account_verification' + +module Fintoc + module Transfers + module AccountVerificationsMethods + def create_account_verification(account_number:) + data = _create_account_verification(account_number:) + build_account_verification(data) + end + + def get_account_verification(account_verification_id) + data = _get_account_verification(account_verification_id) + build_account_verification(data) + end + + def list_account_verifications(**params) + _list_account_verifications(**params).map { |data| build_account_verification(data) } + end + + private + + def _create_account_verification(account_number:) + post(version: :v2, use_jws: true).call('account_verifications', account_number:) + end + + def _get_account_verification(account_verification_id) + get(version: :v2).call("account_verifications/#{account_verification_id}") + end + + def _list_account_verifications(**params) + get(version: :v2).call('account_verifications', **params) + end + + def build_account_verification(data) + Fintoc::Transfers::AccountVerification.new(**data, client: self) + end + end + end +end diff --git a/lib/fintoc/transfers/client/client.rb b/lib/fintoc/transfers/client/client.rb index 03ac06c..2f0c817 100644 --- a/lib/fintoc/transfers/client/client.rb +++ b/lib/fintoc/transfers/client/client.rb @@ -4,6 +4,7 @@ require 'fintoc/transfers/client/account_numbers_methods' require 'fintoc/transfers/client/transfers_methods' require 'fintoc/transfers/client/simulation_methods' +require 'fintoc/transfers/client/account_verifications_methods' module Fintoc module Transfers @@ -13,6 +14,7 @@ class Client < BaseClient include AccountNumbersMethods include TransfersMethods include SimulationMethods + include AccountVerificationsMethods end end end diff --git a/lib/fintoc/transfers/resources/account.rb b/lib/fintoc/transfers/resources/account.rb index 135beb8..00094a3 100644 --- a/lib/fintoc/transfers/resources/account.rb +++ b/lib/fintoc/transfers/resources/account.rb @@ -1,11 +1,8 @@ require 'money' -require 'fintoc/utils' module Fintoc module Transfers class Account - include Utils - attr_reader :id, :object, :mode, :description, :available_balance, :currency, :is_root, :root_account_number_id, :root_account_number, :status, :entity @@ -86,7 +83,9 @@ def simulate_receive_transfer(amount:) private def refresh_from_account(account) - raise 'Account must be the same instance' unless account.id == @id + unless account.id == @id + raise ArgumentError, 'Account must be the same instance' + end @object = account.object @mode = account.mode diff --git a/lib/fintoc/transfers/resources/account_number.rb b/lib/fintoc/transfers/resources/account_number.rb index 4663b57..82aff76 100644 --- a/lib/fintoc/transfers/resources/account_number.rb +++ b/lib/fintoc/transfers/resources/account_number.rb @@ -1,10 +1,6 @@ -require 'fintoc/utils' - module Fintoc module Transfers class AccountNumber - include Utils - attr_reader :id, :object, :description, :number, :created_at, :updated_at, :mode, :status, :is_root, :account_id, :metadata @@ -87,7 +83,9 @@ def simulate_receive_transfer(amount:, currency: 'MXN') private def refresh_from_account_number(account_number) - raise 'AccountNumber must be the same instance' unless account_number.id == @id + unless account_number.id == @id + raise ArgumentError, 'AccountNumber must be the same instance' + end @object = account_number.object @description = account_number.description diff --git a/lib/fintoc/transfers/resources/account_verification.rb b/lib/fintoc/transfers/resources/account_verification.rb new file mode 100644 index 0000000..1881411 --- /dev/null +++ b/lib/fintoc/transfers/resources/account_verification.rb @@ -0,0 +1,73 @@ +module Fintoc + module Transfers + class AccountVerification + attr_reader :id, :object, :status, :reason, :transfer_id, :counterparty, :mode, :receipt_url, + :transaction_date + + def initialize( + id:, + object:, + status:, + reason:, + transfer_id:, + counterparty:, + mode:, + receipt_url:, + transaction_date:, + client: nil, + ** + ) + @id = id + @object = object + @status = status + @reason = reason + @transfer_id = transfer_id + @counterparty = counterparty + @mode = mode + @receipt_url = receipt_url + @transaction_date = transaction_date + @client = client + end + + def to_s + "🔍 Account Verification (#{@id}) - #{@status}" + end + + def refresh + fresh_verification = @client.get_account_verification(@id) + refresh_from_verification(fresh_verification) + end + + def pending? + @status == 'pending' + end + + def succeeded? + @status == 'succeeded' + end + + def failed? + @status == 'failed' + end + + private + + def refresh_from_verification(verification) + unless verification.id == @id + raise ArgumentError, 'Account verification must be the same instance' + end + + @object = verification.object + @status = verification.status + @reason = verification.reason + @transfer_id = verification.transfer_id + @counterparty = verification.counterparty + @mode = verification.mode + @receipt_url = verification.receipt_url + @transaction_date = verification.transaction_date + + self + end + end + end +end diff --git a/lib/fintoc/transfers/resources/entity.rb b/lib/fintoc/transfers/resources/entity.rb index 2828bb8..88cebc5 100644 --- a/lib/fintoc/transfers/resources/entity.rb +++ b/lib/fintoc/transfers/resources/entity.rb @@ -1,10 +1,6 @@ -require 'fintoc/utils' - module Fintoc module Transfers class Entity - include Utils - attr_reader :object, :mode, :id, :holder_name, :holder_id, :is_root def initialize( @@ -38,7 +34,9 @@ def refresh private def refresh_from_entity(entity) - raise 'Entity must be the same instance' unless entity.id == @id + unless entity.id == @id + raise ArgumentError, 'Entity must be the same instance' + end @object = entity.object @mode = entity.mode diff --git a/lib/fintoc/transfers/resources/transfer.rb b/lib/fintoc/transfers/resources/transfer.rb index 5274192..c0f525c 100644 --- a/lib/fintoc/transfers/resources/transfer.rb +++ b/lib/fintoc/transfers/resources/transfer.rb @@ -1,11 +1,8 @@ require 'money' -require 'fintoc/utils' module Fintoc module Transfers class Transfer - include Utils - attr_reader :id, :object, :amount, :currency, :direction, :status, :mode, :post_date, :transaction_date, :comment, :reference_id, :receipt_url, :tracking_key, :return_reason, :counterparty, :account_number, @@ -105,7 +102,9 @@ def outbound? private def refresh_from_transfer(transfer) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength - raise 'Transfer must be the same instance' unless transfer.id == @id + unless transfer.id == @id + raise ArgumentError, 'Transfer must be the same instance' + end @object = transfer.object @amount = transfer.amount diff --git a/spec/lib/fintoc/transfers/account_number_spec.rb b/spec/lib/fintoc/transfers/account_number_spec.rb index cb8b960..3ef5403 100644 --- a/spec/lib/fintoc/transfers/account_number_spec.rb +++ b/spec/lib/fintoc/transfers/account_number_spec.rb @@ -126,6 +126,18 @@ account_number.refresh expect(client).to have_received(:get_account_number).with('acno_Kasf91034gj1AD') end + + it 'raises an error if the account number ID does not match' do + wrong_account_number = described_class.new(**data, id: 'wrong_id') + + allow(client) + .to receive(:get_account_number) + .with('acno_Kasf91034gj1AD') + .and_return(wrong_account_number) + + expect { account_number.refresh } + .to raise_error(ArgumentError, 'AccountNumber must be the same instance') + end end describe '#update' do diff --git a/spec/lib/fintoc/transfers/account_spec.rb b/spec/lib/fintoc/transfers/account_spec.rb index d72346f..c06d4ba 100644 --- a/spec/lib/fintoc/transfers/account_spec.rb +++ b/spec/lib/fintoc/transfers/account_spec.rb @@ -124,6 +124,14 @@ expect(account.description).to eq('Updated account description') end + + it 'raises an error if the account ID does not match' do + wrong_account = described_class.new(**data, id: 'wrong_id') + + allow(client).to receive(:get_account).with('acc_123').and_return(wrong_account) + + expect { account.refresh }.to raise_error(ArgumentError, 'Account must be the same instance') + end end describe '#update' do diff --git a/spec/lib/fintoc/transfers/account_verification_spec.rb b/spec/lib/fintoc/transfers/account_verification_spec.rb new file mode 100644 index 0000000..97f4148 --- /dev/null +++ b/spec/lib/fintoc/transfers/account_verification_spec.rb @@ -0,0 +1,152 @@ +require 'fintoc/transfers/resources/account_verification' + +RSpec.describe Fintoc::Transfers::AccountVerification do + let(:api_key) { 'sk_test_SeCreT-aPi_KeY' } + let(:client) { Fintoc::Transfers::Client.new(api_key) } + + let(:counterparty_data) do + { + account_number: '123456789123455789', + holder_id: 'FLA1234567890', + holder_name: 'Carmen Marcela', + account_type: 'clabe', + institution: { + id: 'mx_banco_bbva', + name: 'BBVA Mexico', + country: 'mx' + } + } + end + + let(:data) do + { + object: 'account_verification', + id: 'accv_fdme30s11j5k7l1mekq4', + status: 'succeeded', + reason: nil, + transfer_id: 'tr_fdskjldasjkl', + counterparty: counterparty_data, + mode: 'test', + receipt_url: 'https://www.banxico.org.mx/cep/', + transaction_date: '2020-04-17T00:00:00.000Z', + client: client + } + end + + let(:account_verification) { described_class.new(**data) } + + describe '#new' do + it 'creates an instance of AccountVerification' do + expect(account_verification).to be_an_instance_of(described_class) + end + + it 'sets all attributes correctly' do # rubocop:disable RSpec/ExampleLength + expect(account_verification).to have_attributes( + object: 'account_verification', + id: 'accv_fdme30s11j5k7l1mekq4', + status: 'succeeded', + reason: nil, + transfer_id: 'tr_fdskjldasjkl', + counterparty: counterparty_data, + mode: 'test', + receipt_url: 'https://www.banxico.org.mx/cep/', + transaction_date: '2020-04-17T00:00:00.000Z' + ) + end + end + + describe '#to_s' do + it 'returns a string representation' do + expect(account_verification.to_s) + .to eq('🔍 Account Verification (accv_fdme30s11j5k7l1mekq4) - succeeded') + end + end + + describe 'status methods' do + context 'when status is pending' do + let(:pending_verification) { described_class.new(**data, status: 'pending') } + + it '#pending? returns true' do + expect(pending_verification.pending?).to be true + end + + it '#succeeded? returns false' do + expect(pending_verification.succeeded?).to be false + end + + it '#failed? returns false' do + expect(pending_verification.failed?).to be false + end + end + + context 'when status is succeeded' do + it '#pending? returns false' do + expect(account_verification.pending?).to be false + end + + it '#succeeded? returns true' do + expect(account_verification.succeeded?).to be true + end + + it '#failed? returns false' do + expect(account_verification.failed?).to be false + end + end + + context 'when status is failed' do + let(:failed_verification) { described_class.new(**data, status: 'failed') } + + it '#pending? returns false' do + expect(failed_verification.pending?).to be false + end + + it '#succeeded? returns false' do + expect(failed_verification.succeeded?).to be false + end + + it '#failed? returns true' do + expect(failed_verification.failed?).to be true + end + end + end + + describe '#refresh' do + let(:fresh_data) do + data.merge( + status: 'failed', + reason: 'insufficient_funds' + ) + end + + let(:fresh_verification) { described_class.new(**fresh_data) } + + before do + allow(client) + .to receive(:get_account_verification) + .with('accv_fdme30s11j5k7l1mekq4') + .and_return(fresh_verification) + end + + it 'refreshes the account verification data' do + result = account_verification.refresh + + expect(result).to eq(account_verification) + expect(account_verification).to have_attributes( + status: 'failed', + reason: 'insufficient_funds' + ) + end + + it 'raises an error if the verification ID does not match' do + wrong_verification = described_class.new(**fresh_data, id: 'wrong_id') + + allow(client) + .to receive(:get_account_verification) + .with('accv_fdme30s11j5k7l1mekq4') + .and_return(wrong_verification) + + expect { account_verification.refresh } + .to raise_error(ArgumentError, 'Account verification must be the same instance') + end + end +end diff --git a/spec/lib/fintoc/transfers/account_verifications_methods_spec.rb b/spec/lib/fintoc/transfers/account_verifications_methods_spec.rb new file mode 100644 index 0000000..5b172a6 --- /dev/null +++ b/spec/lib/fintoc/transfers/account_verifications_methods_spec.rb @@ -0,0 +1,67 @@ +require 'fintoc/transfers/client/account_verifications_methods' + +RSpec.describe Fintoc::Transfers::AccountVerificationsMethods do + let(:client) { test_class.new(api_key) } + + let(:test_class) do + Class.new do + include Fintoc::Transfers::AccountVerificationsMethods + + def initialize(api_key) + @api_key = api_key + end + + # Mock the base client methods needed for testing + def get(*, **) + proc { |_resource, **_kwargs| { mock: 'response' } } + end + + def post(*, **) + proc { |_resource, **_kwargs| { mock: 'response' } } + end + end + end + + let(:api_key) { 'sk_test_9c8d8CeyBTx1VcJzuDgpm4H-bywJCeSx' } + + describe '#create_account_verification' do + before do + allow(Fintoc::Transfers::AccountVerification).to receive(:new) + end + + it 'calls build_account_verification with the response' do + client.create_account_verification(account_number: '735969000000203226') + expect(Fintoc::Transfers::AccountVerification) + .to have_received(:new).with(mock: 'response', client:) + end + end + + describe '#get_account_verification' do + before do + allow(Fintoc::Transfers::AccountVerification).to receive(:new) + end + + it 'calls build_account_verification with the response' do + client.get_account_verification('accv_123') + expect(Fintoc::Transfers::AccountVerification) + .to have_received(:new).with(mock: 'response', client:) + end + end + + describe '#list_account_verifications' do + before do + allow(client) + .to receive(:_list_account_verifications) + .and_return([{ mock: 'response1' }, { mock: 'response2' }]) + allow(Fintoc::Transfers::AccountVerification).to receive(:new) + end + + it 'calls build_account_verification for each response item' do + client.list_account_verifications + expect(Fintoc::Transfers::AccountVerification) + .to have_received(:new).with(mock: 'response1', client:) + expect(Fintoc::Transfers::AccountVerification) + .to have_received(:new).with(mock: 'response2', client:) + end + end +end diff --git a/spec/lib/fintoc/transfers/client_spec.rb b/spec/lib/fintoc/transfers/client_spec.rb index b0bbac4..44775ad 100644 --- a/spec/lib/fintoc/transfers/client_spec.rb +++ b/spec/lib/fintoc/transfers/client_spec.rb @@ -28,4 +28,6 @@ it_behaves_like 'a client with transfers methods' it_behaves_like 'a client with simulation methods' + + it_behaves_like 'a client with account verifications methods' end diff --git a/spec/lib/fintoc/transfers/entity_spec.rb b/spec/lib/fintoc/transfers/entity_spec.rb index 321459b..f2cddc0 100644 --- a/spec/lib/fintoc/transfers/entity_spec.rb +++ b/spec/lib/fintoc/transfers/entity_spec.rb @@ -68,5 +68,13 @@ holder_name: 'Updated Company LLC' ) end + + it 'raises an error if the entity ID does not match' do + wrong_entity = described_class.new(**data, id: 'wrong_id') + + allow(client).to receive(:get_entity).with('ent_12345').and_return(wrong_entity) + + expect { entity.refresh }.to raise_error(ArgumentError, 'Entity must be the same instance') + end end end diff --git a/spec/lib/fintoc/transfers/transfer_spec.rb b/spec/lib/fintoc/transfers/transfer_spec.rb index 8abe098..6ccbc8f 100644 --- a/spec/lib/fintoc/transfers/transfer_spec.rb +++ b/spec/lib/fintoc/transfers/transfer_spec.rb @@ -228,6 +228,16 @@ it 'returns self' do expect(transfer.refresh).to eq(transfer) end + + it 'raises an error if the transfer ID does not match' do + wrong_transfer = described_class.new(**data, id: 'wrong_id') + + allow(client) + .to receive(:get_transfer).with('tr_329NGN1M4If6VvcMRALv4gjAQJx').and_return(wrong_transfer) + + expect { transfer.refresh } + .to raise_error(ArgumentError, 'Transfer must be the same instance') + end end describe '#return_transfer' do diff --git a/spec/support/shared_examples/clients/account_verifications_client_examples.rb b/spec/support/shared_examples/clients/account_verifications_client_examples.rb new file mode 100644 index 0000000..186ef7d --- /dev/null +++ b/spec/support/shared_examples/clients/account_verifications_client_examples.rb @@ -0,0 +1,88 @@ +require 'openssl' + +RSpec.shared_examples 'a client with account verifications methods' do + let(:account_verification_id) { 'accv_32F2NLQOOwbeOvfuw8Y1zZCfGdw' } + let(:account_number) { '735969000000203226' } + let(:jws_private_key) do + key_string = "-----BEGIN PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDNLwwQr/uFToDH +8x1GHlW5gRsngNp8J+sg8vZc5jX+dISZh42CNM2eMSyPOMLSZL08xIA9ISoxjCJb +rpJ7MY9OKOZdrFheclz8e3z/hVcXpmgT0JARYIyKUb2sgoh1JsH3aSQILTc4KuDM +dm0+WIWl9tOqKXm23j9RcYL+WOUCcLYNj3xga39CnXdqT3dy2fMIOJ+vZxfSxPhG +EBTyV6v9jrMbRukhxllTqDc64WkVdt0MOvzFzcSNkGcvHRdrK1w+x5IhfsYGtv+9 +mz+fvmI88qGsb0x8peGVDgWfQjykxrB/8umpQKANn9bqjyay+ogRRwv05dmaB/gm +IycvGXE7AgMBAAECggEAI4gTKcyf3MzkZjvGhP75z175KdUZgMiU4ibQ3POMxBy/ +XaroqXSlatCPK9ojerWxQ5Wvs2ZL3TqsNH49pZHGhD127x/KSci6K4ri8YjQtSq+ ++Tdzy16R194h337XTJpCmqqdb8EMv/BE74NOla5UrpHYw63dAvrnsh3bFlqkhdBZ +E5OBfdLyxGy5FYdewV803a8XGfnDfT7RrsdWhPib8E3i+wix+/dv10AX/+Y6VPpG +2EPXRV63UtmO2EVXyIGT5kSAnzZBJPIB3EYTlm1A86PxQGVD4X8LAUXIj6VRVC8h +B1KXb5YZ9W1vYmKyWUZPyMQHMpUTNGEuU/EtN0aOCQKBgQD+zMd1+3BhoSwBusXb +EK2SBJwn9TfqdUghsFHNz0xjvpAFKpO55qA7XyilZwZeJsOzPQZ33ERCRk18crCd +Q6oWI15xKjPl+Dfxf4UYjokx/iQCCHu8lJ6TXcEwXniIs6CVsUq9QV+s6JBlb3C4 +qD/wwp7VrmbcMLfIUs3nb3tqHQKBgQDOJnGylmqC/l4BCZj9BhLiVg7nioY24lG1 +9DY0/nnnbuMtDQ+8VUKtt93Or8giejOVqj3BZ8/TflkwCQAt9cIvFG50aTVZBo2E +4uPJLGSBLrQqpuUNPR2O239o4RqGgDICkh9TRH9D9GsekLRCgefLRubUyuZZ4pI9 +j1ty2kMpNwKBgGtYJmgEKBJZbkrEPvrNifJMUuVan9X81wiqWaxVOx+CdvZWO6pE +CRk6O8uDHeGofyYR/ZmdiHxLVfWp89ItYYi2GeGfIAIwkpEBYjc4RYB0SwM4Q7js +++mlw+/2vN0KoAqwiIY29nHIAJ1bV6fT6iwqMfRf5yG4vJR+nhR0mQ/ZAoGAfgLJ +5RxEpyXNWF0Bg0i/KlLocWgfelUFFW/d4q7a3TjO7K7bO4fyZjXKA5k3gLup5IZX +kW1fgCvvYIlf7rgWpqiai9XzoiN7RgtaqZHVLZHa12eFA36kHrrVOsq+aBDcgO3I +8CEimetBv0E8rpqxkXQZjWEpRTBVrAOBJsd73ikCgYAwf4fnpTcEa4g6ejmbjkXw +yacTlKFuxyLZHZ5R7D0+Fj19gwm9EzvrRIEcX84ebiJ8P1bL3kycQmLV19zE5B3M +pcsQmZ28/Oa3xCPiy8CDyDuiDbbNfnR1Ot3IbgfFL7xPYySljJbMyl7vhKJIacWs +draAAQ5iJEb5BR8AmL6tAQ== +-----END PRIVATE KEY-----" + OpenSSL::PKey::RSA.new(key_string) + end + + it 'responds to account verification-specific methods' do + expect(client) + .to respond_to(:create_account_verification) + .and respond_to(:get_account_verification) + .and respond_to(:list_account_verifications) + end + + describe '#create_account_verification' do + it 'returns an AccountVerification instance', :vcr do + account_verification = client.create_account_verification(account_number:) + + expect(account_verification) + .to be_an_instance_of(Fintoc::Transfers::AccountVerification) + .and have_attributes( + object: 'account_verification', + status: 'pending' + ) + end + end + + describe '#get_account_verification' do + it 'returns an AccountVerification instance', :vcr do + account_verification = client.get_account_verification(account_verification_id) + + expect(account_verification) + .to be_an_instance_of(Fintoc::Transfers::AccountVerification) + .and have_attributes( + id: account_verification_id, + object: 'account_verification' + ) + end + end + + describe '#list_account_verifications' do + it 'returns an array of AccountVerification instances', :vcr do + account_verifications = client.list_account_verifications + + expect(account_verifications).to all(be_a(Fintoc::Transfers::AccountVerification)) + expect(account_verifications.size).to be >= 1 + end + + it 'accepts filtering parameters', :vcr do + account_verifications = client.list_account_verifications( + since: '2020-01-01T00:00:00.000Z', + limit: 10 + ) + + expect(account_verifications).to all(be_a(Fintoc::Transfers::AccountVerification)) + end + end +end diff --git a/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_create_account_verification/returns_an_AccountVerification_instance.yml b/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_create_account_verification/returns_an_AccountVerification_instance.yml new file mode 100644 index 0000000..22e08c8 --- /dev/null +++ b/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_create_account_verification/returns_an_AccountVerification_instance.yml @@ -0,0 +1,77 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.fintoc.com/v2/account_verifications + body: + encoding: UTF-8 + string: '{"account_number":"735969000000203226"}' + headers: + Authorization: + - Bearer sk_test_SeCreT-aPi_KeY + User-Agent: + - fintoc-ruby/0.2.0 + Fintoc-Jws-Signature: + - eyJhbGciOiJSUzI1NiIsIm5vbmNlIjoiNDk3OTQ0MWIxNzg0Mzg4OTlkYzA5MzNhYTcxZjVmZmUiLCJ0cyI6MTc1NzAwMTk1NywiY3JpdCI6WyJ0cyIsIm5vbmNlIl19.VqYcVdHBcQiYaXZFtNKqS5giFTQDW6syn1VHj64ZzEY59Qk4JCT2G8ne0KwqVtNZv6FtUbeCzzfuucR9pGlaVM-iYJiBhy-HOjI9VUDUA_GYvWbs3M_kqowBr3hi5yVWV1Xb6FlFZs_zoIdKWPGYXNPqHEHXT7Qv8LFBZNYgc5r9jjzQy38gNVktmcKFcXTcVRoNzrzRe5VjmPFzLNJ0B8_j_kyvJJdCckQ79UIYKjA9Ocmu6nN1jmiG4SdZkG69cAouXDwZmGSnrQtsWSkQOnU4Mke_m4buVzOGD2zrzmCzu4rY9LmkwbgOxJKO825GadgZWXq4LJPINXr-Eo7Wzw + Connection: + - close + Content-Type: + - application/json; charset=utf-8 + Host: + - api.fintoc.com + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 04 Sep 2025 16:05:59 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '402' + Connection: + - close + Cf-Ray: + - 979ebb409a8ea0c8-CPH + X-Frame-Options: + - SAMEORIGIN + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + X-Download-Options: + - noopen + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - strict-origin-when-cross-origin + Etag: + - W/"1658fee2632f17fae8461056906cb5b5" + Cache-Control: + - max-age=0, private, must-revalidate + X-Request-Id: + - 524eefcc-c549-49f1-a580-7c40ede80cc7 + X-Runtime: + - '0.437973' + Vary: + - Origin + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + Report-To: + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=qfNKs9IPvaEYbQp%2FW973gSQIfZ4FWbQCND8e7nVZDSqeVVzFVlZ8xu2xcS3ClzIZ63J%2FsqM6okeJCgeI6TWwF33xZrrh6cX98RnV5UsKIWcevebo%2BbYvGvvRmzwiTBpQ"}],"group":"cf-nel","max_age":604800}' + Nel: + - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' + Strict-Transport-Security: + - max-age=15552000; includeSubDomains; preload + Server: + - cloudflare + Server-Timing: + - cfL4;desc="?proto=TCP&rtt=337737&min_rtt=298128&rtt_var=140090&sent=7&recv=8&lost=0&retrans=0&sent_bytes=3879&recv_bytes=2406&delivery_rate=14289&cwnd=33&unsent_bytes=0&cid=59bf549ecb9beb68&ts=1299&x=0" + body: + encoding: UTF-8 + string: '{"object":"account_verification","id":"accv_32F2NLQOOwbeOvfuw8Y1zZCfGdw","status":"pending","reason":null,"transfer_id":"tr_32F2NNCg5s9JQy5AX5A6toWX9rd","counterparty":{"holder_id":null,"holder_name":null,"account_number":"735969000000203226","account_type":"clabe","institution":{"id":"90735","name":"FINTOC","country":"mx"}},"mode":"test","receipt_url":null,"transaction_date":"2025-09-04T16:05:58Z"}' + recorded_at: Thu, 04 Sep 2025 16:05:59 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_get_account_verification/returns_an_AccountVerification_instance.yml b/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_get_account_verification/returns_an_AccountVerification_instance.yml new file mode 100644 index 0000000..4d90e82 --- /dev/null +++ b/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_get_account_verification/returns_an_AccountVerification_instance.yml @@ -0,0 +1,74 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.fintoc.com/v2/account_verifications/accv_32F2NLQOOwbeOvfuw8Y1zZCfGdw + body: + encoding: ASCII-8BIT + string: '' + headers: + Authorization: + - Bearer sk_test_SeCreT-aPi_KeY + User-Agent: + - fintoc-ruby/0.2.0 + Connection: + - close + Host: + - api.fintoc.com + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 04 Sep 2025 16:06:50 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '603' + Connection: + - close + Cf-Ray: + - 979ebc832f69c9be-CPH + X-Frame-Options: + - SAMEORIGIN + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + X-Download-Options: + - noopen + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - strict-origin-when-cross-origin + Etag: + - W/"912e11cf6908023f112c73707dbb82cb" + Cache-Control: + - max-age=0, private, must-revalidate + X-Request-Id: + - 3f90fdd2-c468-4a93-bb74-763aee816c05 + X-Runtime: + - '0.216110' + Vary: + - Origin + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + Report-To: + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=zqdiTM9nU8Qd6m59OzNrTLbjhQMmXzGe0Way81DobYWZZwTSUrKSBDOHAfPmrZx%2BDi4c%2F1jW9bEgvG26J2bxCDro%2FszTccBpILKFysVXlDV2BU1PPe9I8POu2YsanUm4"}],"group":"cf-nel","max_age":604800}' + Nel: + - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' + Strict-Transport-Security: + - max-age=15552000; includeSubDomains; preload + Server: + - cloudflare + Server-Timing: + - cfL4;desc="?proto=TCP&rtt=262243&min_rtt=249577&rtt_var=118924&sent=7&recv=8&lost=0&retrans=0&sent_bytes=3880&recv_bytes=1837&delivery_rate=12139&cwnd=33&unsent_bytes=0&cid=28465d7eaadf9d83&ts=1103&x=0" + body: + encoding: UTF-8 + string: '{"object":"account_verification","id":"accv_32F2NLQOOwbeOvfuw8Y1zZCfGdw","status":"succeeded","reason":null,"transfer_id":"tr_32F2NNCg5s9JQy5AX5A6toWX9rd","counterparty":{"holder_id":"PPPR510220DB1","holder_name":"Adrianne + Murray","account_number":"735969000000203226","account_type":"clabe","institution":{"id":"90735","name":"FINTOC","country":"mx"}},"mode":"test","receipt_url":"https://www.banxico.org.mx/cep-beta/go?i=90735\u0026s=dummy\u0026d=ce2zbPihXLg1MobUPCRrTrw9bB97KEYDGHg6rSGK7PaklMO9uV2ancSh1z2p8bIQCcwNCndMOBQx6ISkSOLTcLQ44r6s3qO7aVSNcWSiOp4%3D","transaction_date":"2025-09-04T16:05:58Z"}' + recorded_at: Thu, 04 Sep 2025 16:06:50 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_list_account_verifications/accepts_filtering_parameters.yml b/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_list_account_verifications/accepts_filtering_parameters.yml new file mode 100644 index 0000000..33286f8 --- /dev/null +++ b/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_list_account_verifications/accepts_filtering_parameters.yml @@ -0,0 +1,76 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.fintoc.com/v2/account_verifications?limit=10&since=2020-01-01T00:00:00.000Z + body: + encoding: ASCII-8BIT + string: '' + headers: + Authorization: + - Bearer sk_test_SeCreT-aPi_KeY + User-Agent: + - fintoc-ruby/0.2.0 + Connection: + - close + Host: + - api.fintoc.com + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 04 Sep 2025 16:06:54 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '605' + Connection: + - close + Cf-Ray: + - 979ebc9b5dbfa94d-SYD + X-Frame-Options: + - SAMEORIGIN + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + X-Download-Options: + - noopen + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - strict-origin-when-cross-origin + Link: + - '' + Etag: + - W/"9b52bfc2b4c200446ac3f7bc672c6bd4" + Cache-Control: + - max-age=0, private, must-revalidate + X-Request-Id: + - 3753ef34-9c63-40f2-afab-150600aa2505 + X-Runtime: + - '0.072507' + Vary: + - Origin + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + Report-To: + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=FlX9RxXLN8cEbpqb%2FmxNG5yyxKiTowsxAbk61hhP64pnuDSagg8wwbL1xKXM7fhFdizhe7P8sVMPek7gvwzxyq5tzGj5rLEMTh2IvMbtXRluT9RhbZ5wbcvsuE%2Bc8CCb"}],"group":"cf-nel","max_age":604800}' + Nel: + - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' + Strict-Transport-Security: + - max-age=15552000; includeSubDomains; preload + Server: + - cloudflare + Server-Timing: + - cfL4;desc="?proto=TCP&rtt=359899&min_rtt=359292&rtt_var=135168&sent=7&recv=8&lost=0&retrans=0&sent_bytes=3880&recv_bytes=1848&delivery_rate=11856&cwnd=33&unsent_bytes=0&cid=99ecee391b9b8fc8&ts=1091&x=0" + body: + encoding: UTF-8 + string: '[{"object":"account_verification","id":"accv_32F2NLQOOwbeOvfuw8Y1zZCfGdw","status":"succeeded","reason":null,"transfer_id":"tr_32F2NNCg5s9JQy5AX5A6toWX9rd","counterparty":{"holder_id":"PPPR510220DB1","holder_name":"Adrianne + Murray","account_number":"735969000000203226","account_type":"clabe","institution":{"id":"90735","name":"FINTOC","country":"mx"}},"mode":"test","receipt_url":"https://www.banxico.org.mx/cep-beta/go?i=90735\u0026s=dummy\u0026d=ce2zbPihXLg1MobUPCRrTrw9bB97KEYDGHg6rSGK7PaklMO9uV2ancSh1z2p8bIQCcwNCndMOBQx6ISkSOLTcLQ44r6s3qO7aVSNcWSiOp4%3D","transaction_date":"2025-09-04T16:05:58Z"}]' + recorded_at: Thu, 04 Sep 2025 16:06:54 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_list_account_verifications/returns_an_array_of_AccountVerification_instances.yml b/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_list_account_verifications/returns_an_array_of_AccountVerification_instances.yml new file mode 100644 index 0000000..f90c530 --- /dev/null +++ b/spec/vcr/Fintoc_Transfers_Client/behaves_like_a_client_with_account_verifications_methods/_list_account_verifications/returns_an_array_of_AccountVerification_instances.yml @@ -0,0 +1,76 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.fintoc.com/v2/account_verifications + body: + encoding: ASCII-8BIT + string: '' + headers: + Authorization: + - Bearer sk_test_SeCreT-aPi_KeY + User-Agent: + - fintoc-ruby/0.2.0 + Connection: + - close + Host: + - api.fintoc.com + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 04 Sep 2025 16:06:52 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '605' + Connection: + - close + Cf-Ray: + - 979ebc8caefbebc6-CPH + X-Frame-Options: + - SAMEORIGIN + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + X-Download-Options: + - noopen + X-Permitted-Cross-Domain-Policies: + - none + Referrer-Policy: + - strict-origin-when-cross-origin + Link: + - '' + Etag: + - W/"9b52bfc2b4c200446ac3f7bc672c6bd4" + Cache-Control: + - max-age=0, private, must-revalidate + X-Request-Id: + - f9aaa487-0ccb-4318-b3dc-73c094c8d744 + X-Runtime: + - '0.746597' + Vary: + - Origin + Via: + - 1.1 google + Cf-Cache-Status: + - DYNAMIC + Report-To: + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=fFpcOJGutfgafODqY5V0pWn72LC8syGZaQSv4HIBjaVHNSFo2SDTLflPrYtNj3%2FKAySKD0yoe5%2F7i50KRkLwZtY%2FPAOLGZEdMp%2Bq2VB9QaNE9xsf7H1vPHGdjYz5RmfQ"}],"group":"cf-nel","max_age":604800}' + Nel: + - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' + Strict-Transport-Security: + - max-age=15552000; includeSubDomains; preload + Server: + - cloudflare + Server-Timing: + - cfL4;desc="?proto=TCP&rtt=260621&min_rtt=247216&rtt_var=119517&sent=7&recv=8&lost=0&retrans=0&sent_bytes=3878&recv_bytes=1804&delivery_rate=12018&cwnd=33&unsent_bytes=0&cid=d4549baa8c4f945c&ts=1552&x=0" + body: + encoding: UTF-8 + string: '[{"object":"account_verification","id":"accv_32F2NLQOOwbeOvfuw8Y1zZCfGdw","status":"succeeded","reason":null,"transfer_id":"tr_32F2NNCg5s9JQy5AX5A6toWX9rd","counterparty":{"holder_id":"PPPR510220DB1","holder_name":"Adrianne + Murray","account_number":"735969000000203226","account_type":"clabe","institution":{"id":"90735","name":"FINTOC","country":"mx"}},"mode":"test","receipt_url":"https://www.banxico.org.mx/cep-beta/go?i=90735\u0026s=dummy\u0026d=ce2zbPihXLg1MobUPCRrTrw9bB97KEYDGHg6rSGK7PaklMO9uV2ancSh1z2p8bIQCcwNCndMOBQx6ISkSOLTcLQ44r6s3qO7aVSNcWSiOp4%3D","transaction_date":"2025-09-04T16:05:58Z"}]' + recorded_at: Thu, 04 Sep 2025 16:06:52 GMT +recorded_with: VCR 6.3.1