diff --git a/models/staging/xero/schema.yml b/models/staging/xero/schema.yml index 92322bc..b2490f8 100644 --- a/models/staging/xero/schema.yml +++ b/models/staging/xero/schema.yml @@ -194,6 +194,7 @@ models: This includes both our invoices towards customers and invoices provided by our suppliers. You can read more here: https://developer.xero.com/documentation/api/accounting/invoices + columns: - name: id_invoice data_type: character varying @@ -586,3 +587,190 @@ models: - name: dwh_extracted_at_utc data_type: timestamp with time zone description: The timestamp at which the data warehouse last extracted the credit note data. + - name: stg_xero__bank_transactions + description: | + Bank transactions that have happened in any of our bank accounts. + + You can read more here: https://developer.xero.com/documentation/api/accounting/banktransactions + + columns: + - name: id_bank_transaction + data_type: character varying + description: Xero's unique identifier for the transaction. + tests: + - not_null + - unique + + - name: id_prepayment + data_type: character varying + description: | + Xero generated identifier for a Prepayment (unique within + organisations). This will be returned on BankTransactions with a Type + of SPEND-PREPAYMENT or RECEIVE-PREPAYMENT. + + - name: id_overpayment + data_type: character varying + description: Xero generated identifier for an Overpayment (unique within + organisations). This will be returned on BankTransactions with a Type + of SPEND-OVERPAYMENT or RECEIVE-OVERPAYMENT. + + - name: reference + data_type: character varying + description: | + Reference for the transaction. Only supported for SPEND and RECEIVE + transactions. + + - name: transaction_type + data_type: character varying + description: | + What kind of transaction is this record. + + Can be one of: RECEIVE, RECEIVE-OVERPAYMENT, RECEIVE-PREPAYMENT, SPEND, SPEND-OVERPAYMENT, SPEND-PREPAYMENT, RECEIVE-TRANSFER, SPEND-TRANSFER + + You can read more here: https://developer.xero.com/documentation/api/accounting/types#bank-transactions + tests: + - not_null + - accepted_values: + values: + - RECEIVE + - RECEIVE-OVERPAYMENT + - RECEIVE-PREPAYMENT + - SPEND + - SPEND-OVERPAYMENT + - SPEND-PREPAYMENT + - RECEIVE-TRANSFER + - SPEND-TRANSFER + + - name: transaction_status + data_type: character varying + description: | + The status of this transaction. + + Can be one of: AUTHORISED, DELETED. + + You can read more here: https://developer.xero.com/documentation/api/accounting/types#bank-transaction-status-codes + tests: + - not_null + - accepted_values: + values: + - AUTHORISED + - DELETED + + - name: transaction_at_utc + data_type: timestamp with time zone + description: When did the transaction happen. + + - name: date_string + data_type: timestamp with time zone + description: When did the transaction happen, as a string. + + - name: total_amount_local_curr + data_type: numeric + description: | + Total of bank transaction tax inclusive, in the currency the + transaction is denominated in. + tests: + - not_null + + - name: subtotal_local_curr + data_type: numeric + description: | + Total of bank transaction excluding taxes, in the currency the + transaction is denominated in. + + - name: total_tax_local_curr + data_type: numeric + description: | + Total tax on bank transaction, in the currency the transaction is + denominated in. + + - name: transaction_currency_iso_4217 + data_type: character varying + description: The ISO 4217 code for the currency of the transaction. + tests: + - not_null + - length_between: + min_length: 3 + max_length: 3 + + - name: exchange_rate_to_gbp + data_type: numeric + description: | + + ATTENTION! unlike in many other Xero entities, here this field is not + completed by Xero always. Some records will have a rate, some won't. + You probably need to complement these rates with some other source if + you want to + + The implied exchange rate between the transaction currency and GBP. + + This is the XXX to GBP rate. So the number represented in this field + is the units of currency GBP that 1 unit of XXX buys you. + + For example, if the transaction is 135 ZAR, and this rate is 0.0167, + the transaction value in GBP is 2.25 (135ZAR * 0.0167GBP/ZAR = + 2.25GBP). + tests: + - not_negative + + - name: line_amount_tax_inclusiveness + data_type: character varying + description: | + Indicates whether the amounts included in line items are tax + inclusive (Inclusive), tax exclusive (Exclusive) or simply, + there are no taxes on the invoice (NoTax). + tests: + - accepted_values: + values: + - Inclusive + - Exclusive + - NoTax + + - name: full_contact_details + data_type: jsonb + description: | + The contact related to this transaction. + + Might be null since not all transactions have a related contact. + + - name: line_items + data_type: jsonb + description: An array with all the line items and their details. + tests: + - not_null + + - name: bank_account + data_type: jsonb + description: An array with the details of the related bank account. + tests: + - not_null + + - name: is_reconciled + data_type: boolean + description: A flag indicating if the transaction has been reconciled. + tests: + - not_null + + - name: has_attachments + data_type: boolean + description: "" + + - name: url + data_type: character varying + description: "" + + - name: external_link_provider_name + data_type: character varying + description: "" + + - name: updated_at_utc + data_type: timestamp with time zone + description: "" + + - name: updated_date_utc + data_type: date + description: "" + + - name: dwh_extracted_at_utc + data_type: timestamp with time zone + description: ""