1e41f4b71Sopenharmony_ci# Starting a Financial Application
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThis topic describes how to open the vertical domain panel of financial applications.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci## Parameters on the Financial Application Panel
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciIf the **type** field in **startAbilityByType** is set to **finance**, **wantParam** contains the following properties.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci| Name            | Description                                                        | Data Type| Mandatory|
10e41f4b71Sopenharmony_ci| -------------------- | ------------------------------------------------------------ | -------- | -------- |
11e41f4b71Sopenharmony_ci| sceneType            | The options are as follows: 1: transfer; 2: credit card repayment.                               | number   | No. When this parameter is left unspecified, the default value **1** is used.  |
12e41f4b71Sopenharmony_ci| bankCardNo      | Bank card number.                                                    | string   | No  |
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci## Developing a Caller Application
15e41f4b71Sopenharmony_ci1. Import the **ohos.app.ability.common** module.
16e41f4b71Sopenharmony_ci    ```ts
17e41f4b71Sopenharmony_ci    import { common } from '@kit.AbilityKit';
18e41f4b71Sopenharmony_ci    ```
19e41f4b71Sopenharmony_ci2. Construct parameters and call the **startAbilityByType** API.
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci    ```ts
22e41f4b71Sopenharmony_ci    let context = getContext(this) as common.UIAbilityContext;
23e41f4b71Sopenharmony_ci    let wantParam: Record<string, Object> = {
24e41f4b71Sopenharmony_ci      'sceneType': 1,
25e41f4b71Sopenharmony_ci      "bankCardNo": '123456789'
26e41f4b71Sopenharmony_ci    };
27e41f4b71Sopenharmony_ci    let abilityStartCallback: common.AbilityStartCallback = {
28e41f4b71Sopenharmony_ci      onError: (code: number, name: string, message: string) => {
29e41f4b71Sopenharmony_ci        console.log(`onError code ${code} name: ${name} message: ${message}`);
30e41f4b71Sopenharmony_ci      },
31e41f4b71Sopenharmony_ci      onResult: (result)=>{
32e41f4b71Sopenharmony_ci        console.log(`onResult result: ${JSON.stringify(result)}`);
33e41f4b71Sopenharmony_ci      }
34e41f4b71Sopenharmony_ci    }
35e41f4b71Sopenharmony_ci    
36e41f4b71Sopenharmony_ci    context.startAbilityByType("finance", wantParam, abilityStartCallback, 
37e41f4b71Sopenharmony_ci        (err) => {
38e41f4b71Sopenharmony_ci            if (err) {
39e41f4b71Sopenharmony_ci                console.error(`startAbilityByType fail, err: ${JSON.stringify(err)}`);
40e41f4b71Sopenharmony_ci            } else {
41e41f4b71Sopenharmony_ci                console.log(`success`);
42e41f4b71Sopenharmony_ci            }
43e41f4b71Sopenharmony_ci    });
44e41f4b71Sopenharmony_ci    ```
45e41f4b71Sopenharmony_ci    Effect
46e41f4b71Sopenharmony_ci    
47e41f4b71Sopenharmony_ci    ![Effect example](./figures/start-finance-panel.png)
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci## Developing a Target Application
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci1. Configure [uris](../quick-start/module-configuration-file.md#skills) in the **module.json5** file.
52e41f4b71Sopenharmony_ci   1. Set the **linkFeature** field to declare the features supported by the application so that the system can match the application against all the installed applications on the device. The options are as follows:
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci        | Value          | Description                        |
55e41f4b71Sopenharmony_ci        | -------------- | ---------------------------- |
56e41f4b71Sopenharmony_ci        | Transfer     | The application supports transfer.		|
57e41f4b71Sopenharmony_ci        | CreditCardRepayment      | The application supports credit card repayment.	|
58e41f4b71Sopenharmony_ci   2. Set **scheme**, **host**, **port**, and **path** or **pathStartWith** to match the URIs in Want to distinguish different features.
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ci    ```json
61e41f4b71Sopenharmony_ci    {
62e41f4b71Sopenharmony_ci      "abilities": [
63e41f4b71Sopenharmony_ci          {
64e41f4b71Sopenharmony_ci          "skills": [
65e41f4b71Sopenharmony_ci              {
66e41f4b71Sopenharmony_ci              "uris": [
67e41f4b71Sopenharmony_ci                  {
68e41f4b71Sopenharmony_ci                  "scheme": "finance", // It is for reference only. Ensure that the declared URI can be started by external systems.
69e41f4b71Sopenharmony_ci                  "host": "transfer",
70e41f4b71Sopenharmony_ci                  "path": "",
71e41f4b71Sopenharmony_ci                  "linkFeature": "Transfer" // Declare that the application supports transfer.
72e41f4b71Sopenharmony_ci                  },
73e41f4b71Sopenharmony_ci                  {
74e41f4b71Sopenharmony_ci                  "scheme": "finance", // It is for reference only. Ensure that the declared URI can be started by external systems.
75e41f4b71Sopenharmony_ci                  "host": "credit_card_repayment",
76e41f4b71Sopenharmony_ci                  "path": "",
77e41f4b71Sopenharmony_ci                  "linkFeature": "CreditCardRepayment" // Declare that the application supports credit card repayment.
78e41f4b71Sopenharmony_ci                  }
79e41f4b71Sopenharmony_ci              ]
80e41f4b71Sopenharmony_ci              }
81e41f4b71Sopenharmony_ci          ]
82e41f4b71Sopenharmony_ci          }
83e41f4b71Sopenharmony_ci      ]
84e41f4b71Sopenharmony_ci    }
85e41f4b71Sopenharmony_ci    ```
86e41f4b71Sopenharmony_ci   
87e41f4b71Sopenharmony_ci2. Parse and process the parameters transferred from the panel.
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci    ```ts
90e41f4b71Sopenharmony_ci    UIAbility::onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void
91e41f4b71Sopenharmony_ci    ```
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci    The **want.uri** parameter carries the URI corresponding to **linkFeature** configured by the target application.
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci    The **want.parameters** parameter carries the parameters transferred by the caller application, as described in the table below.
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ci    | Name            | Description                                                        | Data Type| Mandatory|
98e41f4b71Sopenharmony_ci    | -------------------- | ------------------------------------------------------------ | -------- | -------- |
99e41f4b71Sopenharmony_ci    | bankCardNo  | Bank card number.                                                    | string   | No|
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci    The application can develop different style pages based on the features defined in [linkFeature](../quick-start/module-configuration-file.md#skills), such as transfer and credit card repayment, as well as the received URI.
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci**Sample Code**
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci```ts
106e41f4b71Sopenharmony_ciimport { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
107e41f4b71Sopenharmony_ciimport { hilog } from '@kit.PerformanceAnalysisKit';
108e41f4b71Sopenharmony_ciimport { window } from '@kit.ArkUI';
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ciconst TAG = 'EntryAbility'
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_ciexport default class EntryAbility extends UIAbility {
113e41f4b71Sopenharmony_ci    windowStage: window.WindowStage | null = null;
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci    uri?: string;
116e41f4b71Sopenharmony_ci    bankCardNo?: string;
117e41f4b71Sopenharmony_ci
118e41f4b71Sopenharmony_ci    onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
119e41f4b71Sopenharmony_ci        hilog.info(0x0000, TAG, `onCreate, want=${JSON.stringify(want)}`);
120e41f4b71Sopenharmony_ci        super.onCreate(want, launchParam);
121e41f4b71Sopenharmony_ci        this.parseWant(want);
122e41f4b71Sopenharmony_ci    }
123e41f4b71Sopenharmony_ci
124e41f4b71Sopenharmony_ci    onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
125e41f4b71Sopenharmony_ci        hilog.info(0x0000, TAG, `onNewWant, want=${JSON.stringify(want)}`);
126e41f4b71Sopenharmony_ci        super.onNewWant(want, launchParam);
127e41f4b71Sopenharmony_ci        this.parseWant(want);
128e41f4b71Sopenharmony_ci        if (!this.windowStage) {
129e41f4b71Sopenharmony_ci            hilog.error(0x0000, TAG, 'windowStage is null');
130e41f4b71Sopenharmony_ci            this.context.terminateSelf();
131e41f4b71Sopenharmony_ci            return;
132e41f4b71Sopenharmony_ci        }
133e41f4b71Sopenharmony_ci        this.loadPage(this.windowStage);
134e41f4b71Sopenharmony_ci    }
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ci    private parseWant(want: Want): void {
137e41f4b71Sopenharmony_ci        this.uri = want.uri as string | undefined;
138e41f4b71Sopenharmony_ci        this.bankCardNo = want.parameters?.bankCardNo as string | undefined;
139e41f4b71Sopenharmony_ci    }
140e41f4b71Sopenharmony_ci
141e41f4b71Sopenharmony_ci    private loadPage(windowStage: window.WindowStage): void {
142e41f4b71Sopenharmony_ci        hilog.info(0x0000, TAG, `loadPage, uri=${this.uri}`);
143e41f4b71Sopenharmony_ci        if (this.uri === 'finance://transfer') {
144e41f4b71Sopenharmony_ci            // Construct parameters for the transfer scenario.
145e41f4b71Sopenharmony_ci            const storage: LocalStorage = new LocalStorage({
146e41f4b71Sopenharmony_ci                "bankCardNo": this.bankCardNo
147e41f4b71Sopenharmony_ci            } as Record<string, Object>);
148e41f4b71Sopenharmony_ci            // Open the transfer page.
149e41f4b71Sopenharmony_ci            windowStage.loadContent('pages/TransferPage', storage)
150e41f4b71Sopenharmony_ci        } else if (this.uri === 'finance://credit_card_repayment') {
151e41f4b71Sopenharmony_ci            // Construct parameters for the credit card repayment scenario.
152e41f4b71Sopenharmony_ci            const storage: LocalStorage = new LocalStorage({
153e41f4b71Sopenharmony_ci                "bankCardNo": this.bankCardNo
154e41f4b71Sopenharmony_ci            } as Record<string, Object>);
155e41f4b71Sopenharmony_ci            // Open the credit card repayment page.
156e41f4b71Sopenharmony_ci            windowStage.loadContent('pages/CreditCardRepaymentPage', storage)
157e41f4b71Sopenharmony_ci        } else {
158e41f4b71Sopenharmony_ci            // Display the home page by default.
159e41f4b71Sopenharmony_ci            windowStage.loadContent('pages/Index', (err) => {
160e41f4b71Sopenharmony_ci                if (err.code) {
161e41f4b71Sopenharmony_ci                    hilog.error(0x0000, TAG, 'Failed to load the content. Cause: %{public}s',
162e41f4b71Sopenharmony_ci                        JSON.stringify(err) ?? '');
163e41f4b71Sopenharmony_ci                    return;
164e41f4b71Sopenharmony_ci                }
165e41f4b71Sopenharmony_ci                hilog.info(0x0000, TAG, 'Succeeded in loading the content.');
166e41f4b71Sopenharmony_ci            });
167e41f4b71Sopenharmony_ci        }
168e41f4b71Sopenharmony_ci    }
169e41f4b71Sopenharmony_ci
170e41f4b71Sopenharmony_ci    onDestroy(): void {
171e41f4b71Sopenharmony_ci        hilog.info(0x0000, TAG, `onDestroy`);
172e41f4b71Sopenharmony_ci    }
173e41f4b71Sopenharmony_ci
174e41f4b71Sopenharmony_ci    onWindowStageCreate(windowStage: window.WindowStage): void {
175e41f4b71Sopenharmony_ci        hilog.info(0x0000, TAG, `onWindowStageCreate`);
176e41f4b71Sopenharmony_ci        this.windowStage = windowStage;
177e41f4b71Sopenharmony_ci        this.loadPage(this.windowStage);
178e41f4b71Sopenharmony_ci    }
179e41f4b71Sopenharmony_ci
180e41f4b71Sopenharmony_ci    onWindowStageDestroy(): void {
181e41f4b71Sopenharmony_ci        hilog.info(0x0000, TAG, '%{public}s', 'Ability onWindowStageDestroy');
182e41f4b71Sopenharmony_ci    }
183e41f4b71Sopenharmony_ci
184e41f4b71Sopenharmony_ci    onForeground(): void {
185e41f4b71Sopenharmony_ci        hilog.info(0x0000, TAG, '%{public}s', 'Ability onForeground');
186e41f4b71Sopenharmony_ci    }
187e41f4b71Sopenharmony_ci
188e41f4b71Sopenharmony_ci    onBackground(): void {
189e41f4b71Sopenharmony_ci        hilog.info(0x0000, TAG, '%{public}s', 'Ability onBackground');
190e41f4b71Sopenharmony_ci    }
191e41f4b71Sopenharmony_ci}
192e41f4b71Sopenharmony_ci```
193