public void GetResponseResultOk(int name) { var robokassaApi = new RobokassaApi(null); string responseResult = robokassaApi.GetResponseResultOk(name); Assert.That(responseResult, Is.EqualTo("OK" + name)); }
public ActionResult Result() { RobokassaApi robokassaApi = ApiFactory.GetRobokassaApi(WebSettingsConfig.Instance); RobokassaPaymentResult paymentResult = robokassaApi.ProcessResult(Request.Params); if (paymentResult == null) { LoggerWrapper.RemoteMessage(LoggingType.Error, "PaymentController.Result. PaymentResult is null. Params={0}", HttpContextHelper.ParamsToString(Request.Params, RobokassaApi.IsValidParamName)); return(Content(ERROR_MESSAGE)); } var purchasedGoogsQuery = new PurchasedGoodsQuery(); bool isSuccess = purchasedGoogsQuery.SuccessfullyPurchased(paymentResult.PaymentId, paymentResult.Price); if (!isSuccess) { LoggerWrapper.RemoteMessage(LoggingType.Error, "PaymentController.Result. SuccessfullyPurchased вернул false. PaymentId={0}, Price={1}, Params={2}", paymentResult.PaymentId, paymentResult.Price, HttpContextHelper.ParamsToString(Request.Params, RobokassaApi.IsValidParamName)); return(Content(ERROR_MESSAGE)); } LoggerWrapper.RemoteMessage(LoggingType.Info, "PaymentController.Result. Прошла оплата на сумму {0} с идентификатором {1}", MoneyFormatter.ToRubles(paymentResult.Price), paymentResult.PaymentId); string response = robokassaApi.GetResponseResultOk(paymentResult.PaymentId); return(Content(response)); }