Ejemplo n.º 1
0
        private async Task ShouldRequestPayment_IdempotencyKey()
        {
            var paymentRequest = new PaymentRequest
            {
                Source = new RequestNetworkTokenSource
                {
                    Token          = "token",
                    Cryptogram     = "cryptogram",
                    Cvv            = "123",
                    Eci            = "eci",
                    Name           = "name",
                    Phone          = new Phone(),
                    Stored         = false,
                    BillingAddress = new Address(),
                    ExpiryMonth    = 12,
                    ExpiryYear     = 2024,
                    TokenType      = NetworkTokenType.Vts
                }
            };
            var paymentResponse = new PaymentResponse();

            _apiClient.Setup(apiClient =>
                             apiClient.Post <PaymentResponse>(PaymentsPath, _authorization, paymentRequest,
                                                              CancellationToken.None, "test"))
            .ReturnsAsync(() => paymentResponse);

            IPaymentsClient paymentsClient = new PaymentsClient(_apiClient.Object, _configuration.Object);

            var response = await paymentsClient.RequestPayment(paymentRequest, "test", CancellationToken.None);

            response.ShouldNotBeNull();
            response.ShouldBeSameAs(paymentResponse);
        }