"""Test Setup.""" from os.path import abspath from os.path import dirname from os.path import join from os.path import pardir from dotenv import load_dotenv import pytest # Load environment variables from a .env file if present dotenv_path = abspath(join(dirname(__file__), pardir, '.env')) load_dotenv(dotenv_path) ACCOUNT_ID = 125 CONTRACT_ID = 12001 STATEMENT_PERIOD_ID = 270 SONY_ADDRESS = '2 Canal Reach, London, N1C 4DB' @pytest.fixture() def account_fixture(): """Account fixture.""" return { 'account_payment_term_id': 1, 'account_payee_id': 24601, 'account_name': 'Jeans Nest', 'account_id': ACCOUNT_ID, } @pytest.fixture() def contract_fixture(): """Contract fixture.""" return { 'contract_id': CONTRACT_ID, 'contract_name': 'Some name', 'contract_type': 'neighbouring_rights', 'oa_contract_id': None, 'term_end': None, 'term_start': None, 'reference_sap_profit_center_id': 1, 'sap_created_at': None, } @pytest.fixture() def ledger_vat_summary_fixture(): """Account statement period VAT info fixture.""" return [ { 'ledger_vat_summary_id': 1, 'statement_period_id': 286, 'abacus_event_id': 1, 'account_id': ACCOUNT_ID, 'contract_id': CONTRACT_ID, 'description': 'test ledger 1', 'vat_category': 'distribution_fee', 'payee_currency_code': 'USD', 'vat_currency_code': 'GBP', 'base_amount_payee_currency': '106506.22', 'vat_rate': '20.00', 'vat_amount_payee_currency': '100.00', 'vat_amount_vat_currency': '100.00', 'wht_rate': None, 'wht_amount_payee_currency': None, 'wht_amount_vat_currency': None, 'net_amount_payee_currency': '106306.22', 'created_by': 'me', 'last_modified_by': 'me', 'last_modified': '2020-10-10 00:00:00', }, { 'ledger_vat_summary_id': 2, 'statement_period_id': 286, 'abacus_event_id': 1, 'account_id': ACCOUNT_ID, 'contract_id': CONTRACT_ID, 'description': 'test ledger 2', 'vat_category': 'gross_revenue', 'payee_currency_code': 'USD', 'vat_currency_code': 'GBP', 'base_amount_payee_currency': '106506.22', 'vat_rate': '20.00', 'vat_amount_payee_currency': '100.00', 'vat_amount_vat_currency': '100.00', 'wht_rate': None, 'wht_amount_payee_currency': None, 'wht_amount_vat_currency': None, 'net_amount_payee_currency': '106306.22', 'created_by': 'me', 'last_modified_by': 'me', 'last_modified': '2020-10-10 00:00:00', }, ] @pytest.fixture() def ledger_vat_summary_wht_fixture(): """Account statement period VAT info fixture with wht.""" return [ { 'ledger_vat_summary_id': 1, 'statement_period_id': 286, 'abacus_event_id': 1, 'account_id': ACCOUNT_ID, 'contract_id': CONTRACT_ID, 'vat_category': 'distribution_fee', 'payee_currency_code': 'USD', 'vat_currency_code': 'GBP', 'base_amount_payee_currency': '106506.22', 'vat_rate': 20.00, 'vat_amount_payee_currency': '100.00', 'vat_amount_vat_currency': '100.00', 'wht_rate': 5, 'wht_amount_payee_currency': 10, 'wht_amount_vat_currency': 13, 'net_amount_payee_currency': '106306.22', 'created_by': 'me', 'last_modified_by': 'me', 'last_modified': '2020-10-10 00:00:00', }, ] @pytest.fixture() def account_statement_period_vat_fixture(): """Account statement period VAT info fixture.""" return { 'statement_period_id': 286, 'account_id': 68794, 'currency_code': 'GBP', 'gross_revenue': '106506.22', 'net_revenue': '101713.44', 'distribution_fee': '-4792.78', 'gross_vat_rate': '0.00', 'distribution_vat_rate': '20.00', 'gross_vat': '0.00', 'distribution_vat': '-958.56', 'adjusted_net_revenue': '100754.89', } @pytest.fixture() def signing_entity_fixture(): """Signing entity fixture.""" return { 'signing_entity_id': 1, 'company_code': '4914', 'legal_name': 'AWAL Digital Limited', 'vat_number': 'GB821018768', 'company_registration_number': '04430703', 'address': SONY_ADDRESS, } @pytest.fixture() def orch_uk_signing_entity_fixture(): """Signing entity fixture for Orchard UK.""" return { 'signing_entity_id': 15, 'company_code': '4912', 'legal_name': 'Essential Music & Marketing Limited', 'vat_number': 'GB821018768', 'company_registration_number': '04841569', 'address': SONY_ADDRESS, } @pytest.fixture() def orch_norway_signing_entity_fixture(): """Signing entity fixture for Orchard Norway.""" return { 'signing_entity_id': 16, 'company_code': '4912', 'legal_name': 'The Orchard AS', 'vat_number': 'NO980910857MVA', 'company_registration_number': None, 'address': 'Grev Wedels plass 9, 0151 Oslo, Norway', } @pytest.fixture() def altafonte_networks_fixture(): """Signing entity fixture.""" return { 'signing_entity_id': 1, 'company_code': '6020', 'legal_name': 'AWAL Digital Limited', 'vat_number': 'GB821018768', 'company_registration_number': '04430703', 'address': SONY_ADDRESS, } @pytest.fixture() def account_payment_term_fixture(): """Account payment term fixture.""" return { 'account_payment_term_id': 1, 'account_id': ACCOUNT_ID, 'currency_code': 'USD', 'payment_minimum': '10', 'signing_entity_id': 1, 'payment_schedule': '30_days_after_month_end', 'payment_entity_id': 1, 'created_by': 'admin', 'created_at': '2020-10-10 00:00:00', 'last_modify_by': 'admin', 'last_modified_at': '2020-10-10 00:00:00', } @pytest.fixture() def account_payment_term_fixture_norway(): """Account payment term fixture.""" return { 'account_payment_term_id': 1, 'account_id': ACCOUNT_ID, 'currency_code': 'USD', 'payment_minimum': '10', 'signing_entity_id': 1, 'payment_schedule': '30_days_after_month_end', 'payment_entity_id': 9, 'created_by': 'admin', 'created_at': '2020-10-10 00:00:00', 'last_modify_by': 'admin', 'last_modified_at': '2020-10-10 00:00:00', } @pytest.fixture() def account_payment_term_fixture_uk(): """Account payment term fixture.""" return { 'account_payment_term_id': 1, 'account_id': ACCOUNT_ID, 'currency_code': 'USD', 'payment_minimum': '10', 'signing_entity_id': 1, 'payment_schedule': '30_days_after_month_end', 'payment_entity_id': 7, 'created_by': 'admin', 'created_at': '2020-10-10 00:00:00', 'last_modify_by': 'admin', 'last_modified_at': '2020-10-10 00:00:00', } @pytest.fixture() def reference_payment_entity_fixture(): """Account payment term fixture.""" return {'country_of_tax_reporting': 'Fake-Country'} @pytest.fixture def statement_attachments_fixture(): """Statement attachments fixture.""" return [ { 'statement_period_id': STATEMENT_PERIOD_ID, 'statement_attachment_status': 'in_progress', 'invoice_number': '1_1_self_billing_invoice', 'statement_attachment_type': 'self_billing_invoice', 'file_location': 's3://invoices/1_1_self_billing_invoice.pdf', 'statement_attachment_id': 1, 'account_id': ACCOUNT_ID, 'contract_id': CONTRACT_ID, 'created_at': '2010-09-08T07:06:05', 'created_by': 'me', }, { 'statement_period_id': STATEMENT_PERIOD_ID, 'statement_attachment_status': 'complete', 'invoice_number': '2_2_distribution_fee_invoice', 'statement_attachment_type': 'distribution_fee_invoice', 'file_location': 's3://invoices/2_2_distribution_fee_invoice.pdf', 'statement_attachment_id': 2, 'account_id': ACCOUNT_ID, 'contract_id': CONTRACT_ID, 'created_at': '2010-09-08T07:06:05', 'created_by': 'me', }, { 'statement_period_id': STATEMENT_PERIOD_ID, 'statement_attachment_status': 'error', 'invoice_number': None, 'statement_attachment_type': 'revenue_detail', 'file_location': 's3://invoices/3_3_revenue_detail.pdf', 'statement_attachment_id': 3, 'account_id': ACCOUNT_ID, 'contract_id': CONTRACT_ID, 'created_at': '2010-09-08T07:06:05', 'created_by': 'me', }, { 'account_id': STATEMENT_PERIOD_ID, 'contract_id': CONTRACT_ID, 'file_location': 's3://summaries/Jeans_Nest_288_Collection_Summary.pdf', 'invoice_number': None, 'statement_attachment_id': 4, 'statement_attachment_status': 'complete', 'statement_attachment_type': 'collection_summary_performer', 'statement_period_id': 288, 'created_at': '2023-03-06T09:48:22', 'created_by': 'me', }, ] @pytest.fixture def statement_period_fixture(): """Statement period fixture.""" return { 'statement_period_status': 'closed', 'statement_period_name': 'July 2022', 'closed_date': '2022-08-26', 'exchange_rates_delivered': True, 'statement_period_id': 283, } @pytest.fixture def statement_period_info_fixture(): """Statement period info fixture.""" return [ { 'statement_period_id': STATEMENT_PERIOD_ID, 'statement_period_name': 'June 2021', 'statement_period_status': 'closed', 'accounting_period_id': 1115, 'accounting_run_id': 1641, 'account_id': ACCOUNT_ID, 'contract_id': CONTRACT_ID, 'currency_code': 'USD', 'opening_balance': '3305.44', 'ledger_amount': '1133.11', 'closing_balance': '4438.55', 'total_gross_revenue_amount': '1416.38', 'total_net_revenue_amount': '1133.10', 'total_adjustment_amount': None, 'distribution_fee': '123.00', 'mechanical_deduction_total': '0.00', 'mechanical_deduction_admin_fee_total': '0.00', 'deposit_amount': '-0.005036657105000000', 'gross_vat_rate': '20.00', 'distribution_vat_rate': '20.00', 'gross_vat': '283.28', 'distribution_vat': '-56.66', 'net_vat': '1359.72', 'exempt_reason': None, }, { 'statement_period_id': STATEMENT_PERIOD_ID, 'statement_period_name': 'June 2021', 'statement_period_status': 'closed', 'accounting_period_id': 1115, 'accounting_run_id': 1640, 'account_id': ACCOUNT_ID, 'contract_id': CONTRACT_ID, 'currency_code': 'USD', 'opening_balance': '3305.44', 'ledger_amount': '1133.11', 'closing_balance': '4438.55', 'total_gross_revenue_amount': '1416.38', 'total_net_revenue_amount': '1133.10', 'total_adjustment_amount': 37.00, 'distribution_fee': '123.00', 'mechanical_deduction_total': '0.00', 'mechanical_deduction_admin_fee_total': '0.00', 'deposit_amount': '-0.005036657105000000', 'gross_vat_rate': '20.00', 'distribution_vat_rate': '20.00', 'gross_vat': '283.28', 'distribution_vat': '-56.66', 'net_vat': '1359.72', 'exempt_reason': None, }, ] @pytest.fixture def tax_details_fixture(): """Tax details fixture.""" return { 'account_payee_id': 1, 'vat_number': 'GB821018768', 'local_tax_id': '821018768', 'business_name': 'Totally Cool Records', 'country_of_tax_residency_code': 'ASM', 'address': { 'country_code': 'BRA', 'address_1': 'Fake Address', 'address_2': ' ', 'city': 'Fake city', 'province': 'Fake State', 'zip': 'Fake Postal Code', }, } @pytest.fixture def bank_details_fixture(): """Bank details fixture.""" return { 'account_payee_id': 1, 'type': 'INDIVIDUAL', 'contact': { 'first_name': 'firstName', 'last_name': 'lastName', 'email': 'test@example.com', }, 'address': { 'country_code': 'US', 'address_1': 'asdf', 'address_2': 'dfgh', 'city': 'odesa', 'province': 'AZ', 'zip': '65000', }, 'payout_method': {}, }