예제 #1
0
        //public const string PaymentPageUrl = "https://asan.shaparak.ir/";
        //public const string BaseServiceUrl = "https://services.asanpardakht.net/paygate/merchantservices.asmx";

        public static string CreateRequestData(Invoice invoice, AsanPardakhtGatewayAccount account, IAsanPardakhtCrypto crypto)
        {
            var requestToEncrypt = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}",
                                                 1,
                                                 account.UserName,
                                                 account.Password,
                                                 invoice.TrackingNumber,
                                                 invoice.Amount.ToLongString(),
                                                 "datetime",
                                                 "",
                                                 invoice.CallbackUrl,
                                                 "0"
                                                 );

            var encryptedRequest = 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:RequestOperation>" +
                 $"<tem:merchantConfigurationID>{account.MerchantConfigurationId}</tem:merchantConfigurationID>" +
                 "<!--Optional:-->" +
                 $"<tem:encryptedRequest>{XmlHelper.EncodeXmlValue(encryptedRequest)}</tem:encryptedRequest>" +
                 "</tem:RequestOperation>" +
                 "</soapenv:Body>" +
                 "</soapenv:Envelope>");
        }
예제 #2
0
        public static string CreateSettleData(
            AsanPardakhtCallbackResult callbackResult,
            AsanPardakhtGatewayAccount account,
            IAsanPardakhtCrypto crypto)
        {
            var requestToEncrypt = $"{account.UserName},{account.Password}";
            var encryptedRequest = 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>");
        }