Пример #1
0
        public async Task CanRetrieveIssuersForAllMethods()
        {
            // When: retrieving the all mollie payment methods we can include the issuers
            ListResponse <PaymentMethodResponse> paymentMethods = await PaymentMethodClient.GetAllPaymentMethodListAsync(includeIssuers : true);

            // Then: We should have one or multiple issuers
            Assert.IsTrue(paymentMethods.Items.Any(x => x.Issuers != null));
        }
Пример #2
0
        public async Task DoNotRetrievePricingWhenIncludeIsNull()
        {
            // When: retrieving the ideal method with the include parameter set to null
            PaymentMethodResponse paymentMethod = await PaymentMethodClient.GetPaymentMethodAsync(PaymentMethods.Ideal, includePricing : null);

            // Then: Issuers should not be included
            Assert.IsNull(paymentMethod.Pricing);
        }
Пример #3
0
        public async Task DoNotRetrieveIssuersWhenIncludeIsFalse()
        {
            // When: retrieving the ideal method with the include parameter set to false
            PaymentMethodResponse paymentMethod = await PaymentMethodClient.GetPaymentMethodAsync(PaymentMethods.Ideal, false);

            // Then: Issuers should not be included
            Assert.IsNull(paymentMethod.Issuers);
        }
        public async Task CanRetrieveIssuersForAllMethods()
        {
            // When: retrieving the all mollie payment methods we can include the issuers
            var paymentMethods = await PaymentMethodClient.GetAllPaymentMethodListAsync(includeIssuers : true);

            // Then: We should have one or multiple issuers
            Assert.Contains(paymentMethods.Items, x => x.Issuers != null);
        }
Пример #5
0
        public async Task CanRetrievePricingForAllMethods()
        {
            // When: retrieving the ideal method we can include the issuers
            ListResponse <PaymentMethodResponse> paymentMethods = await PaymentMethodClient.GetAllPaymentMethodListAsync(includePricing : true);

            // Then: We should have prices available
            Assert.IsTrue(paymentMethods.Items.Any(x => x.Pricing != null && x.Pricing.Any(y => y.Fixed.Value > 0)));
        }
Пример #6
0
        public async Task CanRetrievePricing()
        {
            // When: retrieving the ideal method we can include the issuers
            PaymentMethodResponse paymentMethod = await PaymentMethodClient.GetPaymentMethodAsync(PaymentMethods.Ideal, includePricing : true);

            // Then: We should have one or multiple issuers
            Assert.IsNotNull(paymentMethod);
            Assert.IsTrue(paymentMethod.Pricing.Any());
        }
Пример #7
0
        public async Task CanRetrieveIssuersAndPricingInformation()
        {
            // When: retrieving the all mollie payment methods we can include the issuers
            ListResponse <PaymentMethodResponse> paymentMethods = await PaymentMethodClient.GetAllPaymentMethodListAsync(includeIssuers : true, includePricing : true);

            // Then: We should have one or multiple issuers
            Assert.IsTrue(paymentMethods.Items.Any(x => x.Issuers != null));
            Assert.IsTrue(paymentMethods.Items.Any(x => x.Pricing != null && x.Pricing.Any(y => y.Fixed.Value > 0)));
        }
Пример #8
0
        public async Task CanRetrievePaymentMethodList()
        {
            // When: Retrieve payment list with default settings
            ListResponse <PaymentMethodResponse> response = await PaymentMethodClient.GetPaymentMethodListAsync();

            // Then: Make sure it can be retrieved
            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Items);
        }
Пример #9
0
        public async Task CanRetrieveAllMethods()
        {
            // When: retrieving the all mollie payment methods
            ListResponse <PaymentMethodResponse> paymentMethods = await PaymentMethodClient.GetAllPaymentMethodListAsync();

            // Then: We should have multiple issuers
            Assert.IsNotNull(paymentMethods);
            Assert.IsTrue(paymentMethods.Items.Any());
        }
        public async Task CanRetrieveIdealIssuers()
        {
            // When: retrieving the ideal method we can include the issuers
            var paymentMethod = await PaymentMethodClient.GetPaymentMethodAsync(PaymentMethods.Ideal, true);

            // Then: We should have one or multiple issuers
            Assert.NotNull(paymentMethod);
            Assert.True(paymentMethod.Issuers.Any());
        }
        public async Task CanRetrieveSinglePaymentMethod(PaymentMethods method)
        {
            // When: retrieving a payment method
            var paymentMethod = await PaymentMethodClient.GetPaymentMethodAsync(method);

            // Then: Make sure it can be retrieved
            Assert.NotNull(paymentMethod);
            Assert.Equal(method, paymentMethod.Id);
        }
Пример #12
0
        static void OutputPaymentMethods(PaymentMethodClient paymentMethodClient)
        {
            Console.WriteLine("Ouputting all payment methods");
            ListResponse <PaymentMethodResponse> paymentMethodList = paymentMethodClient.GetPaymentMethodListAsync(0, 100).Result;

            foreach (PaymentMethodResponse paymentMethodResponse in paymentMethodList.Data)
            {
                Console.WriteLine($"Payment method description: { paymentMethodResponse.Description }");
            }
        }
Пример #13
0
        public async Task GetPaymentMethodListAsync_AmountParameterIsAdded_QueryStringContainsAmount()
        {
            // Given: We make a request to retrieve a order without wanting any extra data
            var                 mockHttp            = this.CreateMockHttpMessageHandler(HttpMethod.Get, $"{BaseMollieClient.ApiEndPoint}methods/all?amount[value]=100.00&amount[currency]=EUR", defaultPaymentMethodJsonResponse);
            HttpClient          httpClient          = mockHttp.ToHttpClient();
            PaymentMethodClient paymentMethodClient = new PaymentMethodClient("abcde", httpClient);

            // When: We send the request
            await paymentMethodClient.GetAllPaymentMethodListAsync(amount : new Amount("EUR", 100));

            // Then
            mockHttp.VerifyNoOutstandingExpectation();
        }
Пример #14
0
        public async Task GetPaymentMethodListAsync_NoAmountParameter_QueryStringIsEmpty()
        {
            // Given: We make a request to retrieve a order without wanting any extra data
            var                 mockHttp            = this.CreateMockHttpMessageHandler(HttpMethod.Get, $"{BaseMollieClient.ApiEndPoint}methods/all", defaultPaymentMethodJsonResponse);
            HttpClient          httpClient          = mockHttp.ToHttpClient();
            PaymentMethodClient paymentMethodClient = new PaymentMethodClient("abcde", httpClient);

            // When: We send the request
            await paymentMethodClient.GetAllPaymentMethodListAsync();

            // Then
            mockHttp.VerifyNoOutstandingExpectation();
        }
Пример #15
0
        static void Main(string[] args)
        {
            string              apiKey              = "{your_api_test_key}";
            PaymentClient       paymentClient       = new PaymentClient(apiKey);
            PaymentMethodClient paymentMethodClient = new PaymentMethodClient(apiKey);

            OutputAndWait("Press any key to create a new payment");
            OutputNewPayment(paymentClient);
            OutputAndWait("Press any key to retrieve a list of payments");
            OutputPaymentList(paymentClient);
            OutputAndWait("Press any key to retrieve a list of payment methods");
            OutputPaymentMethods(paymentMethodClient);
            OutputAndWait("Example completed");
        }
Пример #16
0
 public PaymentMethodClientTest(ClientFixture clientFixture)
     : base(clientFixture)
 {
     paymentMethodClient = new PaymentMethodClient();
 }