Skip to content

Commit

Permalink
MODFIN-283. Code formatting and update TransactionSummariesHelper to …
Browse files Browse the repository at this point in the history
…keep existing logic
  • Loading branch information
SerhiiNosko committed Nov 8, 2023
1 parent 9be4f00 commit f694357
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
22 changes: 12 additions & 10 deletions src/main/java/org/folio/rest/helper/TransactionSummariesHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@ public Future<OrderTransactionSummary> createOrderTransactionSummary(OrderTransa
validateOrderTransactionCount(orderSummary.getNumTransactions());
return null;
})
.compose(ok -> restClient.post(resourcesPath(ORDER_TRANSACTION_SUMMARIES), orderSummary, OrderTransactionSummary.class, requestContext));
.compose(ok -> restClient.post(resourcesPath(ORDER_TRANSACTION_SUMMARIES), orderSummary, OrderTransactionSummary.class, requestContext))
.map(createdSummary -> orderSummary.withId(createdSummary.getId()));
}

public Future<InvoiceTransactionSummary> createInvoiceTransactionSummary(InvoiceTransactionSummary invoiceSummary, RequestContext requestContext) {
return Future.succeededFuture().map(v -> {
validateInvoiceTransactionCount(invoiceSummary.getNumPaymentsCredits(), invoiceSummary.getNumPendingPayments());
return null;
return Future.succeededFuture()
.map(v -> {
validateInvoiceTransactionCount(invoiceSummary.getNumPaymentsCredits(), invoiceSummary.getNumPendingPayments());
return null;
})
.compose(ok -> restClient.post(resourcesPath(INVOICE_TRANSACTION_SUMMARIES), invoiceSummary, InvoiceTransactionSummary.class, requestContext))
.map(invoiceTransactionSummary -> invoiceTransactionSummary);
.map(createdSummary -> invoiceSummary.withId(createdSummary.getId()));
}

/**
Expand Down Expand Up @@ -76,11 +78,11 @@ public Future<Void> updateOrderTransactionSummary(OrderTransactionSummary orderS
}

public Future<Void> updateInvoiceTransactionSummary(InvoiceTransactionSummary invoiceSummary, RequestContext requestContext) {
return Future.succeededFuture().map(v-> {

validateInvoiceTransactionCount(invoiceSummary.getNumPaymentsCredits(), invoiceSummary.getNumPendingPayments());
return null;
})
return Future.succeededFuture()
.map(v-> {
validateInvoiceTransactionCount(invoiceSummary.getNumPaymentsCredits(), invoiceSummary.getNumPendingPayments());
return null;
})
.compose(ok -> restClient.put(resourceByIdPath(INVOICE_TRANSACTION_SUMMARIES, invoiceSummary.getId()), invoiceSummary, requestContext));
}
}
4 changes: 2 additions & 2 deletions src/main/java/org/folio/rest/impl/FundsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ public void deleteFinanceFundTypesById(String id, Map<String, String> headers,
public void getFinanceFundsExpenseClassesById(String id, String status, String fiscalYearId,
Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> handler, Context ctx) {
fundDetailsService.retrieveExpenseClasses(id, fiscalYearId, status, new RequestContext(ctx, okapiHeaders))
.onSuccess(obj -> handler.handle(succeededFuture(buildOkResponse(obj))))
.onFailure(fail -> handleErrorResponse(handler, fail));
.onSuccess(obj -> handler.handle(succeededFuture(buildOkResponse(obj))))
.onFailure(fail -> handleErrorResponse(handler, fail));
}

@Validate
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/folio/rest/impl/LedgerRolloverLogsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void getFinanceLedgerRolloversLogs(String query, String totalRecords, int
public void getFinanceLedgerRolloversLogsById(String id, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
ledgerRolloverLogsService.retrieveLedgerRolloverLogById(id, new RequestContext(vertxContext, okapiHeaders))
.onSuccess(rolloverLog -> asyncResultHandler.handle(succeededFuture(buildOkResponse(rolloverLog))))
.onFailure(fail -> handleErrorResponse(asyncResultHandler, fail));
.onSuccess(rolloverLog -> asyncResultHandler.handle(succeededFuture(buildOkResponse(rolloverLog))))
.onFailure(fail -> handleErrorResponse(asyncResultHandler, fail));
}
}

0 comments on commit f694357

Please sign in to comment.