示例#1
0
 public async Task <ActionResult <Response> > Confirm([FromBody] RefahConfirmationContext res)
 {
     return(Ok(await _mediator.Send(new ConfirmOrderPaymentCommand
     {
         context = res,
         PaymentStrategy = PaymentProviders.Refah
     })));
 }
示例#2
0
        public async Task <IActionResult> PostConfirm([FromForm] RefahConfirmationContext context)
        {
            var order = _dbContext.Orders
                        .FirstOrDefault(x => x.Id == context.OrderId);

            if (order is null)
            {
                return(BadRequest("این مورد وجود ندارد"));
            }
            var paymentProvider = _orderPaymentProviderFactory.GetProvider(PaymentProviders.Refah);
            var paymentSuccess  = paymentProvider.Confirm(context, order.TotalPriceSofre);

            if (paymentSuccess.Status == ResponseStatus.Success)
            {
                order.PaymentStatus = PaymentStatus.Paid;
                order.PaymentId     = context.ResNum.ToString();
                _dbContext.Orders.Update(order);
                _dbContext.SaveChanges();
            }

            return(View("RedirectToAndroidApp", context));
        }
示例#3
0
 public async Task <ActionResult <OrderPayRequestResponse> > PaymentComplete([FromForm] RefahConfirmationContext res)
 {
     //redirect to client with querystring
     return(RedirectToAction("PaymentConfirm", res));
 }
示例#4
0
 public async Task <ActionResult <OrderPayRequestResponse> > PaymentCompleteAndroid([FromForm] RefahConfirmationContext res)
 {
     //redirect to client with querystring
     return(Redirect($"zanis://confirm?resNum={res.ResNum}&state={res.State}&stateCode={res.StateCode}&refNum={res.ResNum}"));
 }