From ad2110ccde9ed7c22ddbe43f89d7949f133885aa Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Sat, 10 Mar 2018 10:18:08 +0100 Subject: [PATCH 1/2] Two critical fixes --- Logic/Financial/OrganizationFinancialAccounts.cs | 2 +- .../BackendServices/ReturnBitcoinEchoUtxoOrder.cs | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Logic/Financial/OrganizationFinancialAccounts.cs b/Logic/Financial/OrganizationFinancialAccounts.cs index 9025cc27..8915ec08 100644 --- a/Logic/Financial/OrganizationFinancialAccounts.cs +++ b/Logic/Financial/OrganizationFinancialAccounts.cs @@ -206,7 +206,7 @@ namespace Swarmops.Logic.Financial public FinancialAccount DebtsOther { - get { return this[OrganizationFinancialAccountType.DebtsSalary]; } + get { return this[OrganizationFinancialAccountType.DebtsOther]; } } public FinancialAccount IncomeCurrencyFluctuations diff --git a/Logic/Support/BackendServices/ReturnBitcoinEchoUtxoOrder.cs b/Logic/Support/BackendServices/ReturnBitcoinEchoUtxoOrder.cs index 7e3c430b..5c976db5 100644 --- a/Logic/Support/BackendServices/ReturnBitcoinEchoUtxoOrder.cs +++ b/Logic/Support/BackendServices/ReturnBitcoinEchoUtxoOrder.cs @@ -75,8 +75,19 @@ namespace Swarmops.Logic.Support.BackendServices string tx2Description = "Bitcoin echo test repayment"; FinancialTransaction ledgerTx2 = FinancialTransaction.Create(this.Organization, DateTime.UtcNow, tx2Description); - ledgerTx2.AddRow(this.Organization.FinancialAccounts.DebtsOther, satoshisToReturn, this.Person); - ledgerTx2.AddRow(this.Organization.FinancialAccounts.AssetsBitcoinHot, -satoshisToReturn, this.Person); + + if (this.Organization.Currency.IsBitcoinCash) + { + ledgerTx2.AddRow(this.Organization.FinancialAccounts.DebtsOther, satoshisToReturn, this.Person); + ledgerTx2.AddRow(this.Organization.FinancialAccounts.AssetsBitcoinHot, -satoshisToReturn, this.Person); + } + else + { + Int64 centsPresentation = + new Money(satoshisToReturn, Currency.BitcoinCash).ToCurrency(this.Organization.Currency).Cents; + ledgerTx2.AddRow(this.Organization.FinancialAccounts.DebtsOther, centsPresentation, this.Person); + ledgerTx2.AddRow(this.Organization.FinancialAccounts.AssetsBitcoinHot, -centsPresentation, this.Person); + } ledgerTx2.BlockchainHash = tx.GetHash().ToString(); } From c70f98bc1a99f3085650451d2dd2761e9d4c85d9 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Sat, 10 Mar 2018 10:23:42 +0100 Subject: [PATCH 2/2] Let's try again --- Logic/Support/BackendServices/ReturnBitcoinEchoUtxoOrder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Logic/Support/BackendServices/ReturnBitcoinEchoUtxoOrder.cs b/Logic/Support/BackendServices/ReturnBitcoinEchoUtxoOrder.cs index 5c976db5..297695f1 100644 --- a/Logic/Support/BackendServices/ReturnBitcoinEchoUtxoOrder.cs +++ b/Logic/Support/BackendServices/ReturnBitcoinEchoUtxoOrder.cs @@ -84,7 +84,7 @@ namespace Swarmops.Logic.Support.BackendServices else { Int64 centsPresentation = - new Money(satoshisToReturn, Currency.BitcoinCash).ToCurrency(this.Organization.Currency).Cents; + new Swarmops.Logic.Financial.Money(satoshisToReturn, Currency.BitcoinCash).ToCurrency(this.Organization.Currency).Cents; ledgerTx2.AddRow(this.Organization.FinancialAccounts.DebtsOther, centsPresentation, this.Person); ledgerTx2.AddRow(this.Organization.FinancialAccounts.AssetsBitcoinHot, -centsPresentation, this.Person); }