public PaymentState Process(Payment payment)
        {
            PaymentGateway paymentGateway = new PaymentGateway(payment);

            _context.payments.Add(payment);

            _context.SaveChanges();

            return(paymentGateway.ProcessPayment());
        }
예제 #2
0
        public static void SeedKeys(
            this PaymentGatewayDBContext ctx,
            string key)
        {
            if (ctx.ApiKeys.Any())
            {
                return;
            }

            ctx.Add(new ApiKey
            {
                ID  = 1,
                Key = key
            });

            ctx.SaveChanges();
        }
예제 #3
0
        public static void SeedPayments(
            this PaymentGatewayDBContext ctx,
            string identifier)
        {
            if (ctx.Payments.Any())
            {
                return;
            }

            ctx.Add(new Payment
            {
                ID = 1,
                PaymentIdentifier = identifier,
                CardHolderName    = "Igor",
                CardNumber        = "12345",
                CVV      = 12345,
                Amount   = 1.0M,
                Currency = "EUR"
            });

            ctx.SaveChanges();
        }