public async Task CanCreatePartialRefund() { // If: We create a payment of 250 euro PaymentResponse payment = await CreatePayment("250.00"); // 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(); // When: We attempt to refund 50 euro RefundRequest refundRequest = new RefundRequest() { Amount = new Amount(Currency.EUR, "50.00") }; RefundResponse refundResponse = await RefundClient.CreateRefundAsync(payment.Id, refundRequest); // Then Assert.AreEqual("50.00", refundResponse.Amount.Value); }
public async Task CanCreateRefund() { // If: We create a payment string amount = "100.00"; PaymentResponse payment = await CreatePayment(amount); // We can only test this if you make the payment using the payment.Links.Checkout property. // If you don't do this, this test will fail because we can only refund payments that have been paid Debugger.Break(); // When: We attempt to refund this payment RefundRequest refundRequest = new RefundRequest() { Amount = new Amount(Currency.EUR, amount) }; RefundResponse refundResponse = await RefundClient.CreateRefundAsync(payment.Id, refundRequest); // Then Assert.IsNotNull(refundResponse); }
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); }