LoanRequest
FlowLogic.waitForLedgerCommit
@InitiatingFlow
@StartableByRPC
class Initiator(val otherParty: Party) : FlowLogic<SignedTransaction>() {
/**
* The flow logic is encapsulated within the call() method.
*/
@Suspendable
override fun call(): SignedTransaction {
val session = initiateFlow(otherParty)
val fullySignedTx: SignedTransaction = TODO("Build fully signed transaction.")
subFlow(FinalityFlow(fullySignedTx))
session.send(fullySignedTx.id)
}
}
@InitiatedBy(Initiator::class)
class Acceptor(val session: FlowSession) : FlowLogic<SignedTransaction>() {
@Suspendable
override fun call(): SignedTransaction {
TODO("Response logic for building fully signed transaction.")
val txId = session.receive<SecureHash>().unwrap { secureHash -> secureHash }
waitForLedgerCommit(txId)
val approve: Boolean = TODO("Make HTTP call to decide whether to approve or reject.")
if (approve) {
TODO("Response logic for building approval transaction.")
} else {
TODO("Response logic for building rejection transaction.")
}
}
}