Implementing the business transaction function
We learned how to implement a transaction function in the previous section by reviewing SampleTransaction
. Following a similar approach, we will implement an insurance claim transaction function. Rename sample.js
to logic.js
.
Implement the Init
function, as follows:
Init() function is used to register insuree person information. /** * Create the insuree * @param {com.packt.quickstart.claim.Init} initalAppliation - the InitialApplication transaction * @transaction */ async function Init(application) { // eslint-disable-line no-unused-vars const factory = getFactory(); const namespace = 'com.packt.quickstart.claim'; const insuree = factory.newResource(namespace, 'Insuree', application.insureeId); insuree.firstName = application.firstName;; insuree.lastName = application.lastName insuree.ssn = application.ssn;; insuree.policyNumber = application.policyNumber;; const participantRegistry = await getParticipantRegistry...