/// <summary> /// Метод вызывается платежной системой после оплаты и после сообщения нам о платеже(см. метод Result <see cref="Result"/>) /// </summary> /// <returns></returns> //[HttpPost] public ActionResult Success() { RobokassaApi robokassaApi = ApiFactory.GetRobokassaApi(WebSettingsConfig.Instance); RobokassaPaymentResult paymentResult = robokassaApi.ProcessSuccess(Request.Params); if (paymentResult == null) { LoggerWrapper.RemoteMessage(LoggingType.Error, "PaymentController.Success. PaymentResult is null. Params={0}", HttpContextHelper.ParamsToString(Request.Params, RobokassaApi.IsValidParamName)); return(GetFailView()); } var purchasedGoogsQuery = new PurchasedGoodsQuery(); PurchasedGoods purchasedGoods = purchasedGoogsQuery.Get(paymentResult.PaymentId); if (purchasedGoods == null) { LoggerWrapper.RemoteMessage(LoggingType.Error, "PaymentController.Success. GetUniqueDownloadId не вернул уникальный идентификатор скачивания. PaymentId={0}, Price={1}, Params={2}", paymentResult.PaymentId, paymentResult.Price, HttpContextHelper.ParamsToString(Request.Params, RobokassaApi.IsValidParamName)); return(GetFailView()); } LoggerWrapper.RemoteMessage(LoggingType.Info, "PaymentController.Success. Перед тем как сообщить пользователю об успешном платеже на сумму {0} с идентификатором {1}", MoneyFormatter.ToRubles(paymentResult.Price), paymentResult.PaymentId); return(GetSuccessView(purchasedGoods)); }
public void ProcessSuccessNull(string password1, string paymentId, string price, string crc) { var securityParams = new RobokassaSecurityParams(LOGIN, password1, PASSWORD2); var robokassaApi = new RobokassaApi(securityParams); NameValueCollection pars = CreateNameValueCollection(paymentId, price, crc); RobokassaPaymentResult robokassaPaymentResult = robokassaApi.ProcessSuccess(pars); Assert.That(robokassaPaymentResult, Is.Null); }
public void ProcessSuccess(string password1, string paymentId, string price, string crc, int expectedPaymentId, decimal expectedPrice) { var securityParams = new RobokassaSecurityParams(LOGIN, password1, PASSWORD2); var robokassaApi = new RobokassaApi(securityParams); NameValueCollection pars = CreateNameValueCollection(paymentId, price, crc); RobokassaPaymentResult robokassaPaymentResult = robokassaApi.ProcessSuccess(pars); Assert.That(robokassaPaymentResult, Is.Not.Null); Assert.That(robokassaPaymentResult.PaymentId, Is.EqualTo(expectedPaymentId)); Assert.That(robokassaPaymentResult.Price, Is.EqualTo(expectedPrice)); }