private async Task ShouldRequestAndGetCardSessionBrowserSession(Category category,
                                                                        ChallengeIndicatorType challengeIndicator,
                                                                        TransactionType transactionType)
        {
            var browserSession  = BrowserSession();
            var sessionResponse =
                await CreateNonHostedSession(browserSession, category, challengeIndicator, transactionType);

            sessionResponse.ShouldNotBeNull();
            sessionResponse.Created.ShouldNotBeNull();

            var response = sessionResponse.Created;

            response.Id.ShouldNotBeNull();
            response.SessionSecret.ShouldNotBeNull();
            response.TransactionId.ShouldNotBeNull();
            response.Amount.ShouldNotBeNull();
            response.Certificates.ShouldNotBeNull();
            response.Ds.ShouldNotBeNull();
            response.Acs.ShouldNotBeNull();
            response.Card.ShouldNotBeNull();

            response.AuthenticationType.ShouldBe(AuthenticationType.Regular);
            response.AuthenticationCategory.ShouldBe(category);
            response.Status.ShouldBe(SessionStatus.Challenged);
            response.NextActions.Count.ShouldBe(1);
            response.NextActions[0].ShouldBe(NextAction.ChallengeCardHolder);
            response.TransactionType.ShouldBe(transactionType);
            response.ResponseCode.ShouldBe(ResponseCode.C);
            response.AuthenticationDate.ShouldNotBeNull();

            response.GetSelfLink().ShouldNotBeNull();
            response.GetLink("callback_url").ShouldNotBeNull();
            response.Completed.ShouldBe(false);

            var getSessionResponse = await DefaultApi.SessionsClient().GetSessionDetails(response.Id);

            getSessionResponse.ShouldNotBeNull();

            getSessionResponse.Id.ShouldNotBeNull();
            getSessionResponse.SessionSecret.ShouldNotBeNull();
            getSessionResponse.TransactionId.ShouldNotBeNull();
            getSessionResponse.Amount.ShouldNotBeNull();
            getSessionResponse.Certificates.ShouldNotBeNull();
            getSessionResponse.Ds.ShouldNotBeNull();
            getSessionResponse.Card.ShouldNotBeNull();

            getSessionResponse.AuthenticationType.ShouldBe(AuthenticationType.Regular);
            getSessionResponse.AuthenticationCategory.ShouldBe(category);
            getSessionResponse.Status.ShouldBe(SessionStatus.Challenged);
            getSessionResponse.NextActions.Count.ShouldBe(1);
            getSessionResponse.NextActions[0].ShouldBe(NextAction.ChallengeCardHolder);
            getSessionResponse.TransactionType.ShouldBe(transactionType);
            getSessionResponse.ResponseCode.ShouldBe(ResponseCode.C);
            response.AuthenticationDate.ShouldNotBeNull();

            getSessionResponse.GetSelfLink().ShouldNotBeNull();
            getSessionResponse.GetLink("callback_url").ShouldNotBeNull();
            getSessionResponse.Completed.ShouldBe(false);

            var getSessionSecretSessionResponse =
                await DefaultApi.SessionsClient().GetSessionDetails(response.SessionSecret, response.Id);

            getSessionSecretSessionResponse.Certificates.ShouldBeNull();
            getSessionSecretSessionResponse.SessionSecret.ShouldBeNull();

            getSessionSecretSessionResponse.Id.ShouldNotBeNull();
            getSessionSecretSessionResponse.TransactionId.ShouldNotBeNull();
            getSessionSecretSessionResponse.Amount.ShouldNotBeNull();
            getSessionSecretSessionResponse.Ds.ShouldNotBeNull();
            getSessionSecretSessionResponse.Acs.ShouldNotBeNull();
            getSessionSecretSessionResponse.Card.ShouldNotBeNull();

            getSessionSecretSessionResponse.AuthenticationType.ShouldBe(AuthenticationType.Regular);
            getSessionSecretSessionResponse.AuthenticationCategory.ShouldBe(category);
            getSessionSecretSessionResponse.Status.ShouldBe(SessionStatus.Challenged);
            getSessionSecretSessionResponse.NextActions.Count.ShouldBe(1);
            getSessionSecretSessionResponse.NextActions[0].ShouldBe(NextAction.ChallengeCardHolder);
            getSessionSecretSessionResponse.TransactionType.ShouldBe(transactionType);
            getSessionSecretSessionResponse.ResponseCode.ShouldBe(ResponseCode.C);

            getSessionResponse.GetSelfLink().ShouldNotBeNull();
            getSessionResponse.GetLink("callback_url").ShouldNotBeNull();
            getSessionResponse.Completed.ShouldBe(false);
        }
        protected async Task <SessionResponse> CreateNonHostedSession(ChannelData channelData,
                                                                      Category authenticationCategory,
                                                                      ChallengeIndicatorType challengeIndicator,
                                                                      TransactionType transactionType)
        {
            var billingAddress = new SessionAddress
            {
                AddressLine1 = "CheckoutSdk.com",
                AddressLine2 = "90 Tottenham Court Road",
                City         = "London",
                State        = "ENG",
                Country      = CountryCode.GB
            };

            var source = new SessionCardSource
            {
                Number         = TestCardSource.Visa.Number,
                ExpiryMonth    = TestCardSource.Visa.ExpiryMonth,
                ExpiryYear     = TestCardSource.Visa.ExpiryYear,
                Name           = "John Doe",
                Email          = GenerateRandomEmail(),
                BillingAddress = billingAddress,
                HomePhone      = GetPhone(),
                MobilePhone    = GetPhone(),
                WorkPhone      = GetPhone()
            };

            var shippingAddress = new SessionAddress
            {
                AddressLine1 = "Checkout.com",
                AddressLine2 = "ABC building",
                AddressLine3 = "14 Wells Mews",
                City         = "London",
                State        = "ENG",
                Zip          = "W1T 4TJ",
                Country      = CountryCode.GB
            };

            var sessionRequest = new SessionRequest
            {
                Source              = source,
                Amount              = 6540L,
                Currency            = Currency.USD,
                ProcessingChannelId = "pc_5jp2az55l3cuths25t5p3xhwru",
                Marketplace         = new SessionMarketplaceData {
                    SubEntityId = "ent_ocw5i74vowfg2edpy66izhts2u"
                },
                AuthenticationCategory = authenticationCategory,
                ChallengeIndicator     = challengeIndicator,
                BillingDescriptor      = new SessionsBillingDescriptor {
                    Name = "SUPERHEROES.COM"
                },
                Reference       = "ORD-5023-4E89",
                TransactionType = transactionType,
                ShippingAddress = shippingAddress,
                Completion      = new NonHostedCompletionInfo {
                    CallbackUrl = "https://merchant.com/callback"
                },
                ChannelData = channelData
            };

            return(await Retriable(
                       async() => await DefaultApi.SessionsClient().RequestSession(sessionRequest, CancellationToken.None),
                       HasSessionCreated));
        }