Permalink
Browse files

jaxrs: InvoicePaymentResource#getInvoicePayment should look at unsucc…

…essful payments

This fixes #1014.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
  • Loading branch information...
pierre committed Jul 6, 2018
1 parent 2af5ea5 commit e814a7e6be8b7ad90012d3fcf4cc04a8c759f779
@@ -134,7 +134,7 @@ public Response getInvoicePayment(@PathParam("paymentId") final UUID paymentId,
final InvoicePayment invoicePayment = Iterables.tryFind(invoicePayments, new Predicate<InvoicePayment>() {
@Override
public boolean apply(final InvoicePayment input) {
return input.getType() == InvoicePaymentType.ATTEMPT && input.isSuccess();
return input.getType() == InvoicePaymentType.ATTEMPT;
}
}).orNull();
final UUID invoiceId = invoicePayment != null ? invoicePayment.getInvoiceId() : null;
@@ -294,6 +294,9 @@ public void testWithFailedInvoicePayment() throws Exception {
// Verify targetInvoiceId is not Null. See #593
assertNotNull(invoicePayment.getTargetInvoiceId());
// Verify targetInvoiceId is not null. See #1014
assertEquals(invoicePaymentApi.getInvoicePayment(invoicePayment.getPaymentId(), NULL_PLUGIN_PROPERTIES, requestOptions).getTargetInvoiceId(), invoicePayment.getTargetInvoiceId());
final Invoices invoices = accountApi.getInvoicesForAccount(accountJson.getAccountId(), null, requestOptions);
assertEquals(invoices.size(), 2);
final Invoice invoice = invoices.get(1);

0 comments on commit e814a7e

Please sign in to comment.