Example #1
0
        public void TestPlaceWithdrawalExtended(WithdrawalPlacementContextExtended context)
        {
            var p = IsType <IWithdrawalPlacementProviderExtended>();

            if (p.Success)
            {
                PlaceWithdrawalExtended(p.Provider, context);
            }
        }
Example #2
0
        // [TestMethod]
        public override void TestPlaceWithdrawalExtended()
        {
            var token2fa = "249723";

            var context = new WithdrawalPlacementContextExtended(UserContext.Current)
            {
                Amount              = new Money(0.001m, Asset.Btc),
                Address             = null,
                AuthenticationToken = token2fa,
                CustomFee           = new Money(0.004m, Asset.Btc),
                Description         = "Debug payment"
            };

            base.TestPlaceWithdrawalExtended(context);
        }
Example #3
0
        public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContextExtended context)
        {
            var api = ApiProvider.GetApi(context);

            var body = new Dictionary <string, object>();

            if (!String.IsNullOrWhiteSpace(context.AuthenticationToken))
            {
                body.Add("otpToken", context.AuthenticationToken);
            }

            body.Add("currency", context.Amount.Asset.ToRemoteCode(this));
            body.Add("amount", context.Amount.ToDecimalValue() / ConversionRate);
            body.Add("address", context.Address.Address + ":" + context.Address.Tag);
            body.Add("fee", context.CustomFee.ToDecimalValue() / ConversionRate);

            var r = await api.RequestWithdrawalAsync(body).ConfigureAwait(false);

            return(new WithdrawalPlacementResult()
            {
                WithdrawalRemoteId = r.transactID
            });
        }
Example #4
0
        private void PlaceWithdrawalExtended(IWithdrawalPlacementProviderExtended provider, WithdrawalPlacementContextExtended context)
        {
            if (context == null)
            {
                return;
            }

            try
            {
                var r = AsyncContext.Run(() => provider.PlaceWithdrawalAsync(context));

                Assert.IsTrue(r != null);

                Trace.WriteLine($"Withdrawal request remote id: {r.WithdrawalRemoteId}");
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }