Exemplo n.º 1
0
        /// Perform a $1 authorization... the amount is randomized because some gateways will reject identical, subsequent amounts
        /// within a short period of time.
        private void VerifyCardWithAuth(ModelStateDictionary modelState, IGateway gateway, int peopleId)
        {
            if (Type != PaymentType.CreditCard)
            {
                return;
            }

            if (CreditCard.StartsWith("X"))
            {
                return;
            }

            var random    = new Random();
            var dollarAmt = (decimal)random.Next(100, 199) / 100;

            var transactionResponse = gateway.AuthCreditCard(peopleId, dollarAmt, CreditCard,
                                                             DbUtil.NormalizeExpires(Expires).ToString2("MMyy"), "One Time Auth", 0, CVV, string.Empty,
                                                             First, Last, Address, Address2, City, State, Country, Zip, Phone);

            if (!transactionResponse.Approved)
            {
                modelState.AddModelError("form", transactionResponse.Message);
            }

            // if we got this far that means the auth worked so now let's do a void for that auth.
            var voidResponse = gateway.VoidCreditCardTransaction(transactionResponse.TransactionId);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Perform a $1 authorization... the amount is randomized because some gateways will reject identical, subsequent amounts
        /// within a short period of time.
        /// </summary>
        private bool VerifyCardWithAuth(IGateway gateway, PaymentForm pf, int peopleId)
        {
            if (pf.Type != PaymentType.CreditCard)
            {
                return(true);
            }

            if (pf.CreditCard.StartsWith("X"))
            {
                return(true);
            }

            var random    = new Random();
            var dollarAmt = (decimal)random.Next(100, 199) / 100;

            var transactionResponse = gateway.AuthCreditCard(peopleId, dollarAmt, pf.CreditCard,
                                                             DbUtil.NormalizeExpires(pf.Expires).ToString2("MMyy"), "One Time Auth", 0, pf.CVV, string.Empty,
                                                             pf.First, pf.Last, pf.Address, pf.Address2, pf.City, pf.State, pf.Country, pf.Zip, pf.Phone);

            if (!transactionResponse.Approved)
            {
                ModelState.AddModelError("form", transactionResponse.Message);
                return(false);
            }

            // if we got this far that means the auth worked so now let's do a void for that auth.
            var voidResponse = gateway.VoidCreditCardTransaction(transactionResponse.TransactionId);

            return(true);
        }
Exemplo n.º 3
0
        /// Perform a $1 authorization... the amount is randomized because some gateways will reject identical, subsequent amounts
        /// within a short period of time.
        private void VerifyCardWithAuth(ModelStateDictionary modelState, IGateway gateway, int peopleId)
        {
            if (Type != PaymentType.CreditCard)
                return;

            if (CreditCard.StartsWith("X"))
                return;

            var random = new Random();
            var dollarAmt = (decimal) random.Next(100, 199)/100;

            var transactionResponse = gateway.AuthCreditCard(peopleId, dollarAmt, CreditCard,
                DbUtil.NormalizeExpires(Expires).ToString2("MMyy"), "One Time Auth", 0, CVV, string.Empty,
                First, Last, Address, Address2, City, State, Country, Zip, Phone);

            if (!transactionResponse.Approved)
                modelState.AddModelError("form", transactionResponse.Message);

            // if we got this far that means the auth worked so now let's do a void for that auth.
            var voidResponse = gateway.VoidCreditCardTransaction(transactionResponse.TransactionId);
        }