Search in sources :

Example 1 with ExpectedRefundCheck

use of org.killbill.billing.beatrix.util.RefundChecker.ExpectedRefundCheck in project killbill by killbill.

the class TestPaymentRefund method testRefundWithInvoiceItemAdjustemts.

@Test(groups = "slow")
public void testRefundWithInvoiceItemAdjustemts() throws Exception {
    final Map<UUID, BigDecimal> iias = new HashMap<UUID, BigDecimal>();
    iias.put(invoice.getInvoiceItems().get(0).getId(), null);
    refundPaymentWithInvoiceItemAdjAndCheckForCompletion(account, payment, iias, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT, NextEvent.INVOICE_ADJUSTMENT);
    refundChecker.checkRefund(payment.getId(), callContext, new ExpectedRefundCheck(payment.getId(), true, new BigDecimal("233.82"), Currency.USD, initialCreationDate.toLocalDate()));
    invoice = invoiceChecker.checkInvoice(account.getId(), invoiceItemCount++, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 3, 2), new LocalDate(2012, 3, 31), InvoiceItemType.RECURRING, new BigDecimal("233.82")), new ExpectedInvoiceItemCheck(InvoiceItemType.ITEM_ADJ, new BigDecimal("-233.82")));
}
Also used : HashMap(java.util.HashMap) UUID(java.util.UUID) ExpectedInvoiceItemCheck(org.killbill.billing.beatrix.util.InvoiceChecker.ExpectedInvoiceItemCheck) LocalDate(org.joda.time.LocalDate) BigDecimal(java.math.BigDecimal) ExpectedRefundCheck(org.killbill.billing.beatrix.util.RefundChecker.ExpectedRefundCheck) Test(org.testng.annotations.Test)

Example 2 with ExpectedRefundCheck

use of org.killbill.billing.beatrix.util.RefundChecker.ExpectedRefundCheck in project killbill by killbill.

the class TestPaymentRefund method testRefundWithNoAdjustments.

@Test(groups = "slow")
public void testRefundWithNoAdjustments() throws Exception {
    // Although we don't adjust the invoice, the invoicing system sends an event because invoice balance changes and overdue system-- in particular-- needs to know about it.
    refundPaymentAndCheckForCompletion(account, payment, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT);
    refundChecker.checkRefund(payment.getId(), callContext, new ExpectedRefundCheck(payment.getId(), false, new BigDecimal("233.82"), Currency.USD, initialCreationDate.toLocalDate()));
}
Also used : BigDecimal(java.math.BigDecimal) ExpectedRefundCheck(org.killbill.billing.beatrix.util.RefundChecker.ExpectedRefundCheck) Test(org.testng.annotations.Test)

Aggregations

BigDecimal (java.math.BigDecimal)2 ExpectedRefundCheck (org.killbill.billing.beatrix.util.RefundChecker.ExpectedRefundCheck)2 Test (org.testng.annotations.Test)2 HashMap (java.util.HashMap)1 UUID (java.util.UUID)1 LocalDate (org.joda.time.LocalDate)1 ExpectedInvoiceItemCheck (org.killbill.billing.beatrix.util.InvoiceChecker.ExpectedInvoiceItemCheck)1