- simplify dlt as much as possible. time is better spent on frontend as per Rashi.
- since we're using api calls & security is out of scope, do we need / want authentication on who can update? how?
- exact status terms are not finalized!
- two flows (proposeTradeTxFlow & updateTradeTxFlow) keeps it simple.
- move bank identities to model?
- S creates a tradeTx proposal
- API request -> {purchase_order_id, seller_id, buyer_id, tx_amount, delivery_date, seller_bank_name, buyer_bank_name}
- API response -> {boolean}
- tradeTx Model (immutable throughout tradeTx lifecycle (enforced via contract)) { purchase_order_id: Int, seller_id: Int, buyer_id: Int, tx_amount: Int, delivery_date: Date }
- tradeTx Output State { tradeTx: Model, sellerBank: Party, buyerBank: Party, status: pendingBuyerApproval, contract: TradeTxContract, actionDate: Date, (records the day this state was created, can be used to look up all dates when tradeTx was updated) linearId: UniqueIdentifier }
- If B doesn't agree to terms -> updates tradeTx status to Rejected (via updateTradeTxFlow & Reject command)
- If B agrees this is a valid tradeTx . . .
- Consumes pendingBuyerApproval state
- Creates new state
- same: tradeTx, sellerBank, buyerBank, contract, linearId
- status -> pendingBbApproval, actionDate -> today
- If BB doesn't agree to terms -> updates tradeTx status to Rejected (via updateTradeTxFlow & Reject command)
- If BB aggrees this is a valid tradeTx . . .
- Consumes pendingBbApproval state
- Creates new state
- same: tradeTx, sellerBank, buyerBank, contract, linearId
- status -> pendingSbApproval, actionDate -> today
-
If SB doesn't agree to terms -> updates tradeTx status to Rejected (via updateTradeTxFlow & Reject command)
-
If SB aggrees this is a valid tradeTx . . .
-
Consumes pendingSbApproval state
-
Creates new state
- same: tradeTx, sellerBank, buyerBank, contract, linearId
- status -> Approved, actionDate -> today
-
At this point, we have 4 parties consensus on an immutable state - tradeTx is a go. tradeTx can no longer be rejected
- API request {/tradeTxId/ready}
- API response {boolean}
- Consumes Approved state
- Creates new state
- same: tradeTx, sellerBank, buyerBank, contract, linearId
- status -> Ready, actionDate -> today
- API request {/tradeTxId/shipped}
- API response {boolean}
- Consumes Ready state
- Creates new state
- same: tradeTx, sellerBank, buyerBank, contract, linearId
- status -> Shipped, actionDate -> today
- API request {/tradeTxId/ready}
- API response {boolean}
- Consumes Shipped state
- Creates new state
- same: tradeTx, sellerBank, buyerBank, contract, linearId
- status -> Received, actionDate -> today
- API request {/tradeTxId/ready}
- API response {boolean}
- Consumes Received state
- Creates new state
- same: tradeTx, sellerBank, buyerBank, contract, linearId
- status -> PaymentSent, actionDate -> today
- API request {/tradeTxId/ready}
- API response {boolean}
- Consumes PaymentSent state
- Creates new state
- same: tradeTx, sellerBank, buyerBank, contract, linearId
- status -> Complete, actionDate -> today
- GET {/tradeTxId/current}
- API response -> returns current tradeTxState for a tradeTx
- GET {/tradeTxId/history}
- API response -> returns history of tradeTxStates for a tradeTx
- GET {/bankName/getBankTrades}
- GET {/smeId/getSmeTrades}