Skip to content

TASKS 1-4 COMPLETE - #300

Open
keneijeh760-ship-it wants to merge 12 commits into
vagabond-systems:flowfrom
keneijeh760-ship-it:flow
Open

TASKS 1-4 COMPLETE#300
keneijeh760-ship-it wants to merge 12 commits into
vagabond-systems:flowfrom
keneijeh760-ship-it:flow

Conversation

@keneijeh760-ship-it

Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings July 12, 2026 00:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR wires up Kafka-driven transaction processing with persistence and an external “incentive” HTTP call, and adds the required Spring dependencies/test configuration to support it.

Changes:

  • Add a Kafka listener that consumes Transaction messages and routes them to a new TransactionService.
  • Implement TransactionService to load users, apply balance changes, call an incentive endpoint, and persist a Transactions entity.
  • Add Spring Web/JPA/H2/Kafka dependencies and test application.yml configuration.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/test/resources/application.yml Adds test-only Kafka + H2 + JPA settings and topic configuration.
src/test/java/com/jpmc/midascore/TaskThreeTests.java Adds UserRepository injection to the Task 3 test harness.
src/main/java/com/jpmc/midascore/Service/TransactionService.java New transactional service that applies transfers, calls incentive endpoint, and persists transactions.
src/main/java/com/jpmc/midascore/repository/UserRepository.java Updates repository imports / custom finder signature.
src/main/java/com/jpmc/midascore/repository/TransactionsRepository.java Adds repository for new Transactions entity.
src/main/java/com/jpmc/midascore/MidasCoreApplication.java Registers a RestTemplate bean for HTTP calls.
src/main/java/com/jpmc/midascore/listener/Listener.java Adds Kafka listener that invokes TransactionService.
src/main/java/com/jpmc/midascore/foundation/Transactions.java Introduces persisted Transactions entity capturing sender/recipient/amount/incentive.
src/main/java/com/jpmc/midascore/foundation/Transaction.java Updates Transaction DTO imports/formatting.
src/main/java/com/jpmc/midascore/foundation/Incentives.java Adds DTO for incentive response.
pom.xml Adds web/JPA/H2/Kafka/test dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +36 to +56
UserRecord reciepinet = userRepository.findById(transaction.getRecipientId());

if (reciepinet == null) {
return;
}


if (sender.getBalance() < transaction.getAmount()) {
return;
}

Incentives incentives = restTemplate.postForObject("http://localhost:8080/incentive", transaction, Incentives.class);


sender.setBalance(sender.getBalance() - transaction.getAmount());
reciepinet.setBalance(reciepinet.getBalance() + transaction.getAmount() + incentives.getAmount());

Transactions transactions = new Transactions(sender, reciepinet, transaction.getAmount(), incentives.getAmount());
userRepository.save(sender);
userRepository.save(reciepinet);
transactionsRepository.save(transactions);
Comment thread src/main/java/com/jpmc/midascore/Service/TransactionService.java
Comment thread src/main/java/com/jpmc/midascore/Service/TransactionService.java
Comment thread src/main/java/com/jpmc/midascore/repository/UserRepository.java
Comment thread src/main/java/com/jpmc/midascore/foundation/Transaction.java
Comment thread src/main/java/com/jpmc/midascore/foundation/Transactions.java
Comment thread pom.xml
Comment thread pom.xml
Comment thread pom.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants