(cbast): Fix debit sign error.
This commit is contained in:
@@ -179,8 +179,8 @@ class CBASTConverter(Converter[CBASTRecord, CBASTConfig]):
|
|||||||
date=created_on,
|
date=created_on,
|
||||||
source_account=source_account,
|
source_account=source_account,
|
||||||
target_account=target_account,
|
target_account=target_account,
|
||||||
from_source=amount if direction is RecordDirection.OUT else -amount,
|
from_source=-amount,
|
||||||
to_target=amount if direction is RecordDirection.IN else -amount,
|
to_target=amount,
|
||||||
raw=",".join(row),
|
raw=",".join(row),
|
||||||
description=row.description,
|
description=row.description,
|
||||||
direction=direction,
|
direction=direction,
|
||||||
|
|||||||
18
tests/converters/cbast_v0/cbast_transactions.csv
Normal file
18
tests/converters/cbast_v0/cbast_transactions.csv
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
Date,Transaction,Debit,Credit,Balance
|
||||||
|
2018-04-01,2018 OPENING BALANCE,,,107.95
|
||||||
|
2018-04-01,Account Fee,6.00,,101.95
|
||||||
|
2018-04-04,Direct Credit 015895,,399.01,500.96
|
||||||
|
2018-04-13,Direct Debit 066228 ERGON,882.81,,-381.85
|
||||||
|
2018-04-17,Direct Debit 062246 CommInsure,53.82,,442.14
|
||||||
|
2018-04-18,Direct Credit 015895 FAO FAMILIES,,399.01,841.15
|
||||||
|
2018-04-26,Transfer to xx3555 NetBank,800.00,,41.15
|
||||||
|
2018-05-01,Account Fee,6.00,,35.15
|
||||||
|
2018-05-01,Direct Credit 011802 Col First State,,53.62,88.77
|
||||||
|
2018-05-02,Direct Credit 015895 FAO FAMILIES,,399.01,487.78
|
||||||
|
2018-05-03,Transfer to xx3555 NetBank,400.00,,87.78
|
||||||
|
2018-05-16,Direct Credit 015895 FAO FAMILIES,,399.01,486.79
|
||||||
|
2018-05-17,Direct Debit 062246 CommInsure,53.82,,432.97
|
||||||
|
2018-05-21,Transfer to xx3555 NetBank,300.00,,132.97
|
||||||
|
2018-05-30,Direct Credit 015895 FAO FAMILIES,,399.01,531.98
|
||||||
|
2018-06-01,Account Fee,6.00,,525.98
|
||||||
|
2018-06-13,Direct Credit 015895 FAO FAMILIES,,399.01,924.99
|
||||||
|
11
tests/converters/cbast_v0/config.toml
Normal file
11
tests/converters/cbast_v0/config.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[beanify]
|
||||||
|
default-converter = "cbast_v0"
|
||||||
|
rule-interface = "json"
|
||||||
|
theme = "black"
|
||||||
|
|
||||||
|
[rules.json]
|
||||||
|
rulepath = "./rules.json"
|
||||||
|
|
||||||
|
[converters.cbast_v0]
|
||||||
|
asset-account = "Liabilities:CBA:Streamline"
|
||||||
|
asset-currency = "AUD"
|
||||||
80
tests/converters/cbast_v0/expected.ledger
Normal file
80
tests/converters/cbast_v0/expected.ledger
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
2018-04-01 * "Account Fees" ""
|
||||||
|
; Account Fee
|
||||||
|
Liabilities:CBA:Streamline -6.0 AUD
|
||||||
|
Expenses:Fees 6.0 AUD
|
||||||
|
|
||||||
|
2018-04-04 * "Tenants" ""
|
||||||
|
; Direct Credit 015895
|
||||||
|
Income:Tenants -399.01 AUD
|
||||||
|
Liabilities:CBA:Streamline 399.01 AUD
|
||||||
|
|
||||||
|
2018-04-13 * "Ergon Energy" ""
|
||||||
|
; Direct Debit 066228 ERGON
|
||||||
|
Liabilities:CBA:Streamline -882.81 AUD
|
||||||
|
Expenses:Electricity 882.81 AUD
|
||||||
|
|
||||||
|
2018-04-17 * "CommInsure" ""
|
||||||
|
; Direct Debit 062246 CommInsure
|
||||||
|
Liabilities:CBA:Streamline -53.82 AUD
|
||||||
|
Expenses:Insurance 53.82 AUD
|
||||||
|
|
||||||
|
2018-04-18 * "Tenants" ""
|
||||||
|
; Direct Credit 015895 FAO FAMILIES
|
||||||
|
Income:Tenants -399.01 AUD
|
||||||
|
Liabilities:CBA:Streamline 399.01 AUD
|
||||||
|
|
||||||
|
2018-04-26 * "Transfer" ""
|
||||||
|
; Transfer to xx3555 NetBank
|
||||||
|
Liabilities:CBA:Streamline -800.0 AUD
|
||||||
|
Assets:3555 800.0 AUD
|
||||||
|
|
||||||
|
2018-05-01 * "Account Fees" ""
|
||||||
|
; Account Fee
|
||||||
|
Liabilities:CBA:Streamline -6.0 AUD
|
||||||
|
Expenses:Fees 6.0 AUD
|
||||||
|
|
||||||
|
2018-05-01 * "Colonial First State" ""
|
||||||
|
; Direct Credit 011802 Col First State
|
||||||
|
Income:Trading -53.62 AUD
|
||||||
|
Liabilities:CBA:Streamline 53.62 AUD
|
||||||
|
|
||||||
|
2018-05-02 * "Tenants" ""
|
||||||
|
; Direct Credit 015895 FAO FAMILIES
|
||||||
|
Income:Tenants -399.01 AUD
|
||||||
|
Liabilities:CBA:Streamline 399.01 AUD
|
||||||
|
|
||||||
|
2018-05-03 * "Transfer" ""
|
||||||
|
; Transfer to xx3555 NetBank
|
||||||
|
Liabilities:CBA:Streamline -400.0 AUD
|
||||||
|
Assets:3555 400.0 AUD
|
||||||
|
|
||||||
|
2018-05-16 * "Tenants" ""
|
||||||
|
; Direct Credit 015895 FAO FAMILIES
|
||||||
|
Income:Tenants -399.01 AUD
|
||||||
|
Liabilities:CBA:Streamline 399.01 AUD
|
||||||
|
|
||||||
|
2018-05-17 * "CommInsure" ""
|
||||||
|
; Direct Debit 062246 CommInsure
|
||||||
|
Liabilities:CBA:Streamline -53.82 AUD
|
||||||
|
Expenses:Insurance 53.82 AUD
|
||||||
|
|
||||||
|
2018-05-21 * "Transfer" ""
|
||||||
|
; Transfer to xx3555 NetBank
|
||||||
|
Liabilities:CBA:Streamline -300.0 AUD
|
||||||
|
Assets:3555 300.0 AUD
|
||||||
|
|
||||||
|
2018-05-30 * "Tenants" ""
|
||||||
|
; Direct Credit 015895 FAO FAMILIES
|
||||||
|
Income:Tenants -399.01 AUD
|
||||||
|
Liabilities:CBA:Streamline 399.01 AUD
|
||||||
|
|
||||||
|
2018-06-01 * "Account Fees" ""
|
||||||
|
; Account Fee
|
||||||
|
Liabilities:CBA:Streamline -6.0 AUD
|
||||||
|
Expenses:Fees 6.0 AUD
|
||||||
|
|
||||||
|
2018-06-13 * "Tenants" ""
|
||||||
|
; Direct Credit 015895 FAO FAMILIES
|
||||||
|
Income:Tenants -399.01 AUD
|
||||||
|
Liabilities:CBA:Streamline 399.01 AUD
|
||||||
|
|
||||||
72
tests/converters/cbast_v0/rules.json
Normal file
72
tests/converters/cbast_v0/rules.json
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"cbast_v0": {
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"record_fields": {
|
||||||
|
"target_account": "Account Fee"
|
||||||
|
},
|
||||||
|
"transaction_fields": {
|
||||||
|
"flag": "*",
|
||||||
|
"payee": "Account Fees",
|
||||||
|
"target_account": "Expenses:Fees"
|
||||||
|
},
|
||||||
|
"extended": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"record_fields": {
|
||||||
|
"target_account": "Direct Debit 066228 ERGON"
|
||||||
|
},
|
||||||
|
"transaction_fields": {
|
||||||
|
"flag": "*",
|
||||||
|
"payee": "Ergon Energy",
|
||||||
|
"target_account": "Expenses:Electricity"
|
||||||
|
},
|
||||||
|
"extended": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"record_fields": {
|
||||||
|
"target_account": "Direct Debit 062246 CommInsure"
|
||||||
|
},
|
||||||
|
"transaction_fields": {
|
||||||
|
"flag": "*",
|
||||||
|
"payee": "CommInsure",
|
||||||
|
"target_account": "Expenses:Insurance"
|
||||||
|
},
|
||||||
|
"extended": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"record_fields": {
|
||||||
|
"target_account": "Transfer to xx3555 NetBank"
|
||||||
|
},
|
||||||
|
"transaction_fields": {
|
||||||
|
"flag": "*",
|
||||||
|
"payee": "Transfer",
|
||||||
|
"target_account": "Assets:3555"
|
||||||
|
},
|
||||||
|
"extended": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"record_fields": {
|
||||||
|
"source_account": "Direct Credit 015895"
|
||||||
|
},
|
||||||
|
"transaction_fields": {
|
||||||
|
"flag": "*",
|
||||||
|
"payee": "Tenants",
|
||||||
|
"source_account": "Income:Tenants"
|
||||||
|
},
|
||||||
|
"extended": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"record_fields": {
|
||||||
|
"source_account": "Direct Credit 011802 Col First State"
|
||||||
|
},
|
||||||
|
"transaction_fields": {
|
||||||
|
"flag": "*",
|
||||||
|
"payee": "Colonial First State",
|
||||||
|
"source_account": "Income:Trading"
|
||||||
|
},
|
||||||
|
"extended": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
7
tests/converters/cbast_v0/test.sh
Executable file
7
tests/converters/cbast_v0/test.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
COMMAND="beanify --config config.toml cbast_transactions.csv --batch"
|
||||||
|
|
||||||
|
if diff <($COMMAND) expected.ledger; then
|
||||||
|
echo "Files match"
|
||||||
|
else
|
||||||
|
echo "Files do not match"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user