Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
HarmonyOS
This module provides the invoice assistant capability of Account Kit.
Since: 5.0.0(12)
- import { invoiceAssistant } from '@kit.AccountKit';
Enumeration that defines error codes of APIs related to the invoice assistant service of Account Kit.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
System capability: SystemCapability.HuaweiID.InvoiceAssistant
Since: 5.0.0(12)
| Name | Value | Description |
|---|---|---|
| USER_CANCELED | 1010060001 | The user cancels the invoice assistant service. |
| SYSTEM_ERROR | 1010060002 | Internal system error. |
| APP_NOT_AUTHORIZED | 1010060003 | The certificate fingerprint of the app fails to be verified. |
| FREQUENT_CALLS | 1010060004 | The API is called too frequently. |
| NETWORK_ERROR | 1010060005 | Network connection error. |
| ACCOUNT_NOT_LOGGED_IN | 1010060006 | The user has not signed in with their HUAWEI ID. |
| INVOICE_TITLE_EXISTS | 1010060007 | The invoice title already exists. |
| UNSUPPORTED | 1010060008 | The invoice assistant service is unavailable for the HUAWEI ID signed in. |
Invoice title data object returned by the invoice assistant service.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
System capability: SystemCapability.HuaweiID.InvoiceAssistant
Since: 5.0.0(12)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| type | string | No | No | Title type. The options are 0 (individual) and 1 (enterprise). |
| title | string | No | No | Title name. |
| taxNumber | string | No | No | Taxpayer identification number. For a title of the enterprise type, the actual value is returned. For a title of the individual type, an empty string is returned. |
| companyAddress | string | No | No | Company address. For a title of the enterprise type, the actual value is returned. For a title of the individual type, an empty string is returned. |
| telephone | string | No | No | Phone number of a company. For a title of the enterprise type, the actual value is returned. For a title of the individual type, an empty string is returned. |
| bankName | string | No | No | Bank name of a company. For a title of the enterprise type, the actual value is returned. For a title of the individual type, an empty string is returned. |
| bankAccount | string | No | No | Bank account of a company. For a title of the enterprise type, the actual value is returned. For a title of the individual type, an empty string is returned. |
selectInvoiceTitle(context: common.Context): Promise<InvoiceTitle>
Shows the invoice title selection screen and returns the invoice title selected by a user. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since API version 5.0.0(12).
System capability: SystemCapability.HuaweiID.InvoiceAssistant
Since: 5.0.0(12)
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| context | common.Context | Yes | Context. The following contexts are supported for apps: UIAbilityContext and UIExtensionContext. Apps cannot use UIExtensionContext in non-full-screen components such as semi-modal, pop-up, and sub-window components. The following context is supported for atomic services: UIAbilityContext. |
Returns:
| Type | Description |
|---|---|
| Promise<InvoiceTitle> | InvoiceTitle object returned through a promise. |
Error codes:
For details about the error codes, please refer to ArkTS Error Codes.
| ID | Error Message |
|---|---|
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
| 1010060001 | The operation was canceled by the user. |
| 1010060002 | System internal error. |
| 1010060003 | Failed to check the fingerprint of the app bundle. |
| 1010060004 | Too frequent API calls. |
| 1010060005 | Network connection error. |
| 1010060006 | The HUAWEI ID is not signed in. |
| 1010060007 | Failed to create a invoice title because the title already exists. |
| 1010060008 | The invoice service does not support the logged HUAWEI ID. |
Example:
- import { invoiceAssistant } from '@kit.AccountKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
- import { BusinessError } from '@kit.BasicServicesKit';
-
- // Execute the request.
- if (canIUse('SystemCapability.HuaweiID.InvoiceAssistant')) {
- try {
- // The following provides only code snippets. Use it in the custom component instance and pass a valid context object.
- invoiceAssistant.selectInvoiceTitle(this.getUIContext().getHostContext())
- .then((data: invoiceAssistant.InvoiceTitle) => {
- hilog.info(0x0000, 'testTag', 'Succeeded in selecting invoice title');
- const type: string = data.type;
- const title: string = data.title;
- const taxNumber: string = data.taxNumber;
- const companyAddress: string = data.companyAddress;
- const telephone: string = data.telephone;
- const bankName: string = data.bankName;
- const bankAccount: string = data.bankAccount;
-
- // Process type, title, taxNumber, companyAddress, telephone, bankName, and bankAccount.
- // ...
-
- })
- .catch((error: BusinessError<Object>) => {
- dealAllError(error);
- });
- } catch (error) {
- dealAllError(error);
- }
- } else {
- hilog.info(0x0000, 'testTag',
- 'The current device does not support the invoking of the selectInvoiceTitle interface.');
- }
-
- // Handle the error.
- function dealAllError(error: BusinessError<Object>): void {
- hilog.error(0x0000, 'testTag', `Failed to authorize. Code: ${error.code}, message: ${error.message}`);
- }
Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
Quick start
Helps you find desired resources with ease.