public void ItFetchesEnrollmentStatus() { var mpi = new MPI(apiKey, Constants.MPITestURL); var builder = new EnrollCheckBuilder { amount = "100", currency = "DKK", orderID = "1241249814", merchantName = this.merchantName, merchantID = this.merchantID, merchantAcquirerBin = this.merchantAcquirerBin, merchantCountry = "DK", merchantUrl = this.merchantUrl, cardholderIP = "1.1.1.1", cardNumber = this.cardNumber, cardExpireMonth = this.cardExpireMonth, cardExpireYear = this.cardExpireYear }; var status = mpi.EnrollCheck(builder); // Most of the time the testing directory servers are offline. Assert.True(status.error?.message == "Directory server timeout or connection error" || status.enrolled == "Y", "Status: '" + status.enrolled + "', Error: " + status.error?.message); }
/// <summary> /// Query the MPI service, returning <c>PARes</c> and <c>ACSUrl</c> to allow continuing the 3DS flow. /// </summary> /// <param name="builder"> /// The information associated with the 3D-Secure flow /// </param> /// <exception cref="ClrhsNetException">Network error communicating with gateway</exception> /// <exception cref="ClrhsAuthException">Thrown if APIKey is invalid</exception> /// <exception cref="ClrhsGatewayException">Thrown if gateway responds with internal server error</exception> /// <exception cref="ClrhsException">Unexpected connection error</exception> async public Task <EnrollmentStatus> EnrollCheckAsync(EnrollCheckBuilder builder) { using (var restRequest = new RestRequest(this.httpClient)) { restRequest.SetPath("/enrolled"); restRequest.AddParameters(builder.GetArgs()); var response = await restRequest.POSTAsync(); var body = response.Content.ReadAsStringAsync().Result; var status = JsonConvert.DeserializeObject <EnrollmentStatus>(body); return(status); } }