public async Task <CreateOrderResModel> CreateOrderAsync(Order order) { var result = new CreateOrderResModel(); if (order.PaymentMethod == PaymentMethod.COD) { result.Status = OrderStatus.Pending; order.Status = OrderStatus.Pending; await _context.Orders.AddAsync(order); await _context.SaveChangesAsync(); } else { order.Status = OrderStatus.WaitingPayment; result.Status = OrderStatus.WaitingPayment; await _context.Orders.AddAsync(order); await _context.SaveChangesAsync(); order.ToTal = 100000; var paymentModel = _mapper.Map <Order, PaymentReqModel>(order); result.PaymentUrl = await _moMoPaymentHelper.CreatePaymentRequestAync(paymentModel); } return(result); }
public async Task <IActionResult> TestPayment(PaymentReqModel model) { var response = await _moMoPaymentHelper.CreatePaymentRequestAync(model); return(Ok(response)); }