示例#1
0
        public async Task GetRefundAsync_TestModeParameterCase_QueryStringOnlyContainsTestModeParameterIfTrue(string expectedUrl, bool?testModeParameter)
        {
            // Given: We make a request to retrieve a payment without wanting any extra data
            bool         testMode     = testModeParameter ?? false;
            var          mockHttp     = this.CreateMockHttpMessageHandler(HttpMethod.Get, $"{BaseMollieClient.ApiEndPoint}{expectedUrl}", defaultGetRefundResponse);
            HttpClient   httpClient   = mockHttp.ToHttpClient();
            RefundClient refundClient = new RefundClient("abcde", httpClient);

            // When: We send the request
            await refundClient.GetRefundAsync("paymentId", "refundId", testmode : testMode);

            // Then
            mockHttp.VerifyNoOutstandingExpectation();
        }
示例#2
0
        public async Task CanRetrieveSingleRefund()
        {
            // If: We create a payment
            PaymentResponse payment = await CreatePayment();

            // We can only test this if you make the payment using the payment.Links.PaymentUrl property.
            // If you don't do this, this test will fail because we can only refund payments that have been paid
            Debugger.Break();

            RefundRequest refundRequest = new RefundRequest()
            {
                Amount = new Amount(Currency.EUR, "50.00")
            };
            RefundResponse refundResponse = await RefundClient.CreateRefundAsync(payment.Id, refundRequest);

            // When: We attempt to retrieve this refund
            RefundResponse result = await RefundClient.GetRefundAsync(payment.Id, refundResponse.Id);

            // Then
            Assert.IsNotNull(result);
            Assert.AreEqual(refundResponse.Id, result.Id);
            Assert.AreEqual(refundResponse.Amount.Value, result.Amount.Value);
            Assert.AreEqual(refundResponse.Amount.Currency, result.Amount.Currency);
        }