Пример #1
0
 public static string CreateVerifyData(ParsianGatewayAccount account, ParsianCallbackResult callbackResult)
 {
     return
         ("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:con=\"https://pec.Shaparak.ir/NewIPGServices/Confirm/ConfirmService\">" +
          "<soapenv:Header/>" +
          "<soapenv:Body>" +
          "<con:ConfirmPayment>" +
          "<!--Optional:-->" +
          "<con:requestData>" +
          "<!--Optional:-->" +
          $"<con:LoginAccount>{XmlHelper.EncodeXmlValue(account.LoginAccount)}</con:LoginAccount>" +
          $"<con:Token>{XmlHelper.EncodeXmlValue(callbackResult.Token)}</con:Token>" +
          "</con:requestData>" +
          "</con:ConfirmPayment>" +
          "</soapenv:Body>" +
          "</soapenv:Envelope>");
 }
Пример #2
0
        public static PaymentVerifyResult CreateVerifyResult(string webServiceResponse, ParsianCallbackResult callbackResult, MessagesOptions messagesOptions)
        {
            var status = XmlHelper.GetNodeValueFromXml(webServiceResponse, "Status", "https://pec.Shaparak.ir/NewIPGServices/Confirm/ConfirmService");
            var rrn    = XmlHelper.GetNodeValueFromXml(webServiceResponse, "RRN", "https://pec.Shaparak.ir/NewIPGServices/Confirm/ConfirmService");
            var token  = XmlHelper.GetNodeValueFromXml(webServiceResponse, "Token", "https://pec.Shaparak.ir/NewIPGServices/Confirm/ConfirmService");

            var isSucceed = !status.IsNullOrEmpty() && status == "0";

            var message = isSucceed
                ? messagesOptions.PaymentSucceed
                : $"Error {status}";

            var result = new PaymentVerifyResult
            {
                IsSucceed       = isSucceed,
                TransactionCode = rrn,
                Message         = message
            };

            result.DatabaseAdditionalData.Add("token", token);

            return(result);
        }