Bitcoin hot donations mostly work
This commit is contained in:
@@ -7,7 +7,8 @@ namespace Swarmops.Common.Enums
|
||||
FinancialAccount,
|
||||
Organization,
|
||||
OutboundInvoice,
|
||||
InboundInvoice
|
||||
InboundInvoice,
|
||||
FinancialTransaction
|
||||
}
|
||||
|
||||
public enum ObjectOptionalDataType
|
||||
|
||||
@@ -330,7 +330,7 @@
|
||||
<comment>The {0} is the organization name. {1} is the bitcoin address for donations.</comment>
|
||||
</data>
|
||||
<data name="Donate_FundsReceived" xml:space="preserve">
|
||||
<value>Received {0} {1} ({2} microcoins or "bits"). Thank you!</value>
|
||||
<value>Received {0} {1:N2} ({2:N0} microcoins or "bits"). Thank you!</value>
|
||||
<comment>{0} is native currency, {1} is amount in native currency</comment>
|
||||
</data>
|
||||
<data name="Donate_FundsReceivedNative" xml:space="preserve">
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin
|
||||
FinancialAccountType.Asset, null);
|
||||
|
||||
result.DisplayMessage =
|
||||
"Bitcoin hotwallet account was created. Upload its wallet file in Account Plan.";
|
||||
"Bitcoin HD hotwallet was created along with an account for the hotwallet.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
initializeSocket();
|
||||
|
||||
// TODO: Also poll regularly in case socket fails
|
||||
|
||||
checkTransactionReceived(); // test ajax call
|
||||
|
||||
});
|
||||
|
||||
function initializeSocket() {
|
||||
@@ -26,9 +23,11 @@
|
||||
console.log("socket opened");
|
||||
socket.send('{"op":"addr_sub","addr":"' + addressUsed + '"}');
|
||||
};
|
||||
socket.onclose = function(data) {
|
||||
console.log("socket lost");
|
||||
initializeSocket();
|
||||
socket.onclose = function (data) {
|
||||
if (!completed) {
|
||||
console.log("socket lost");
|
||||
initializeSocket();
|
||||
}
|
||||
};
|
||||
socket.onerror = function(data) { console.log("socket error"); };
|
||||
socket.onmessage = function(data) {
|
||||
@@ -58,7 +57,9 @@
|
||||
function (data) {
|
||||
if (data.Success) {
|
||||
$('#paraStatus').text(data.DisplayMessage);
|
||||
$('#paraIntro').fadeOut().slideUp();
|
||||
$('#divQr').fadeOut().slideUp();
|
||||
completed = true;
|
||||
socket.close();
|
||||
socket = null;
|
||||
}
|
||||
@@ -68,13 +69,14 @@
|
||||
var addressUsed = '<asp:Literal runat="server" ID="LiteralBitcoinAddress" />';
|
||||
var guid = '<asp:Literal runat="server" ID="LiteralGuid" />';
|
||||
var socket = null;
|
||||
var completed = false;
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
|
||||
<h2><asp:Label runat="server" ID="BoxTitle" /></h2>
|
||||
<p><asp:Label runat="server" ID="LabelExplainBitcoinDonation" /></p>
|
||||
<p id="paraIntro"><asp:Label runat="server" ID="LabelExplainBitcoinDonation" /></p>
|
||||
<p style="font-size:200%" id="paraStatus"><asp:Label runat="server" ID="LabelStatus" /></p>
|
||||
<div align="center" id="divQr"><asp:Image ID="ImageBitcoinQr" runat="server"/></div>
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
{
|
||||
this.PageAccessRequired = new Access (this.CurrentOrganization, AccessAspect.Participant);
|
||||
|
||||
// TODO: This page needs a check on whether currentorganization.financialaccounts.assetbitcoinhot is null
|
||||
|
||||
|
||||
this.PageTitle = Resources.Pages.Financial.Donate_PageTitle;
|
||||
this.InfoBoxLiteral = Resources.Pages.Financial.Donate_Info;
|
||||
this.LabelStatus.Text = Resources.Pages.Financial.Donate_StatusInitial;
|
||||
@@ -126,6 +129,9 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
ledgerTx.AddRow(authData.CurrentOrganization.FinancialAccounts.IncomeDonations, -nativeCents, authData.CurrentUser);
|
||||
ledgerTx.AddRow(authData.CurrentOrganization.FinancialAccounts.AssetsBitcoinHot, nativeCents, authData.CurrentUser);
|
||||
ledgerTx.BlockchainHash = txHash;
|
||||
|
||||
successMessage = string.Format (Resources.Pages.Financial.Donate_FundsReceived,
|
||||
authData.CurrentOrganization.Currency.DisplayCode, nativeCents/100.0, satoshisReceived/100.0);
|
||||
}
|
||||
|
||||
return new AjaxCallResult() {DisplayMessage = successMessage, Success = true};
|
||||
|
||||
Reference in New Issue
Block a user