/// <summary> /// Bepaal de URL voor get request voor de Ideal transactie bij Sisow. /// </summary> /// <param name="amountInCents"></param> /// <param name="purchaseId"></param> /// <param name="description"></param> /// <param name="returnUrl"></param> /// <param name="issuerid"></param> /// <returns></returns> public static string DetermineSisowGetUrl(int amountInCents, string transactionID, string description, string returnUrl, string issuerid) { if (transactionID.Length>16) { // De purchaseId mag niet langer zijn dan 16 karakters (Sisow specificatie). throw new SisowIdealArgumentException("De transactionID is langer dan 16 karakters: '" + transactionID + "'."); } // De purchaseId mag alleen cijfers en letters bevatten, geen leestekens en dergelijke. if (Regex.IsMatch(transactionID, "^/w+$")) { throw new SisowIdealArgumentException("De transactionID mag alleen cijfers en letters bevatten, geen leestekens en dergelijke: '" + transactionID + "'."); } if (description.Length>32) { // De description mag niet langer zijn dan 32 karakters (Sisow specificatie). throw new SisowIdealArgumentException("De description is langer dan 32 karakters: '" + description + "'."); } string key = SHA1Encode(_merchantID + _password + transactionID + amountInCents); string sisowUrl = string.Empty; string purchaseIDBeforeCall = transactionID; string purchaseID = null; using (SisowV2.sisowSoapClient service = new SisowV2.sisowSoapClient()) { int result = service.GetURL(_merchantID, _merchantKey, "", issuerid, amountInCents, transactionID, description, null, returnUrl, null, null, null, out purchaseID, out sisowUrl); if (result!=0) { throw new ArgumentException(string.Format("Error: error code {0} returned by 'GetUrl(...)' method.", result)); } } /* if (purchaseID!=purchaseIDBeforeCall) { throw new ArgumentException(string.Format("The webservice 'changed' the purchaseID from {0} to {1}.", purchaseIDBeforeCall, purchaseID)); } */ return sisowUrl; }
/// <summary> /// Get the currently valid bank names and id's from the Sisow iDEAL webservice. /// </summary> /// <returns></returns> public static List<SelectListItem> GetIssuerList() { List<SelectListItem> result = new List<SelectListItem>(); using (SisowV2.sisowSoapClient service = new SisowV2.sisowSoapClient()) { SisowV2.ArrayOfString banks = new SisowV2.ArrayOfString(); // List<string> banks = service.GetIssuers(HreSettings.IsDevelopment).ToList(); int dummy = service.GetIssuers(HreSettings.IsDevelopment, out banks); // Add empty item (for placeholder). result.Add(new SelectListItem()); for (int i = 0; i < banks.Count(); i = i+2) { string bankText = banks[i]; string bankValue = banks[i+1]; result.Add(new SelectListItem() { Text = bankText, Value= bankValue }); } } return result; }