From 97660b42171dd365d345005dbba55dd7d5b014b5 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Mon, 4 Jan 2016 11:30:06 +0100 Subject: [PATCH] Committing sprint build --- Logic/Financial/BitcoinUtility.cs | 16 +++++++++++++--- Logic/Financial/Payouts.cs | 9 +++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Logic/Financial/BitcoinUtility.cs b/Logic/Financial/BitcoinUtility.cs index 5e72844f..df848f45 100644 --- a/Logic/Financial/BitcoinUtility.cs +++ b/Logic/Financial/BitcoinUtility.cs @@ -223,17 +223,27 @@ namespace Swarmops.Logic.Financial new WebClient().DownloadString("https://blockchain.info/address/" + address + "?format=json&api_key=" + SystemSettings.BlockchainSwarmopsApiKey)); // warn: will 500 if no unspent outpoints - // TODO: PARSE (awaiting functions for native currency to be added to FinancialTransactionRows) - int transactionCount = (int)(addressData["n_tx"]); foreach (var tx in addressData["txs"]) { string blockchainTransactionId = (string) tx["hash"]; - FinancialTransaction ourTx = FinancialTransaction.FromBlockchainHash (parent.Organization, blockchainTransactionId); + try + { + FinancialTransaction ourTx = FinancialTransaction.FromBlockchainHash(parent.Organization, blockchainTransactionId); + // If the transaction was fetched fine, we have already seen this transaction, and all is fine + } + catch (ArgumentException) + { + // We didn't have this transaction, so we need to create it + // Did we lose or gain money? + + // Find all in- and outpoints, determine which are ours (hot and cold wallet) and which aren't + } } + // TODO: PARSE (awaiting functions for native currency to be added to FinancialTransactionRows) // TODO: CONTINUE HERE } diff --git a/Logic/Financial/Payouts.cs b/Logic/Financial/Payouts.cs index 5bbf5e82..00ca0263 100644 --- a/Logic/Financial/Payouts.cs +++ b/Logic/Financial/Payouts.cs @@ -579,23 +579,20 @@ namespace Swarmops.Logic.Financial } else if (payout.RecipientPerson != null && payout.RecipientPerson.BitcoinPayoutAddress.Length < 3 && payout.Account.Length < 4) { - // There is a payout for this person, but they don't have a bitcoin payout address set. Send notification to this effect twice a day. + // There is a payout for this person, but they don't have a bitcoin payout address set. Send notification to this effect once a day. - // DISABLE THIS FOR TIME BEING - - /* if (utcNow.Minute != 0) { continue; } - if (utcNow.Hour % 12 != 0) + if (utcNow.Hour != 12) { continue; } NotificationStrings primaryStrings = new NotificationStrings(); primaryStrings[NotificationString.OrganizationName] = organization.Name; - OutboundComm.CreateNotification(organization, NotificationResource.BitcoinPayoutAddress_PleaseSet, primaryStrings, People.FromSingle(payout.RecipientPerson));*/ + OutboundComm.CreateNotification(organization, NotificationResource.BitcoinPayoutAddress_PleaseSet, primaryStrings, People.FromSingle(payout.RecipientPerson)); } }