public async Task <ActionResult <BillingInfo> > PostBillingInfo(BillingInfo billingInfo)
        {
            await _makePayment.PayAsync(billingInfo.CardNo, billingInfo.ExpMonth, billingInfo.ExpYear, billingInfo.Cvv, billingInfo.TotalPrice * 100);

            if (MakePayment.paymentStatus)
            {
                _context.BillingInfoTable.Add(billingInfo);
                await _context.SaveChangesAsync();

                await _mailService.SendEmailAsync
                (
                    billingInfo.Email,
                    "Payment Confirmation for Bill No:" + billingInfo.BillingId,
                    "<p><strong>Thank you for using Govimithuro!</strong></p>" +
                    " <p>This email is to confirm your recent transaction.</p>" +
                    "<p> Card Holder's Name:" + billingInfo.CardName +
                    "<p>Card No :" + billingInfo.CardNo +
                    "<p> <strong>Total: Rs." + billingInfo.TotalPrice +
                    "<p>Date :" + DateTime.Now
                );
            }
            var newUser = CreatedAtAction("GetBillingInfo", new { id = billingInfo.BillingId }, billingInfo);

            if (newUser != null)
            {
                return(Ok("Success"));
            }
            else
            {
                return(Ok("Error"));
            }
        }
        public async Task <ActionResult <Payments> > PostPayment(Payments payment)
        {
            await _makePayment.PayAsync(payment.CardNo, payment.ExpMonth, payment.ExpYear, payment.Cvv, payment.TotalPrice * 100);

            if (MakePayment.paymentStatus)
            {
                _context.Payments.Add(payment);
                await _context.SaveChangesAsync();

                /*await _mailService.SendEmailAsync
                 * (
                 *  payment.Email,
                 *  "Payment Confirmation for Bill No:" + payment.Id,
                 *  "<p><strong>Thank you for using Govimithuro!</strong></p>" +
                 *  " <p>This email is to confirm your recent transaction.</p>" +
                 *  "<p> Card Holder's Name:" + payment.CardName +
                 *  "<p>Card No :" + payment.CardNo +
                 *  "<p> <strong>Total: Rs." + payment.TotalPrice +
                 *  "<p>Date :" + DateTime.Now
                 * );*/
            }
            var newUser = CreatedAtAction("GetBillingInfo", new { id = payment.Id }, payment);

            if (newUser != null)
            {
                return(Ok("Success"));
            }
            else
            {
                return(Ok("Error"));
            }
        }
 public async Task <IActionResult> Pay(PaymentModel pm)
 {
     if (await MakePayment.PayAsync(pm.CardNumber, pm.Month, pm.Year, pm.Cvc, pm.Value))
     {
         return(Ok());
     }
     return(BadRequest("Charge Failed"));
 }
Esempio n. 4
0
        public async Task <IActionResult> Pay([FromBody] PaymentModel pm)
        {
            var response = await MakePayment.PayAsync(pm.CardNumber, pm.Month, pm.Year, pm.Cvc, pm.Value);

            return(Ok(response));
        }
 public async Task <dynamic> Pay(Models.PaymentModel pm)
 {
     return(await MakePayment.PayAsync(pm.cardnumber, pm.month, pm.year, pm.cvc, pm.value));
 }
Esempio n. 6
0
 public async Task <dynamic> Pay(Models.Payment p)
 {
     return(await MakePayment.PayAsync(p.CardNumber, p.Month, p.Year, p.Cvc, p.Value));
 }
Esempio n. 7
0
 public async Task <dynamic> Pay(Models.PaymentModel pm)
 {
     return(await MakePayment.PayAsync(pm.value, pm.currency, pm.stripeId));
 }