craterdog.accounting.Accounting Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-digital-accounting Show documentation
Show all versions of java-digital-accounting Show documentation
This project defines a set of interfaces and classes that implement digital accounting.
/************************************************************************
* Copyright (c) Crater Dog Technologies(TM). All Rights Reserved. *
************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. *
* *
* This code is free software; you can redistribute it and/or modify it *
* under the terms of The MIT License (MIT), as published by the Open *
* Source Initiative. (See http://opensource.org/licenses/MIT) *
************************************************************************/
package craterdog.accounting;
import craterdog.notary.NotaryCertificate;
import craterdog.notary.NotaryKey;
import craterdog.tokens.DigitalToken;
import java.net.URI;
import java.util.List;
import java.util.Map;
/**
* This interface defines the methods that must be implemented by all digital accounting providers.
*
* @author Derk Norton
*/
public interface Accounting {
/**
* This method initiates a digital transaction to pass a digital token from one account (the
* sender) to another account (the receiver).
*
* @param transactionLocation The location of the transaction.
* @param senderLocation The location of the sender account.
* @param receiverLocation The location of the receiver account.
* @param transactionType The type of the transaction.
* @param token The token on which the transaction is acting.
* @param senderKey The private notary key for the sender's account.
* @return The newly initiated digital transaction.
*/
DigitalTransaction initiateTransaction(URI transactionLocation, URI senderLocation, URI receiverLocation, String transactionType, DigitalToken token, NotaryKey senderKey);
/**
* This method initiates a digital transaction to pass a digital token from one account (the
* sender) to another account (the receiver).
*
* @param transactionLocation The location of the transaction.
* @param senderLocation The location of the sender account.
* @param receiverLocation The location of the receiver account.
* @param transactionType The type of the transaction.
* @param token The token on which the transaction is acting.
* @param additionalAttributes Any additional attributes about the transaction.
* @param senderKey The private notary key for the sender's account.
* @return The newly initiated digital transaction.
*/
DigitalTransaction initiateTransaction(URI transactionLocation, URI senderLocation, URI receiverLocation, String transactionType, DigitalToken token, Map additionalAttributes, NotaryKey senderKey);
/**
* This method initiates a digital transaction to pass a digital token from one account (the
* sender) to another account (the receiver) with the help of an escrow account.
*
* @param transactionLocation The location of the transaction.
* @param senderLocation The location of the sender account.
* @param receiverLocation The location of the receiver account.
* @param escrowLocation The location of the escrow account.
* @param transactionType The type of the transaction.
* @param token The token on which the transaction is acting.
* @param senderKey The private notary key for the sender's account.
* @return The newly initiated digital transaction.
*/
DigitalTransaction initiateTransaction(URI transactionLocation, URI senderLocation, URI receiverLocation, URI escrowLocation, String transactionType, DigitalToken token, NotaryKey senderKey);
/**
* This method initiates a digital transaction to pass a digital token from one account (the
* sender) to another account (the receiver) with the help of an escrow account.
*
* @param transactionLocation The location of the transaction.
* @param senderLocation The location of the sender account.
* @param receiverLocation The location of the receiver account.
* @param escrowLocation The location of the escrow account.
* @param transactionType The type of the transaction.
* @param token The token on which the transaction is acting.
* @param additionalAttributes Any additional attributes about the transaction.
* @param senderKey The private notary key for the sender's account.
* @return The newly initiated digital transaction.
*/
DigitalTransaction initiateTransaction(URI transactionLocation, URI senderLocation, URI receiverLocation, URI escrowLocation, String transactionType, DigitalToken token, Map additionalAttributes, NotaryKey senderKey);
/**
* This method allows a receiver account to approve a digital transaction that was initiated
* by a sender account.
*
* @param transaction The initiated digital transaction.
* @param token The digital token on which the transaction is acting.
* @param senderCertificate The public verification certificate of the sender account.
* @param receiverKey The private notary key of the receiver account.
*/
void approveTransaction(DigitalTransaction transaction, DigitalToken token, NotaryCertificate senderCertificate, NotaryKey receiverKey);
/**
* This method allows an escrow account to certify a digital transaction that was approved
* by a receiver account.
*
* @param transaction The approved digital transaction.
* @param token The digital token on which the transaction is acting.
* @param senderCertificate The public verification certificate of the sender account.
* @param receiverCertificate The public verification certificate of the receiver account.
* @param escrowKey The private notary key of the escrow account.
*/
void certifyTransaction(DigitalTransaction transaction, DigitalToken token, NotaryCertificate senderCertificate, NotaryCertificate receiverCertificate, NotaryKey escrowKey);
/**
* This method checks to see whether or not a digital transaction is valid.
*
* @param transaction The digital transaction to be validated.
* @param token The digital token on which the transaction is acting.
* @param guarantorCertificate The public verification certificate of the guarantor account.
* @param accountantCertificate The public verification certificate of the accountant account.
* @param senderCertificate The public verification certificate of the sender account.
* @param receiverCertificate The public verification certificate of the receiver account.
* @param errors A map containing any errors that were found.
*/
void validateTransaction(DigitalTransaction transaction, DigitalToken token, NotaryCertificate guarantorCertificate, NotaryCertificate accountantCertificate, NotaryCertificate senderCertificate, NotaryCertificate receiverCertificate, Map errors);
/**
* This method checks to see whether or not a digital transaction is valid.
*
* @param transaction The digital transaction to be validated.
* @param token The digital token on which the transaction is acting.
* @param guarantorCertificate The public verification certificate of the guarantor account.
* @param accountantCertificate The public verification certificate of the accountant account.
* @param senderCertificate The public verification certificate of the sender account.
* @param receiverCertificate The public verification certificate of the receiver account.
* @param escrowCertificate The public verification certificate of the escrow account.
* @param errors A map containing any errors that were found.
*/
void validateTransaction(DigitalTransaction transaction, DigitalToken token, NotaryCertificate guarantorCertificate, NotaryCertificate accountantCertificate, NotaryCertificate senderCertificate, NotaryCertificate receiverCertificate, NotaryCertificate escrowCertificate, Map errors);
/**
* This method creates a new digital ledger associated with the specified channel (e.g.
* identity, token, etc.).
*
* @param ledgerLocation The location of the new ledger.
* @param channelType The type of channel the ledger is associated with.
* @param channelLocation The location of the channel.
* @param accountantKey The private notary key of the accountant.
* @return The newly created digital ledger.
*/
DigitalLedger createLedger(URI ledgerLocation, String channelType, URI channelLocation, NotaryKey accountantKey);
/**
* This method creates a new digital ledger associated with the specified channel (e.g.
* identity, token, etc.).
*
* @param ledgerLocation The location of the new ledger.
* @param channelType The type of channel the ledger is associated with.
* @param channelLocation The location of the channel.
* @param additionalAttributes Any additional attributes about the ledger.
* @param accountantKey The private notary key of the accountant.
* @return The newly created digital ledger.
*/
DigitalLedger createLedger(URI ledgerLocation, String channelType, URI channelLocation, Map additionalAttributes, NotaryKey accountantKey);
/**
* This method creates a new ledger entry in the specified ledger for the specified transaction.
*
* @param entryLocation The location of the new ledger entry.
* @param ledger The digital ledger.
* @param transaction The digital transaction.
* @param accountantKey The private notary key of the accountant.
* @return The newly created digital ledger entry.
*/
LedgerEntry createLedgerEntry(URI entryLocation, DigitalLedger ledger, DigitalTransaction transaction, NotaryKey accountantKey);
/**
* This method creates a new ledger entry in the specified ledger for the specified transaction.
*
* @param entryLocation The location of the new ledger entry.
* @param ledger The digital ledger.
* @param transaction The digital transaction.
* @param additionalAttributes Any additional attributes about the ledger entry.
* @param accountantKey The private notary key of the accountant.
* @return The newly created digital ledger entry.
*/
LedgerEntry createLedgerEntry(URI entryLocation, DigitalLedger ledger, DigitalTransaction transaction, Map additionalAttributes, NotaryKey accountantKey);
/**
* This method creates a new ledger entry in the specified ledger for the specified transaction.
*
* @param entryLocation The location of the new ledger entry.
* @param ledger The digital ledger.
* @param transaction The digital transaction.
* @param previousEntry The previous entry in the ledger.
* @param accountantKey The private notary key of the accountant.
* @return The newly created digital ledger entry.
*/
LedgerEntry createLedgerEntry(URI entryLocation, DigitalLedger ledger, DigitalTransaction transaction, LedgerEntry previousEntry, NotaryKey accountantKey);
/**
* This method creates a new ledger entry in the specified ledger for the specified transaction.
*
* @param entryLocation The location of the new ledger entry.
* @param ledger The digital ledger.
* @param transaction The digital transaction.
* @param previousEntry The previous entry in the ledger.
* @param additionalAttributes Any additional attributes about the ledger entry.
* @param accountantKey The private notary key of the accountant.
* @return The newly created digital ledger entry.
*/
LedgerEntry createLedgerEntry(URI entryLocation, DigitalLedger ledger, DigitalTransaction transaction, LedgerEntry previousEntry, Map additionalAttributes, NotaryKey accountantKey);
/**
* This method validates a digital ledger and all its entries.
*
* @param ledger The digital ledger.
* @param entries The list of ledger entries for this ledger.
* @param transactions The list of transactions referenced by the ledger entries.
* @param accountantCertificate The public verification certificate of the accountant account.
* @param errors A map containing any errors that were found.
*/
void validateLedger(DigitalLedger ledger, List entries, List transactions, NotaryCertificate accountantCertificate, Map errors);
}