[Huawei Developers] Freemind R:
This is originally from HUAWEI Developer Forum

Forum link: https://forums.developer.huawei.com/forumPortal/en/home​

Introduction

HUAWEI Wallet Kit providing users to claim passes of merchants, like loyalty cards, gift cards, coupons, boarding passes, event tickets, and transit passes. It provides easy-to-access digital passes on an integrated platform. It enables user save their cards into mobile phones for convenient. The interaction between apps and users via location based notifications.

Integration Process.

The Wallet Kit integration process consists following steps

1. Generating Public and Private Keys

2. Adding Pass type on the AGC

3. Running the Server Demo code

4. Running the Client Demo code

5. View card adding status

Step-1: Check Below Link to generate keys & App Configuration in AGC:

LINK: https://forums.developer.huawei.com...d=0201242460338530108&fid=0101187876626530001

· Let’s see how to apply new wallet.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521080157.84356147443958530110998952283648:50510603024859:2800:F4B1289C127074A875AEEB100A86E50E6AEAD6A1D02E5AC008355829933B9EB6.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521080157.84356147443958530110998952283648:50510603024859:2800:F4B1289C127074A875AEEB100A86E50E6AEAD6A1D02E5AC008355829933B9EB6.png[/IMG]

· Now will see how to create Flight ticket.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521080319.67144521110777169643436989585313:50510603024859:2800:CED9FC39B8F4A94D5DD5E733303939C56399D993AC834D6A49E1CC42576CC5BC.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521080319.67144521110777169643436989585313:50510603024859:2800:CED9FC39B8F4A94D5DD5E733303939C56399D993AC834D6A49E1CC42576CC5BC.png[/IMG]

· Service type consists 3 types

1. Card

2. Coupon

3. Ticket

· Service item will change based on service type

· Service name should be Unique

· Service Id should be unique it will start will always hwpass

· Public key we need to get it from RSAUtils

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521080608.41758401203045475902240806321279:50510603024859:2800:F2DEFD9BC1081FA1AB465FDE421327486D1CEF64BB9F01DE92772B6B3FC511EC.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521080608.41758401203045475902240806321279:50510603024859:2800:F2DEFD9BC1081FA1AB465FDE421327486D1CEF64BB9F01DE92772B6B3FC511EC.png[/IMG]

· Click next button and save details. The service application procedure is now complete. After applying for the service, you can view, edit, and delete it on the HUAWEI Wallet Kit service application page

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521080647.37951481727626593751547545091795:50510603024859:2800:1AAF6C13001F00EFB0A0C3A472E8108F021178E37D4A44B3D6BC25B0FA58CBDD.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521080647.37951481727626593751547545091795:50510603024859:2800:1AAF6C13001F00EFB0A0C3A472E8108F021178E37D4A44B3D6BC25B0FA58CBDD.png[/IMG]

Step-2: Server Side Integration:

Download server demo code check below link.

Link: https://developer.huawei.com/consumer/en/doc/development/HMS-Examples/wallet-sample-code

1. Download maven dependency.

2. Configure your project into IntelliJ IDEA

3. Download required dependencies and import

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070327.58323429159297252065231169130545:50510603024859:2800:B169AF99952DA5B66407EAF2EC545C4063D49F9E9AC6232B2C7F1119A364C357.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070327.58323429159297252065231169130545:50510603024859:2800:B169AF99952DA5B66407EAF2EC545C4063D49F9E9AC6232B2C7F1119A364C357.png[/IMG]

4. Sync your project

5. Open release.config.properties and replace appId & secret Key

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070345.87357842125739539833814955168622:50510603024859:2800:EF6A2EA6D7D3F995EC10B53C4A0AFAC600FEE82AD4C6A507FE915ACB584F78CC.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070345.87357842125739539833814955168622:50510603024859:2800:EF6A2EA6D7D3F995EC10B53C4A0AFAC600FEE82AD4C6A507FE915ACB584F78CC.png[/IMG]

6. Compile project using terminal mvn clean compile

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070438.05325946076329490168677626961691:50510603024859:2800:9CB3E3F4BE4ECCB33E482CCB8B95487EE21FC18B6D6371C4FEE67AE543D5A849.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070438.05325946076329490168677626961691:50510603024859:2800:9CB3E3F4BE4ECCB33E482CCB8B95487EE21FC18B6D6371C4FEE67AE543D5A849.png[/IMG]

7. After completion of compilation automatically Target folder will generate

Follow below steps

Copy hmspass folder in the config directory, paste into the target/classes directory.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070501.82312125167920230297223882911296:50510603024859:2800:54157FF16E2A731EC0A5B3962D599CA193494010401EC17E7B653EE8497411CF.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070501.82312125167920230297223882911296:50510603024859:2800:54157FF16E2A731EC0A5B3962D599CA193494010401EC17E7B653EE8497411CF.png[/IMG]

You can run the source code, you can run mainly java files in the Test folder.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070528.62044324870785558593984666223962:50510603024859:2800:63A3C74305E1004282F025287BF97C0250D565BF2A78DB71E64A6F6EBF38D0F4.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070528.62044324870785558593984666223962:50510603024859:2800:63A3C74305E1004282F025287BF97C0250D565BF2A78DB71E64A6F6EBF38D0F4.png[/IMG]

Check below steps and modify accordingly.

· The file ends with ModelTest provides the examples of adding, modifying and pass models.

· The file name ends with InstanceTest provides the examples of adding, modifying and pass instances.

Step-3: Generate Pass Model:

· Open FlightModel.json file

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070554.72271934531176928198903782847432:50510603024859:2800:892BE42647BD4B8F73912D4AC59219C9704168749EBE21AD7CC6610D28C83CFF.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/767/951/2640091000001767951.20200521070554.72271934531176928198903782847432:50510603024859:2800:892BE42647BD4B8F73912D4AC59219C9704168749EBE21AD7CC6610D28C83CFF.png[/IMG]

· PassTypeIdentifier is unique which you mentioned service Id in AGC both needs to match

· You have to modify passTypeIdentifier and passStyleIdentifier when we add card types on the AGC PassStyleIdentifier field is unique.

· After completion of modify execute createFlightModel()

· Open the HwFlightModelTest file and Run CreateFlightModel() method

Test
public void createFlightModel() {
System.out.println("createFlightModel begin");

// Read an example flight model from a JSON file.
String objectJson = CommonUtil.readWalletObject("FlightModel.json");
HwWalletObject hwWalletObject = JSONObject.parseObject(objectJson, HwWalletObject.class);
String modelId = hwWalletObject.getPassStyleIdentifier();
System.out.println("modelId is: " + modelId);
String instanceId = hwWalletObject.getSerialNumber();

// Set parameters of the flight model you want to create. Flight instances belong to this model share these
// parameters.
WalletBuildService walletBuildService = new WalletBuildServiceImpl();
HwWalletObject requestData = walletBuildService.createHwWalletObject(objectJson, instanceId, modelId);

// Validate the parameters.
boolean validateModel = HwWalletObjectUtil.validateWalletModel(requestData);
if (validateModel) {
// Post the new flight model to the wallet server.
String urlParameter = "flight/model";
HwWalletObject flightModel = walletBuildService.postHwWalletObjectToWalletServer(urlParameter, requestData);
System.out.println("createFlightModel JSON is: " + CommonUtil.toJson(flightModel));
System.out.println("createFlightModel end");
}
}

This is not all. For full content, you can visit https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201254289105300220&fid=0101187876626530001