Class Transaction
java.lang.Object
org.episteme.social.economics.money.Transaction
- All Implemented Interfaces:
Serializable, Commented, ComprehensiveIdentification, Identified<Identification>, Named
Represents a financial transaction between two parties.
A transaction records the exchange of money or shares between a seller and buyer, and can generate receipts for both parties.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTransaction(Organization seller, Organization buyer, TimeCoordinate date, Identification id, String description, Money amount) Creates a money transaction.Transaction(Organization seller, Organization buyer, TimeCoordinate date, Identification id, String description, Share share, int quantity) Creates a share transaction. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Marks the transaction as cancelled.voidcomplete()Marks the transaction as completed.booleangetBuyer()getDate()getId()Returns the unique identifier of this entity.intGenerates a receipt for this transaction.getShare()Calculates the total value of a share transaction.Returns the traits map for this entity.inthashCode()booleanReturns true if this is a money transaction.booleanReturns true if this is a share transaction.voidsetStatus(TransactionStatus status) Updates the transaction status.toString()Methods inherited from interface Commented
getComments, getTrait, setCommentsMethods inherited from interface ComprehensiveIdentification
getName, getTrait, setName, setTrait
-
Constructor Details
-
Transaction
public Transaction(Organization seller, Organization buyer, TimeCoordinate date, Identification id, String description, Money amount) Creates a money transaction.- Parameters:
seller- the selling organizationbuyer- the buying organizationdate- the transaction datedescription- transaction descriptionamount- the monetary amountidentification- unique transaction ID
-
-
Method Details
-
getId
Description copied from interface:IdentifiedReturns the unique identifier of this entity.- Specified by:
getIdin interfaceIdentified<Identification>- Returns:
- the identifier
-
getTraits
Description copied from interface:ComprehensiveIdentificationReturns the traits map for this entity.- Specified by:
getTraitsin interfaceCommented- Specified by:
getTraitsin interfaceComprehensiveIdentification- Returns:
- the traits map
-
getSeller
-
getBuyer
-
getDate
-
getIdentification
-
getDescription
-
getAmount
-
getQuantity
public int getQuantity() -
getStatus
-
setStatus
Updates the transaction status.- Parameters:
status- the new status
-
complete
public void complete()Marks the transaction as completed. -
cancel
public void cancel()Marks the transaction as cancelled. -
isMoneyTransaction
public boolean isMoneyTransaction()Returns true if this is a money transaction.- Returns:
- true for money transaction
-
getTotalValue
Calculates the total value of a share transaction.- Returns:
- the total value (share price × quantity)
-
getReceipt
-
equals
-
hashCode
-
toString
-