diff --git a/unit/e2e_tests/ruby/spec/models/api_token_spec.rb b/unit/e2e_tests/ruby/spec/models/api_token_spec.rb new file mode 100644 index 0000000..d29780f --- /dev/null +++ b/unit/e2e_tests/ruby/spec/models/api_token_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::ApiToken +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +RSpec.describe 'ApiToken' do + before do + configure_tests + end + + describe 'test an instance of Org ApiToken' do + let(:api_instance) { OpenapiClient::CreateOrgApiTokenApi.new(OpenapiClient::ApiClient.new(configuration)) } + it 'should create an instance of ApiToken' do + request = {data: OpenapiClient::CreateApiToken.new( type: "apiToken", attributes: OpenapiClient::CreateApiTokenAttributes.new( + {description: "test token", scope: "customers applications", + expiration: "2023-11-21T13:47:17.000Z", source_ip: "192.11.1.1"})).to_hash} + response = api_instance.execute("4148", request) + expect(response.data.type).to eq('apiToken') + end + end + + describe 'list api tokens' do + let(:list_instance) { OpenapiClient::GetListOrgAPITokensApi.new(OpenapiClient::ApiClient.new(configuration)) } + + it 'lists api tokens' do + opts = { query_params: {"page[limit]": 10, "page[offset]": 0, "userId": "4148"}} + response = list_instance.execute(opts) + expect(response.data[0].type).to eq('apiToken') + end + end + + describe 'test an instance of customer token' do + let(:customer_instance) {OpenapiClient::CreateCustomerTokenApi.new(OpenapiClient::ApiClient.new(configuration)) } + let(:verification_instance) {OpenapiClient::CreateCustomerTokenVerificationApi.new(OpenapiClient::ApiClient.new(configuration))} + let(:verification_request) do {data: OpenapiClient::CreateCustomerTokenVerification.new(type: "customerTokenVerification", attributes: OpenapiClient::CreateCustomerTokenVerificationAttributes.new(channel: "sms")).to_hash} end + let(:verification_token) {verification_instance.execute("768867", verification_request)} + it 'should create an instance of ApiToken' do + request = {data: OpenapiClient::CreateCustomerToken.new( type: "customerToken", attributes: OpenapiClient::CreateCustomerTokenAttributes.new( + {verification_token: verification_token, scope: "customers applications"})).to_hash} + response = customer_instance.execute("768867", request) + expect(response.data.type).to eq('customerToken') + end + end +end diff --git a/unit/e2e_tests/ruby/spec/models/application_form_spec.rb b/unit/e2e_tests/ruby/spec/models/application_form_spec.rb new file mode 100644 index 0000000..a9df00e --- /dev/null +++ b/unit/e2e_tests/ruby/spec/models/application_form_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::ApplicationForm +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +RSpec.describe 'ApplicationForm' do + before do + configure_tests + end + + describe 'test an instance of ApplicationForm' do + let(:api_instance) { OpenapiClient::GetApplicationFormApi.new(OpenapiClient::ApiClient.new(configuration)) } + + it 'should get an instance of ApplicationForm' do + response = api_instance.execute('803451') + expect(response.data.type).to eq('applicationForm') + end + end + + describe 'list application forms' do + let(:api_instance) { OpenapiClient::GetListApplicationFormsApi.new(OpenapiClient::ApiClient.new(configuration)) } + + it 'should list an instance of ApplicationForm' do + opts = { query_params: {"page[limit]": 10, "page[offset]": 0, "filter[email]": 'jone.doe1@unit-finance.com'}} + response = api_instance.execute(opts) + expect(response.data[0].type).to eq('applicationForm') + end + end +end diff --git a/unit/e2e_tests/ruby/spec/models/application_spec.rb b/unit/e2e_tests/ruby/spec/models/application_spec.rb index 1e5a678..a6b8087 100644 --- a/unit/e2e_tests/ruby/spec/models/application_spec.rb +++ b/unit/e2e_tests/ruby/spec/models/application_spec.rb @@ -25,6 +25,19 @@ expect(response.data.type).to eq('individualApplication') end + it 'should list applications' do + api_instance = OpenapiClient::GetListApplicationsApi.new(client) + opts = { query_params: { 'filter[customer_id]': '836683' } } + response = api_instance.execute(opts) + expect(response.data[0].type).to eq('individualApplication') + end + + it 'should get an individual application' do + api_instance = OpenapiClient::GetApplicationApi.new(client) + response = api_instance.execute("824008") + expect(response.data.type).to eq("individualApplication") + end + it 'should upload a document for the application' do api_instance = OpenapiClient::UploadAPDFDocumentForAnApplicationApi.new(client) request = api_instance.execute('836683', '125214', get_document_contents) @@ -44,4 +57,4 @@ expect(request.data.type).to eq('document') end end -end +end \ No newline at end of file diff --git a/unit/e2e_tests/ruby/spec/models/atm_location_spec.rb b/unit/e2e_tests/ruby/spec/models/atm_location_spec.rb new file mode 100644 index 0000000..0399dfa --- /dev/null +++ b/unit/e2e_tests/ruby/spec/models/atm_location_spec.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +require 'openapi_client' +require_relative '../spec_helper' +require 'json' +require 'date' + +RSpec.describe 'ATMLocation' do + before do + # run before each test + configure_tests + end + + describe 'get ATM locations' do + let(:api_instance) { OpenapiClient::GetATMLocationsListApi.new(OpenapiClient::ApiClient.new(configuration)) } + + + it 'should get ATM locations by coordinates' do + opts = { + query_params: { + 'filter[postalCode]': "02139", + 'filter[searchRadius]': 30 + } } + response = api_instance.execute(opts) + expect(response.data.type).to eq('atmLocation') + end + + it 'should get ATM locations by coordinates' do + search_radius = 30 + + coordinates = OpenapiClient::Coordinates.new({ latitude: 40.730610, longitude: -71.935242 }) + + coordinates_json = coordinates.to_hash.to_json + + opts = { + query_params: { + 'filter[coordinates]': coordinates_json, + 'filter[searchRadius]': search_radius + } + } + + response = api_instance.execute(opts) + response[:data].each do |atm_location| + expect(atm_location[:type]).to eq('atmLocation') + end + end + end +end \ No newline at end of file diff --git a/unit/e2e_tests/ruby/spec/models/card_spec.rb b/unit/e2e_tests/ruby/spec/models/card_spec.rb index 1cb009f..b60592e 100644 --- a/unit/e2e_tests/ruby/spec/models/card_spec.rb +++ b/unit/e2e_tests/ruby/spec/models/card_spec.rb @@ -17,8 +17,8 @@ { shipping_address: ADDRESS, tags: { "purpose": 'checking' }, additional_embossed_text: 'additional_text', expiry_date: '03/27' } ), - relationships: OpenapiClient::CardRelationships.new(account: { "data": { "type": 'depositAccount', - "id": '2002413' } })).to_hash } + relationships: OpenapiClient::Relationships.new(account: { "data": { "type": 'depositAccount', + "id": '2002413' } })).to_hash } response = api_instance.execute(request) expect(response.data.type).to eq('individualDebitCard') end @@ -31,10 +31,10 @@ tags: { "purpose": 'business' }, limits: LIMITS, idempotency_key: '1234567890', print_only_business_name: false, expiry_date: '03/27' } ), - relationships: OpenapiClient::CardRelationships.new(account: { "data": { "type": 'account', - "id": '1567861' } })).to_hash } + relationships: OpenapiClient::Relationships.new(account: { "data": { "type": 'account', + "id": '1567861' } })).to_hash } response = api_instance.execute(request) expect(response.data.type).to eq('businessDebitCard') end end -end +end \ No newline at end of file diff --git a/unit/e2e_tests/ruby/spec/models/check_deposit_spec.rb b/unit/e2e_tests/ruby/spec/models/check_deposit_spec.rb new file mode 100644 index 0000000..79d76c2 --- /dev/null +++ b/unit/e2e_tests/ruby/spec/models/check_deposit_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::CheckDeposit +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +RSpec.describe 'CheckDeposit' do + before do + configure_tests + end + + describe 'test an instance of CheckDeposit' do + let(:api_instance) { OpenapiClient::CreateCheckDepositApi.new(OpenapiClient::ApiClient.new(configuration)) } + + it 'should create a checkDeposit' do + request = { data: OpenapiClient::CreateCheckDeposit.new(type: 'checkDeposit', + attributes: + OpenapiClient::CreateCheckDepositAttributes.new( + { amount: 100, + description: 'test', + tags: { "purpose": 'tax' }, + idempotency_key: '1234567890' }), + relationships: OpenapiClient::CreateCheckDepositRelationships.new( + account: { "data": { "type": 'account', "id": '2110693' } })).to_hash } + response = api_instance.execute(request) + expect(response.data.type).to eq('checkDeposit') + end + end + + describe 'list checkDeposits' do + let(:api_instance) { OpenapiClient::GetCheckDepositApi.new(OpenapiClient::ApiClient.new(configuration)) } + + it 'should get a checkDeposit' do + response = api_instance.execute('16558') + expect(response.data.type).to eq('checkDeposit') + end + + it 'should list checkDeposits' do + opts = { query_params: {"page[limit]": 10, "page[offset]": 0, "filter[status]": 'pending'}} + response = api_instance.execute(opts) + expect(response.data[0].type).to eq('checkDeposit') + end + end + + describe 'update checkDeposit' do + let(:instance) { OpenapiClient::UpdateCheckDepositApi.new(OpenapiClient::ApiClient.new(configuration)) } + + it 'should update a checkDeposit' do + request = { data: OpenapiClient::PatchCheckDeposit.new(attributes: + OpenapiClient::PatchCheckDepositAttributes.new( + tags: { "status": "Awaiting Customer Confirmation", + "id": "23033b64-38f8-4dbc-91a1-313ff0156d02" })).to_hash } + response = instance.execute('16558', request) + expect(response.data.type).to eq('checkDeposit') + end + end +end diff --git a/unit/e2e_tests/ruby/spec/models/counterparty_spec.rb b/unit/e2e_tests/ruby/spec/models/counterparty_spec.rb new file mode 100644 index 0000000..3f83eb6 --- /dev/null +++ b/unit/e2e_tests/ruby/spec/models/counterparty_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::Counterparty +RSpec.describe 'Counterparty' do + before do + configure_tests + end + + describe 'test an instance of Counterparty' do + let(:api_instance) { OpenapiClient::CreateCounterpartyApi.new(OpenapiClient::ApiClient.new(configuration)) } + + it 'should create an instance of Counterparty' do + request = { data: OpenapiClient::CreatePlaidCounterparty.new(type: 'achCounterparty', + attributes: + OpenapiClient::CreatePlaidCounterpartyAttributes.new( + {type: "Business", + name: 'test', + tags: { "purpose": 'tax' }, + idempotency_key: '1234567890', + plaid_processor_token: 'processor-sandbox-7179b936-476c-4b3c-a2f8-8255d8cd5b5b'}), + relationships: OpenapiClient::CreateCounterpartyRelationships.new( + customer: { "data": { "type": 'customer', + "id": '823139' } } + ).to_hash).to_hash } + response = api_instance.execute(request) + expect(response.data.type).to eq('achCounterparty') + end + end +end \ No newline at end of file diff --git a/unit/e2e_tests/ruby/spec/models/customer_spec.rb b/unit/e2e_tests/ruby/spec/models/customer_spec.rb index 7a5d3bf..9b86089 100644 --- a/unit/e2e_tests/ruby/spec/models/customer_spec.rb +++ b/unit/e2e_tests/ruby/spec/models/customer_spec.rb @@ -41,6 +41,5 @@ expect(response.data[0].type).to eq('individualCustomer') end - end -end +end \ No newline at end of file diff --git a/unit/e2e_tests/ruby/spec/models/event_spec.rb b/unit/e2e_tests/ruby/spec/models/event_spec.rb new file mode 100644 index 0000000..50dd6a6 --- /dev/null +++ b/unit/e2e_tests/ruby/spec/models/event_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +# Unit tests for OpenapiClient::Event +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +RSpec.describe 'Event' do + before do + configure_tests + end + + describe 'test an instance of Event' do + + let(:api_instance) { OpenapiClient::GetEventApi.new(OpenapiClient::ApiClient.new(configuration)) } + + it 'should create an instance of Event' do + response = api_instance.execute('15543784') + expect(response.data.type).to eq("transaction.created") + end + end +end \ No newline at end of file diff --git a/unit/e2e_tests/ruby/spec/models/fee_spec.rb b/unit/e2e_tests/ruby/spec/models/fee_spec.rb new file mode 100644 index 0000000..52d5763 --- /dev/null +++ b/unit/e2e_tests/ruby/spec/models/fee_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +# Unit tests for OpenapiClient::Fee +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +RSpec.describe 'Fee' do + before do + configure_tests + end + + describe 'test an instance of Fee' do + let(:api_instance) { OpenapiClient::CreateFeeApi.new(OpenapiClient::ApiClient.new(configuration)) } + it 'should create an instance of Fee' do + request = { data: OpenapiClient::CreateFee.new(type: 'fee', attributes: OpenapiClient::CreateFeeAttributes.new( + { amount: 100, description: 'test', tags: { "purpose": 'tax' }, idempotency_key: "13848484884" } ), + relationships: OpenapiClient::FeeRelationships.new( + account: { "data": { "type": 'account', "id": '36099' } } + )).to_hash } + response = api_instance.execute(request) + expect(response.data.type).to eq('fee') + end + end +end \ No newline at end of file diff --git a/unit/e2e_tests/ruby/spec/models/payment_spec.rb b/unit/e2e_tests/ruby/spec/models/payment_spec.rb index 0a41729..935ed3f 100644 --- a/unit/e2e_tests/ruby/spec/models/payment_spec.rb +++ b/unit/e2e_tests/ruby/spec/models/payment_spec.rb @@ -16,7 +16,7 @@ it 'should create an instance of BookPayment' do request = { data: OpenapiClient::CreateBookPayment.new(type: 'bookPayment', attributes: OpenapiClient::CreateBookPaymentAttributes.new(amount: 1000, description: 'test payment', tags: { "test": 'test-tag' }), - relationships: OpenapiClient::CreateBookPaymentRelationships.new(account: { "data": { "type": 'depositAccount', "id": '27573' } }, counterparty_account: { "data": { "type": 'depositAccount', "id": '36981' } }).to_hash).to_hash } + relationships: OpenapiClient::CreateBookPaymentRelationships.new(account: { "data": { "type": 'depositAccount', "id": '27573' } }, counterparty_account: { "data": { "type": 'depositAccount', "id": '36981' } })).to_hash } response = api_instance.execute(request) expect(response.data.type).to eq('bookPayment') end @@ -24,7 +24,7 @@ it 'should create an instance of AchPayment' do request = { data: OpenapiClient::CreateAchPayment.new(type: 'achPayment', attributes: OpenapiClient::CreateAchPaymentAttributes.new(amount: 1000, direction: 'Credit', counterparty: OpenapiClient::Counterparty.new(name: 'Jane Doe', routing_number: '812345678', account_number: '27573', account_type: 'Checking'), description: 'test payment'), - relationships: OpenapiClient::CreateAchPaymentRelationships.new(account: { "data": { "type": 'account', "id": '27573' } }).to_hash).to_hash } + relationships: OpenapiClient::CreateAchPaymentRelationships.new(account: { "data": { "type": 'account', "id": '27573' } })).to_hash } response = api_instance.execute(request) expect(response.data.type).to eq('achPayment') end @@ -32,9 +32,10 @@ it 'should create an instance of AchPayment with plaid token' do request = { data: OpenapiClient::CreateAchPaymentPlaid.new(type: 'achPayment', attributes: OpenapiClient::CreateAchPaymentPlaidAttributes.new(amount: 1000, direction: 'Credit', description: 'test payment', plaid_processor_token: 'processor-sandbox-1424a3b1-2b56-4d46-9e11-1fdc70fd3724'), - relationships: OpenapiClient::CreateAchPaymentRelationships.new(account: { "data": { "type": 'depositAccount', "id": '27573' } }).to_hash).to_hash } + relationships: OpenapiClient::CreateAchPaymentRelationships.new(account: { "data": { "type": 'depositAccount', "id": '27573' } })).to_hash } response = api_instance.execute(request) + expect(response.data.type).to eq('achPayment') end end -end +end \ No newline at end of file diff --git a/unit/e2e_tests/ruby/spec/models/recurring_payment_spec.rb b/unit/e2e_tests/ruby/spec/models/recurring_payment_spec.rb new file mode 100644 index 0000000..7e85ba7 --- /dev/null +++ b/unit/e2e_tests/ruby/spec/models/recurring_payment_spec.rb @@ -0,0 +1,31 @@ +require_relative '../spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::RecurringDebitAchPayment +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +RSpec.describe 'RecurringPayment' do + before do + # run before each test + configure_tests + end + + let(:ach_instance) { OpenapiClient::CreateRecurringPaymentApi.new(OpenapiClient::ApiClient.new(configuration)) } + + describe 'test an instance of RecurringDebitAchPayment' do + it 'should create an instance of RecurringDebitAchPayment' do + schedule = OpenapiClient::Schedule.new(interval: 'Monthly', day_of_month: 3 ) + request = {data: OpenapiClient::CreateRecurringDebitAchPayment.new(type: "recurringDebitAchPayment", attributes: + OpenapiClient::CreateRecurringDebitAchPaymentAttributes.new({amount: 1000, description: "test pay", + schedule: schedule}, + ), relationships: OpenapiClient::CreateAchPaymentCounterpartyRelationships.new( + account: {data: {type: "account", id: "27573"}}, counterparty: + {data: {type: "counterparty", id: "679784"}} + ) + ).to_hash } + response = ach_instance.execute(request) + expect(response.data.type).to eq("recurringDebitAchPayment") + end + end +end \ No newline at end of file diff --git a/unit/e2e_tests/ruby/spec/models/repayment_spec.rb b/unit/e2e_tests/ruby/spec/models/repayment_spec.rb new file mode 100644 index 0000000..b990f3f --- /dev/null +++ b/unit/e2e_tests/ruby/spec/models/repayment_spec.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Repayment' do + before do + configure_tests + end + + describe 'test an instance of Repayment' do + let(:api_instance) { OpenapiClient::CreateARepaymentApi.new(OpenapiClient::ApiClient.new(configuration)) } + + it 'should create an instance of book Repayment' do + attributes = OpenapiClient::CreateBookRepaymentAttributes.new(description: "test", amount: 1, transaction_summary_override: "override", tags: { purpose: "test" }, idempotency_key: "3a1a33be-4e12-4603-9ed0-820922389fb8") + relationships = OpenapiClient::CreateBookRepaymentRelationships.new(account: { "data": { "type": 'depositAccount', "id": '27573' } }, + credit_account: { "data": { "type": 'creditAccount', "id": '956423' } }, + counterparty_account: { "data": { "type": 'account', "id": '36981' } }) + request = { data: OpenapiClient::CreateBookRepayment.new(type: 'bookRepayment', attributes: attributes, relationships: relationships).to_hash } + response = api_instance.execute(request) + expect(response.data.type).to eq('bookRepayment') + end + + it 'should create an instance of ach Repayment' do + attributes = OpenapiClient::CreateAchRepaymentAttributes.new(description: "test", amount: 1, addenda: "test", tags: { purpose: "test" }, + same_day: false, idempotency_key: "test") + relationships = OpenapiClient::CreateAchRepaymentRelationships.new(account: { "data": { "type": 'depositAccount', "id": '27573' } }, + credit_account: { "data": { "type": 'creditAccount', "id": '956423' } }, + counterparty: { "data": { "type": 'counterparty', "id": '396872' } }) + request = { data: OpenapiClient::CreateAchRepayment.new(type: 'achRepayment', attributes: attributes, relationships: relationships).to_hash } + response = api_instance.execute(request) + expect(response.data.type).to eq('achRepayment') + end + end +end \ No newline at end of file diff --git a/unit/e2e_tests/ruby/spec/models/statement_spec.rb b/unit/e2e_tests/ruby/spec/models/statement_spec.rb index 66da396..4943f4c 100644 --- a/unit/e2e_tests/ruby/spec/models/statement_spec.rb +++ b/unit/e2e_tests/ruby/spec/models/statement_spec.rb @@ -32,10 +32,10 @@ # Read the content from the IO stream, if it's an IO object content = if response_data.is_a?(Tempfile) || response_data.is_a?(File) - File.read(response_data.path) - else - response_data - end + File.read(response_data.path) + else + response_data + end # Check for common HTML tags in the content expect(content).to match(/]*>/) @@ -74,4 +74,4 @@ end end end -end +end \ No newline at end of file