Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expired Contract Microservice #7

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

cassidyxu
Copy link

@cassidyxu cassidyxu commented Nov 17, 2024

Overview

Implements a microservice that processes expired contracts in the database. The microservice identifies expired contracts, determines if they qualify as a "hit," pays out their value to users, and marks them as archived.

Changes Made

Application.java

  • Added a scheduled task to periodically check the contracts database for expired contracts.
  • Logic to identify expired contracts based on expiration time and ensure they are not already marked as expired.
  • Abstracted logic for identifying if a contract qualifies as a hit
  • Implemented payout functionality to credit the contract value to the owner's balance if the contract qualifies as a hit
  • Archived processed contracts by marking them as expired.

Contract.java

  • added expired, expirationTime properties

ContractFactory.java

  • updated fields to match new Contract model

Test Coverage

Created unit tests to verify the following:

  • Tested the scheduled task to ensure expired contracts are processed correctly.
  • Verified payouts to users for contracts marked as hits.
  • Confirmed contracts are marked as expired after processing.
  • Checked that contracts not meeting the criteria remain unaffected.

Copy link
Collaborator

@Aayush-Agnihotri Aayush-Agnihotri left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants