/// <summary> /// Метод вызывается платежной системой если платеж не удался /// </summary> /// <returns></returns> //[HttpPost] public ActionResult Fail() { RobokassaApi robokassaApi = ApiFactory.GetRobokassaApi(WebSettingsConfig.Instance); RobokassaPaymentResult paymentResult = robokassaApi.ProcessFail(Request.Params); if (paymentResult == null) { LoggerWrapper.RemoteMessage(LoggingType.Error, "PaymentController.Fail. PaymentResult is null. Params={0}", HttpContextHelper.ParamsToString(Request.Params, RobokassaApi.IsValidParamName)); return(GetCancelView()); } var purchasedGoogsQuery = new PurchasedGoodsQuery(); bool isSuccess = purchasedGoogsQuery.FailedPurchased(paymentResult.PaymentId); if (!isSuccess) { LoggerWrapper.RemoteMessage(LoggingType.Error, "PaymentController.Fail. FailedPurchased вернул false. PaymentId={0}, Price={1}, Params={2}", paymentResult.PaymentId, paymentResult.Price, HttpContextHelper.ParamsToString(Request.Params, RobokassaApi.IsValidParamName)); return(GetCancelView()); } LoggerWrapper.RemoteMessage(LoggingType.Info, "PaymentController.Fail. Перед тем как сообщить пользователю об отменене платежа на сумму {0} с идентификатором {1}", MoneyFormatter.ToRubles(paymentResult.Price), paymentResult.PaymentId); return(GetCancelView()); }
public void ProcessFailNull(string paymentId, string price) { var securityParams = new RobokassaSecurityParams(LOGIN, PASSWORD1, PASSWORD2); var robokassaApi = new RobokassaApi(securityParams); NameValueCollection pars = CreateNameValueCollection(paymentId, price, null); RobokassaPaymentResult robokassaPaymentResult = robokassaApi.ProcessFail(pars); Assert.That(robokassaPaymentResult, Is.Null); }