Example #1
0
 public RecipientParams RecipientParamsGet(FiatWalletTx tx)
 {
     return(RecipientParams.SingleOrDefault(r => r.FiatWalletTxId == tx.Id));
 }
Example #2
0
        public FiatWalletTx RegisterPendingWithdrawal(string tag, long amount, BankAccount account, RecipientParams recipientParams = null)
        {
            var depositCode = Utils.CreateDepositCode();

            while (db.TxGet(depositCode) != null)
            {
                depositCode = Utils.CreateDepositCode();
            }
            var _tag = db.TagGetOrCreate(tag);
            var date = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
            var tx   = new FiatWalletTx {
                DepositCode = depositCode, Tag = _tag, Date = date, Direction = WalletDirection.Outgoing, Amount = amount,
                BankName    = account.BankName, BankAddress = account.BankAddress, AccountName = account.AccountName, AccountNumber = account.AccountNumber
            };

            db.WalletTxs.Add(tx);
            if (recipientParams != null)
            {
                recipientParams.FiatWalletTx = tx;
                db.RecipientParams.Add(recipientParams);
            }
            return(tx);
        }