private async Task ShouldGetSessionDetails() { var response = new GetSessionResponse { Exemption = new ThreeDsExemption { Requested = "requested", Applied = Exemption.RecurringOperation, Code = "code" }, AuthenticationDate = DateTime.Now, FlowType = ThreeDSFlowType.Frictionless, ChallengeIndicator = ChallengeIndicatorType.ChallengeRequested, SchemeInfo = new SchemeInfo { Name = SessionScheme.CartesBancaires, Score = "score", Avalgo = "avalgo" } }; _apiClient.Setup(apiClient => apiClient.Get <GetSessionResponse>($"{Sessions}/id", _sdkCredentials.Object.GetSdkAuthorization(SdkAuthorizationType.OAuth), CancellationToken.None)) .ReturnsAsync(() => response); _sessionsClient = new SessionsClient(_apiClient.Object, _configuration.Object); var getSessionResponse = await _sessionsClient.GetSessionDetails("id", CancellationToken.None); getSessionResponse.ShouldNotBeNull(); getSessionResponse.Exemption.ShouldNotBeNull(); getSessionResponse.AuthenticationDate.ShouldNotBeNull(); getSessionResponse.FlowType.ShouldNotBeNull(); getSessionResponse.ChallengeIndicator.ShouldNotBeNull(); getSessionResponse.SchemeInfo.ShouldNotBeNull(); }
private async Task ShouldUpdateCardSessionUsingSessionSecret(bool usingSessionSecret) { var createSessionResponse = await CreateHostedSession(); createSessionResponse.ShouldNotBeNull(); createSessionResponse.Accepted.ShouldNotBeNull(); var created = createSessionResponse.Accepted; created.Id.ShouldNotBeNull(); created.SessionSecret.ShouldNotBeNull(); created.TransactionId.ShouldNotBeNull(); created.Amount.ShouldNotBeNull(); created.AuthenticationType.ShouldBe(AuthenticationType.Regular); created.AuthenticationCategory.ShouldBe(Category.Payment); created.NextActions.Count.ShouldBe(1); created.NextActions[0].ShouldBe(NextAction.RedirectCardholder); created.GetSelfLink().ShouldNotBeNull(); created.GetLink("success_url").ShouldNotBeNull(); created.GetLink("failure_url").ShouldNotBeNull(); created.GetLink("redirect_url").ShouldNotBeNull(); GetSessionResponse updated = usingSessionSecret ? await DefaultApi.SessionsClient().UpdateSession(created.SessionSecret, created.Id, BrowserSession(), CancellationToken.None) : await DefaultApi.SessionsClient().UpdateSession(created.Id, BrowserSession(), CancellationToken.None); updated.ShouldNotBeNull(); updated.HttpStatusCode.ShouldNotBeNull(); updated.ResponseHeaders.ShouldNotBeNull(); updated.Id.ShouldNotBeNull(); if (usingSessionSecret) { updated.SessionSecret.ShouldBeNull(); } else { updated.SessionSecret.ShouldNotBeNull(); } updated.Id.ShouldNotBeNull(); updated.Amount.ShouldNotBeNull(); updated.Card.ShouldNotBeNull(); updated.AuthenticationType.ShouldBe(AuthenticationType.Regular); updated.AuthenticationCategory.ShouldBe(Category.Payment); updated.Status.ShouldBe(SessionStatus.Approved); updated.NextActions.Count.ShouldBe(0); updated.GetSelfLink().ShouldNotBeNull(); updated.GetLink("success_url").ShouldNotBeNull(); updated.GetLink("failure_url").ShouldNotBeNull(); updated.GetLink("redirect_url").ShouldBeNull(); }