/// <summary> /// Returns boolean indicating whether payment has been accepted by zarinpal /// </summary> /// <param name="authority">36digit long code</param> /// <param name="status">status code</param> /// <returns>true - accepted; false - not accepted.</returns> public bool VerifyPayment(string authority, string status) { try { var query = from or in _orderRepository.Table where or.AuthorizationTransactionCode == authority select or; _logger.InsertLog(LogLevel.Debug, "in verify1 :" + query.Count()); ZarinPalService.PaymentGatewayImplementationService zps = new ZarinPalService.PaymentGatewayImplementationService(); _logger.InsertLog(LogLevel.Debug, "in verify2 : merch code: " + _zarinPalPaymentSettings.MerchantCode + " %% authority code: " + authority + " %% order total: " + query.FirstOrDefault().OrderTotal); if (zps.PaymentVerification(_zarinPalPaymentSettings.MerchantCode, authority, Convert.ToInt32(query.FirstOrDefault().OrderTotal / 10), out long RefID).Equals(100)) { _logger.InsertLog(LogLevel.Debug, "in verify3"); query.FirstOrDefault().AuthorizationTransactionResult = RefID.ToString(); _logger.InsertLog(LogLevel.Debug, "in verify4"); _orderRepository.Update(query.FirstOrDefault()); _logger.InsertLog(LogLevel.Debug, "in verify5"); return(true); } else { _logger.InsertLog(LogLevel.Debug, "in verify: verification failed"); return(false); } } catch (Exception ex) { _logger.InsertLog(LogLevel.Debug, "in verify: " + ex.Message); return(false); } }