public string GetStatusRequest(StatusRequest statusRequest) { if (statusRequest == null) { throw new ArgumentNullException("statusRequest"); } var acquirerStatusReq = new AcquirerStatusReq { createDateTimestamp = DateTimeHelper.Now(), productID = Constants.IDxProductId, version = "1.0.0", Merchant = new AcquirerStatusReqMerchant { merchantID = _configuration.MerchantId, subID = _configuration.MerchantSubId.ToString(CultureInfo.InvariantCulture) }, Transaction = new AcquirerStatusReqTransaction { transactionID = statusRequest.TransactionId } }; return(DateTimeHelper.ProcessDateTimes(acquirerStatusReq.Serialize(), _dateTimeElementNames)); }
public string GetStatusRequest(StatusRequest statusRequest) { var acquirerStatusReq = new AcquirerStatusReq { createDateTimestamp = Now(), productID = this.LocalInstrumentCode == Instrumentation.Core ? ProductId_CORE : ProductId_B2B, version = "1.0.0", Merchant = new AcquirerStatusReqMerchant { merchantID = Configuration.Contract.Id, subID = Configuration.Contract.SubId.ToString(CultureInfo.InvariantCulture) }, Transaction = new AcquirerStatusReqTransaction { transactionID = statusRequest.TransactionId } }; return(ProcessDateTimes(acquirerStatusReq.Serialize())); }
/// <summary> /// Requests the status of a transaction. /// </summary> /// <param name="transactionId">Id of the <see cref="Transaction" /> to check status for.</param> /// <returns><see cref="Transaction" /> holding status for the transaction.</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 Transaction RequestTransactionStatus(string transactionId) { if (traceSwitch.TraceInfo) { TraceLine("Start of RequestTransactionStatus()"); } if (traceSwitch.TraceVerbose) { TraceLine(Format("Parameters: transactionId: {0}", transactionId == null ? "NULL" : transactionId)); } // Check input CheckMandatory("transactionId", transactionId); AcquirerStatusReq request = CreateRequest <AcquirerStatusReq>(); request.Merchant = CreateMerchant <AcquirerStatusReqMerchant>(); request.Transaction = new AcquirerStatusReqTransaction(); request.Transaction.transactionID = transactionId; // Serialize the request to an XML string string xmlRequest = SerializationHelper.SerializeObject <AcquirerStatusReq>(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.acquirerUrlSTA); // Validate respons ValidateXML(xmlResponse); if (!XmlSignature.XmlSignature.CheckSignature(xmlResponse, (RSA)merchantConfig.aquirerCertificate.PublicKey.Key)) { Trace.WriteLine("Xml response was not well signed " + xmlResponse); throw new ArgumentException("Response from server is not well signed"); } if (traceSwitch.TraceInfo) { TraceLine("Response from RequestTransactionStatus() was : " + xmlResponse); } // Check respons for errors CheckError(xmlResponse, Resources.iDealStatusCheckFailed); AcquirerStatusRes response = (AcquirerStatusRes)SerializationHelper.DeserializeObject <AcquirerStatusRes>(xmlResponse); Transaction transaction = new Transaction(); transaction.Id = response.Transaction.transactionID; transaction.AcquirerId = response.Acquirer.acquirerID; transaction.Status = (Transaction.TransactionStatus)Enum.Parse(typeof(Transaction.TransactionStatus), response.Transaction.status); transaction.ConsumerIBAN = response.Transaction.consumerIBAN; transaction.ConsumerBIC = response.Transaction.consumerBIC; transaction.StatusDateTimestamp = response.Transaction.statusDateTimestamp; transaction.ConsumerName = response.Transaction.consumerName; transaction.SignatureValue = response.Signature.SignatureValue.Value; transaction.Amount = response.Transaction.amount; transaction.Currency = response.Transaction.currency; if (traceSwitch.TraceInfo) { TraceLine("End of RequestTransactionStatus()"); } if (traceSwitch.TraceVerbose) { TraceLine(Format("Returnvalue: {0}", transaction.ToString())); } return(transaction); }