public VerifyResponse Verify(string Authority)
        {
            VerifyResponse verify = new VerifyResponse();

            if (!string.IsNullOrEmpty(Authority))
            {
                _payment = new ZarinpalSandbox.Payment(Convert.ToInt32(_session.GetInt32(Authority)));
                _session.Clear();
                var result = _payment.Verification(Authority);
                if (result.Result.Status == 100)
                {
                    verify.Status    = result.Result.Status;
                    verify.RefId     = result.Result.RefId;
                    verify.Authority = Authority;
                }
            }
            return(verify);
        }
 public IActionResult OnlinePayment(int id)
 {
     if (HttpContext.Request.Query["Status"] != "" &&
         HttpContext.Request.Query["Status"].ToString().ToLower() == "ok" &&
         HttpContext.Request.Query["Authority"] != "")
     {
         string authority = HttpContext.Request.Query["Authority"];
         var    wallet    = _userService.GetWalletByWalletId(id);
         var    payment   = new ZarinpalSandbox.Payment(wallet.Amount);
         var    res       = payment.Verification(authority).Result;
         if (res.Status == 100)
         {
             ViewBag.code      = res.RefId;
             ViewBag.IsSuccess = true;
             wallet.IsPay      = true;
             _userService.UpdateWallet(wallet);
         }
     }
     return(View());
 }
        public async Task <IActionResult> OnlinePayment(string authority, string status, int transactionId = 0)
        {
            if (string.IsNullOrEmpty(status) ||
                string.IsNullOrEmpty(authority))
            {
                return(NotFound());
            }

            if (transactionId is 0)
            {
                return(NotFound());
            }

            var transaction = await _userService.GetTransactionByIdAsync(transactionId);

            if (transaction is null)
            {
                return(NotFound());
            }

            var payment = new ZarinpalSandbox.Payment(transaction.Amount);

            var result = payment.Verification(authority).Result;

            if (!(result.Status is 100))
            {
                await _userService.RemoveFailedTransactionAsync(transaction);

                ViewBag.IsSuccess = false;
                return(View());
            }

            await _userService.VerifyTransactionAsync(transaction);

            ViewBag.RefId     = result.RefId;
            ViewBag.IsSuccess = true;
            return(View());
        }