public void EntranceCodeCannotContainMoreThan40Characters() { Assert.Throws<InvalidOperationException>(delegate { var transactionRequest = new TransactionRequest("123456789", null, 1, "http://webpirates.nl", "1", 1000000, TimeSpan.FromMinutes(30), "iMac 27", "01234567890123456789012345678901234567891"); }); }
public void ExpirationPeriodCannotBeMoreThan60Minutes() { Assert.Throws<InvalidOperationException>(delegate { var transactionRequest = new TransactionRequest("123456789", null, 1, "http://webpirates.nl", "1", 1000000, TimeSpan.FromMinutes(61), "iMac 27", "1"); }); }
public void PurchaseIdCannotBeEmpty() { Assert.Throws<InvalidOperationException>(delegate { var transactionRequest = new TransactionRequest("123456789", null, 1, "http://webpirates.nl", "", 1000000, TimeSpan.FromMinutes(30), "iMac 27", "1"); }); }
public void CannotSetEmptyMerchantUrl() { Assert.Throws<InvalidOperationException>(delegate { var transactionRequest = new TransactionRequest("123456789", null, 1, "", "1", 1000000, TimeSpan.FromMinutes(30), "iMac 27", "1"); }); }
/// <summary> /// Send transaction request to acquirer (merchant's bank) /// </summary> /// <param name="issuerId">Unique identifier of issuer (consumer's bank). Id can be retrieved with a directory request</param> /// <param name="merchantReturnUrl">Url to which the consumer is redirected after finishing the transaction</param> /// <param name="purchaseId">Unique identifier generated by merchant/acceptant</param> /// <param name="amount">Amount in cents (eur)</param> /// <param name="expirationPeriod">Period consumer has to finish the tranaction before it is marked as expired by the issuer (consumer's bank)</param> /// <param name="description">Description, printed on bank statement</param> /// <param name="entranceCode">Unique code to identify consumer when returning, generated by merchant/acceptant</param> public TransactionResponse SendTransactionRequest(string issuerId, string merchantReturnUrl, string purchaseId, int amount, TimeSpan? expirationPeriod, string description, string entranceCode) { // Set up dependencies for http request var transactionRequest = new TransactionRequest(_configuration.MerchantId, _configuration.MerchantSubId, issuerId, merchantReturnUrl, purchaseId, amount, expirationPeriod, description, entranceCode ); // Execute http request return (TransactionResponse)_iDealHttpRequest.SendRequest(transactionRequest, _signatureProvider, _configuration.AcquirerUrl, _iDealHttpResponseHandler); }
public void CanCreateTransactionRequest() { var transactionRequest = new TransactionRequest("123456789", null, 1, "http://webpirates.nl", "1", 1000000, TimeSpan.FromMinutes(30), "iMac 27", "1"); Assert.AreEqual(1, transactionRequest.IssuerId); Assert.AreEqual("http://webpirates.nl", transactionRequest.MerchantReturnUrl); Assert.AreEqual("1", transactionRequest.PurchaseId); Assert.AreEqual(1000000, transactionRequest.Amount); Assert.AreEqual(TimeSpan.FromMinutes(30), transactionRequest.ExpirationPeriod); Assert.AreEqual("iMac 27", transactionRequest.Description); Assert.AreEqual("1", transactionRequest.EntranceCode); }
public void CanGetXmlRepresentationOfTransactionRequest() { var transactionRequest = new TransactionRequest("123456789", null, 1, "http://webpirates.nl", "1", 1000000, TimeSpan.FromMinutes(30), "iMac 27", "1"); var xml = transactionRequest.ToXml(new SignatureProvider(PrivateCertificate, PublicCertificate)); Assert.IsNotNullOrEmpty(xml); }
public void EntranceCodeIsRequired() { Assert.Throws<InvalidOperationException>(delegate { var transactionRequest = new TransactionRequest("123456789", null, 1, "http://webpirates.nl", "1", 1000000, TimeSpan.FromMinutes(30), "iMac 27", ""); }); }
public void DefaultExpirationPeriodIs30Minutes() { var transactionRequest = new TransactionRequest("123456789", null, 1, "http://webpirates.nl", "1", 1000000, null, "iMac 27", "1"); Assert.AreEqual(TimeSpan.FromMinutes(30), transactionRequest.ExpirationPeriod); }