diff --git a/models/reporting/xero/schema.yaml b/models/reporting/xero/schema.yaml index bd28d9e..e4bc01d 100644 --- a/models/reporting/xero/schema.yaml +++ b/models/reporting/xero/schema.yaml @@ -477,7 +477,7 @@ models: - name: reference data_type: character varying description: | - The Superhog-set reference for the credit note. + The Superhog-set reference for the credit note. - name: credit_note_number data_type: character varying @@ -504,7 +504,7 @@ models: - name: credit_note_currency_iso_4217 data_type: character varying description: | - + The ISO 4217 code for the currency which this credit note uses as unit of account. @@ -521,7 +521,7 @@ models: - name: total_amount_local_curr data_type: numeric - description: | + description: | The total amount to be credited, in the currency the note is denominated in. @@ -532,8 +532,8 @@ models: - name: subtotal_local_curr data_type: numeric description: | - The total amount to be credited minus taxes, in the currency the - note is denominated in. + The total amount to be credited minus taxes, in the currency the + note is denominated in. - name: subtotal_in_gbp data_type: numeric @@ -629,7 +629,7 @@ models: columns: - name: id_credit_note data_type: character varying - description: Xero's unique identifier for the credit note. + description: Xero's unique identifier for the credit note. - name: id_line_item data_type: text @@ -728,7 +728,7 @@ models: - name: fee_category data_type: text - description: | + description: | A fee category, one of out of booking_fees, listing_fees, verification_fees, waiver fees. @@ -742,7 +742,7 @@ models: - name: net_fees_in_gbp data_type: numeric - description: | + description: | Net fees are calculated by subtracting credited fees from invoiced fees. It might be the case that net fees are negative in some month, if it happens to be that we have given back to customers more than we @@ -767,7 +767,7 @@ models: - name: id_deal data_type: text - description: | + description: | A fee category per deal. - name: fees_invoiced_in_gbp @@ -780,101 +780,188 @@ models: - name: net_fees_in_gbp data_type: numeric - description: | + description: | Net fees are calculated by subtracting credited fees from invoiced fees. It might be the case that net fees are negative in some month, if it happens to be that we have given back to customers more than we have invoiced them. - name: xero__bank_transactions - description: "" + 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: "" - + description: Xero's unique identifier for the transaction. + tests: + - not_null + - unique + - name: id_prepayment data_type: character varying - description: "" + 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: "" + 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: id_contact data_type: text - description: "" + description: | + Xero's unique id for the contact related to this transaction. - name: id_bank_account data_type: text - description: "" + description: | + Xero's unique id for the bank account related to this transaction. - name: reference data_type: character varying - description: "" + description: | + Reference for the transaction. Only supported for SPEND and RECEIVE + transactions. - name: transaction_type data_type: character varying - description: "" + 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: "" + 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: "" + description: When did the transaction happened. - name: transaction_date_utc data_type: date - description: "" + description: The date on which the transaction happenned. - name: date_string data_type: timestamp with time zone - description: "" + description: When did the transaction happened, as a string. - name: total_amount_local_curr data_type: numeric - description: "" + description: | + Total of bank transaction tax inclusive, in the currency the + transaction is denominated in. + tests: + - not_null - name: total_amount_in_gbp data_type: numeric - description: "" + description: | + Total of bank transaction tax inclusive, presented in GBP. + tests: + - not_null - name: total_amount_wo_tax_local_curr data_type: numeric - description: "" + description: | + Total of bank transaction excluding taxes, in the currency the + transaction is denominated in. - name: total_amount_wo_tax_in_gbp data_type: numeric - description: "" + description: | + Total of bank transaction excluding taxes, presented in GBP. - name: total_tax_local_curr data_type: numeric - description: "" + description: | + Total tax on bank transaction, in the currency the transaction is + denominated in. - name: total_tax_in_gbp data_type: numeric - description: "" + description: | + Total tax on bank transaction, presented in GBP. - name: transaction_currency_iso_4217 data_type: character varying - description: "" + 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: "" + description: | + + ATTENTION! unlike in many other Xero entities, here this field is not + completed by Xero always. It has been complemented with the general + rates data used in the DWH. Xero's rates are preferent, so DWH rates + will only be used where Xero didn't provide a rate. + + 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 + - not_null - name: line_amount_tax_inclusiveness data_type: character varying - description: "" - - - name: line_items - data_type: jsonb - description: "" + 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: is_reconciled data_type: boolean - description: "" + description: A flag indicating if the transaction has been reconciled. + tests: + - not_null - name: has_attachments data_type: boolean diff --git a/models/staging/xero/schema.yml b/models/staging/xero/schema.yml index 09704d1..b0d79b5 100644 --- a/models/staging/xero/schema.yml +++ b/models/staging/xero/schema.yml @@ -658,11 +658,11 @@ models: - name: transaction_at_utc data_type: timestamp with time zone - description: When did the transaction happen. + description: When did the transaction happened. - name: date_string data_type: timestamp with time zone - description: When did the transaction happen, as a string. + description: When did the transaction happened, as a string. - name: total_amount_local_curr data_type: numeric @@ -672,7 +672,7 @@ models: tests: - not_null - - name: subtotal_local_curr + - name: total_amount_wo_tax_local_curr data_type: numeric description: | Total of bank transaction excluding taxes, in the currency the @@ -700,7 +700,7 @@ models: 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 + you want to have no nulls. The implied exchange rate between the transaction currency and GBP. @@ -774,6 +774,7 @@ models: - name: dwh_extracted_at_utc data_type: timestamp with time zone description: "" + - name: stg_xero__accounts description: | Accounts in our accounting tree.