Ejemplo n.º 1
0
        public static PaymentRequestResult CreateRequestResult(
            string response,
            AsanPardakhtGatewayAccount account,
            HttpContext httpContext,
            AsanPardakhtGatewayOptions gatewayOptions,
            MessagesOptions messagesOptions)
        {
            var result = XmlHelper.GetNodeValueFromXml(response, "RequestOperationResult", "http://tempuri.org/");

            var splitedResult = result.Split(',');

            var isSucceed = splitedResult.Length == 2 && splitedResult[0] == "0";

            if (!isSucceed)
            {
                var message = AsanPardakhtResultTranslator.TranslateRequest(splitedResult[0], messagesOptions);

                return(PaymentRequestResult.Failed(message, account.Name));
            }

            return(PaymentRequestResult.SucceedWithPost(
                       account.Name,
                       httpContext,
                       gatewayOptions.PaymentPageUrl,
                       new Dictionary <string, string>
            {
                { "RefId", splitedResult[1] }
            }));
        }
Ejemplo n.º 2
0
        public AsanPardakhtCrypto(IHttpClientFactory httpClientFactory, IOptions <AsanPardakhtGatewayOptions> gatewayOptions)
        {
            _httpClient = httpClientFactory.CreateClient(AsanPardakhtGateway.Name);

            _gatewayOptions = gatewayOptions.Value;
        }