コード例 #1
0
        public string GetDirectoryRequest()
        {
            var directoryRequest = new DirectoryReq
            {
                createDateTimestamp = Now(),
                productID           = this.LocalInstrumentCode == Instrumentation.Core? ProductId_CORE : ProductId_B2B,
                version             = "1.0.0",

                Merchant = new DirectoryReqMerchant
                {
                    merchantID = Configuration.Contract.Id,
                    subID      = Configuration.Contract.SubId.ToString(CultureInfo.InvariantCulture)
                },
            };

            return(ProcessDateTimes(directoryRequest.Serialize()));
        }
コード例 #2
0
        public string GetDirectoryRequest()
        {
            var directoryRequest = new DirectoryReq
            {
                createDateTimestamp = DateTimeHelper.Now(),
                version             = "1.0.0",
                productID           = Constants.IDxProductId,

                Merchant = new DirectoryReqMerchant
                {
                    merchantID = _configuration.MerchantId,
                    subID      = _configuration.MerchantSubId.ToString(CultureInfo.InvariantCulture)
                }
            };

            return(DateTimeHelper.ProcessDateTimes(directoryRequest.Serialize(), _dateTimeElementNames));
        }
コード例 #3
0
        /// <summary>
        /// Retrieves both the short list and the long list of issuers.
        /// </summary>
        /// <returns><see cref="Issuers" /> containing the long list and short list of issuers, and the datetime stamp of the last change to the lists.</returns>
        /// <exception cref="XmlSchemaValidationException">Request Xml does not comply with schema.</exception>
        /// <exception cref="IDealException">Respons from iDEAL contains an error.</exception>
        /// <exception cref="ConfigurationErrorsException">Errors in configuration file.</exception>
        /// <exception cref="WebException">Error getting reply from acquirer.</exception>
        /// <exception cref="CryptographicException">Error using client certificate.</exception>
        public Issuers GetIssuerList()
        {
            if (traceSwitch.TraceInfo)
            {
                TraceLine("Start of GetIssuerList()");
            }

            DirectoryReq request = CreateRequest <DirectoryReq>();

            request.Merchant = CreateMerchant <DirectoryReqMerchant>();

            // Serialize the request to an XML string
            string xmlRequest = SerializationHelper.SerializeObject <DirectoryReq>(request);

            var xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(xmlRequest);

            var signatureElement = XmlSignature.XmlSignature.Sign(ref xmlDoc, GetMerchantRSACryptoServiceProvider(), merchantConfig.ClientCertificate.Thumbprint);

            xmlRequest = xmlDoc.OuterXml;

            // Validate the request before sending it to the service
            ValidateXML(xmlRequest);

            // Send request / get respons
            string xmlResponse = GetReplyFromAcquirer(xmlRequest, merchantConfig.acquirerUrlDIR);

            // Validate respons
            ValidateXML(xmlResponse);

            if (!XmlSignature.XmlSignature.CheckSignature(xmlResponse, (RSA)merchantConfig.aquirerCertificate.PublicKey.Key))
            {
                if (traceSwitch.TraceInfo)
                {
                    TraceLine("Xml response was not well signed " + xmlResponse);
                }
                throw new ArgumentException("Response from server is not well signed");
            }

            if (traceSwitch.TraceInfo)
            {
                TraceLine("Response from get issuer list was : " + xmlResponse);
            }

            // Check respons for errors
            CheckError(xmlResponse, Resources.iDealUnavailable);

            DirectoryRes response = (DirectoryRes)SerializationHelper.DeserializeObject <DirectoryRes>(xmlResponse);

            // Create the return object and initialze it with the iDEAL respons Directory
            var issuers = new Issuers(response.Directory);

            if (traceSwitch.TraceInfo)
            {
                TraceLine("End of GetIssuerList()");
            }
            if (traceSwitch.TraceVerbose)
            {
                TraceLine(Format("Returnvalue: {0}", issuers.ToString()));
            }

            return(issuers);
        }