public static PaymentVerifyResult CreateSettleResult(
            string response,
            AsanPardakhtCallbackResult callbackResult,
            MessagesOptions messagesOptions)
        {
            var result = XmlHelper.GetNodeValueFromXml(response, "RequestReconciliationResult", "http://tempuri.org/");

            var    isSucceed = result == "600";
            string message;

            if (isSucceed)
            {
                message = messagesOptions.PaymentSucceed;
            }
            else
            {
                message = AsanPardakhtResultTranslator.TranslateReconcilation(result, messagesOptions) ??
                          messagesOptions.PaymentFailed;
            }

            var verifyResult = new PaymentVerifyResult
            {
                Status          = isSucceed ? PaymentVerifyResultStatus.Succeed : PaymentVerifyResultStatus.Failed,
                TransactionCode = callbackResult.Rrn,
                Message         = message
            };

            verifyResult.DatabaseAdditionalData.Add("PayGateTranId", callbackResult.PayGateTranId);
            verifyResult.DatabaseAdditionalData.Add("LastFourDigitOfPAN", callbackResult.LastFourDigitOfPAN);

            return(verifyResult);
        }
        public static AsanPardakhtVerifyResult CheckVerifyResult(
            string response,
            AsanPardakhtCallbackResult callbackResult,
            MessagesOptions messagesOptions)
        {
            var result = XmlHelper.GetNodeValueFromXml(response, "RequestVerificationResult", "http://tempuri.org/");

            var isSucceed = result == "500";

            PaymentVerifyResult verifyResult = null;

            if (!isSucceed)
            {
                var message = AsanPardakhtResultTranslator.TranslateVerification(result, messagesOptions);

                verifyResult         = callbackResult.Result;
                verifyResult.Message = message;
            }

            return(new AsanPardakhtVerifyResult
            {
                IsSucceed = isSucceed,
                Result = verifyResult
            });
        }
Exemple #3
0
        public static string CreateSettleData(AsanPardakhtCallbackResult callbackResult, AsanPardakhtGatewayAccount account)
        {
            var requestToEncrypt = account.UserName + "," + account.Password;
            var encryptedRequest = Encrypt(requestToEncrypt, account.Key, account.IV);

            return
                ("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">" +
                 "<soapenv:Header/>" +
                 "<soapenv:Body>" +
                 "<tem:RequestReconciliation>" +
                 $"<tem:merchantConfigurationID>{account.MerchantConfigurationId}</tem:merchantConfigurationID>" +
                 "<!--Optional:-->" +
                 $"<tem:encryptedCredentials>{encryptedRequest}</tem:encryptedCredentials>" +
                 $"<tem:payGateTranID>{callbackResult.PayGateTranId}</tem:payGateTranID>" +
                 "</tem:RequestReconciliation>" +
                 "</soapenv:Body>" +
                 "</soapenv:Envelope>");
        }
Exemple #4
0
        public static async Task <string> CreateSettleData(
            AsanPardakhtCallbackResult callbackResult,
            AsanPardakhtGatewayAccount account,
            IAsanPardakhtCrypto crypto)
        {
            var requestToEncrypt = $"{account.UserName},{account.Password}";
            var encryptedRequest = await crypto.Encrypt(requestToEncrypt, account.Key, account.IV);

            return
                ("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">" +
                 "<soapenv:Header/>" +
                 "<soapenv:Body>" +
                 "<tem:RequestReconciliation>" +
                 $"<tem:merchantConfigurationID>{account.MerchantConfigurationId}</tem:merchantConfigurationID>" +
                 "<!--Optional:-->" +
                 $"<tem:encryptedCredentials>{XmlHelper.EncodeXmlValue(encryptedRequest)}</tem:encryptedCredentials>" +
                 $"<tem:payGateTranID>{callbackResult.PayGateTranId}</tem:payGateTranID>" +
                 "</tem:RequestReconciliation>" +
                 "</soapenv:Body>" +
                 "</soapenv:Envelope>");
        }