Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Blockchain Quick Start Guide

You're reading from  Blockchain Quick Start Guide

Product type Book
Published in Dec 2018
Publisher Packt
ISBN-13 9781789807974
Pages 222 pages
Edition 1st Edition
Languages
Concepts
Authors (2):
Xun (Brian) Wu Xun (Brian) Wu
Profile icon Xun (Brian) Wu
Weimin Sun Weimin Sun
Profile icon Weimin Sun
View More author details

Table of Contents (14) Chapters

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...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}