コード例 #1
0
        public async Task<AuthenticationInsightResponse> RequestAuthInsight(string paymentMethodToken, string merchantAccountId, decimal amount = -1)
        {
            BraintreeService service = new BraintreeService(gateway.Configuration);
            AuthenticationInsightOptionsRequest options = new AuthenticationInsightOptionsRequest{};

            PaymentMethodNonceRequest paymentMethodNonceRequest = new PaymentMethodNonceRequest
            {
                AuthenticationInsight = true,
                MerchantAccountId = merchantAccountId,
                AuthenticationInsightOptions = options,
            };
            if(amount > 0)
                paymentMethodNonceRequest.AuthenticationInsightOptions.Amount = amount;

            Result<PaymentMethodNonce> nonce = await gateway.PaymentMethodNonce.CreateAsync(paymentMethodToken, paymentMethodNonceRequest);
            return nonce.Target.AuthenticationInsight;
        }
コード例 #2
0
        public void AuthenticationInsightOptionsIfAmountNotSpecifiedDefaultsToZero()
        {
            AuthenticationInsightOptionsRequest options = new AuthenticationInsightOptionsRequest();

            PaymentMethodNonceRequest request = new PaymentMethodNonceRequest();

            request.AuthenticationInsight        = true;
            request.MerchantAccountId            = "my_merchant_account_id";
            request.AuthenticationInsightOptions = options;

            Assert.DoesNotThrow(() => {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(request.ToXml());
            });

            Assert.IsTrue(request.ToXml().Contains("<authentication-insight-options>"));
            Assert.IsTrue(request.ToXml().Contains("<amount>0.00</amount>"));
        }
コード例 #3
0
        public void ToXml_Includes_AuthenticationInsightOptionsIfSpecified()
        {
            AuthenticationInsightOptionsRequest options = new AuthenticationInsightOptionsRequest();

            options.Amount = 1234.00M;

            PaymentMethodNonceRequest request = new PaymentMethodNonceRequest();

            request.AuthenticationInsight        = true;
            request.MerchantAccountId            = "my_merchant_account_id";
            request.AuthenticationInsightOptions = options;

            Assert.DoesNotThrow(() => {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(request.ToXml());
            });

            Assert.IsTrue(request.ToXml().Contains("<authentication-insight-options>"));
            Assert.IsTrue(request.ToXml().Contains("<amount>1234.00</amount>"));
        }