目录

Querying Functions Supported by HUAWEI Wallet

Function

Queries the functions supported by HUAWEI Wallet based on its version, the device model, and ROM version.

Scenario

This API is used to query the functions, such as the access card and transit pass, supported by HUAWEI Wallet. Before calling the API, your server needs to obtain the device model, ROM version, and HUAWEI Wallet version from the device. The API returns a list of functions and flags indicating whether the functions are supported.

Restrictions

You need to create an app in AppGallery Connect.

Prototype

Protocol

HTTPS GET

Direction

Developer server -> Huawei server

URL

{gatewayUrl}/hmspass/v1/{terminal}/{romVersion}/{clientVersion}

Set the {gatewayUrl} variable based on the region where your server is located. For details, please refer to Wallet Gateway Server Addresses.

Data Format

Request: Content-Type: application/json

Response: Content-Type: application/json

URL Parameters

Parameter

Mandatory/Optional

Type

Description

terminal

Mandatory

String(64)

Device model.

romVersion

Mandatory

String(128)

Device ROM version.

clientVersion

Mandatory

String(64)

Version of the HUAWEI Wallet app, which can be obtained based on the app package name com.huawei.wallet.

Request Parameters

Request Header

Parameter

Mandatory/Optional

Type

Description

Authorization

Mandatory

String

Authorization code. For details about how to obtain the value, please refer to the Client Credentials mode in OAuth 2.0-based Authentication. In this mode, client_id and client_secret are respectively the App ID and App key of the app that you created in AppGallery Connect. Concatenate the value of access_token to the end of Bearer, with a space in between, to generate the value of Authorization.

Content-Type

Mandatory

String

The value is always application/json;charset=utf-8.

Accept

Mandatory

String

The value is always application/json;charset=utf-8.

Request Example

GET /hmspass/v1/LYA-TL00/LYA-TL00L 10.1.0.165(C01E164R2P8)/900103020
Content-Type: application/json;charset=utf-8
Authorization: Bearer ***
Accept: application/json;charset=utf-8
Host: wallet-gateway-drcn.cloud.huawei.com.cn

Response Parameters

When the result code is 200:

Parameter

Type

Description

issuerAndFlag

String

List of functions supported by HUAWEI Wallet on devices of a certain model. Each function is displayed in issuer#flag format, and the functions are separated by vertical bars (|). The variable issuer indicates a wallet function. For details about issuers, please contact Huawei technical support. The options of flag are as follows:

0: The function is supported.

1: The function is not supported because the ROM version is earlier than that required.

2: The function is not supported because the app version is earlier than that required.

3: The function is not supported because both the ROM version and app version are earlier than those required.

queryAddress

String

Page for displaying the function list, which is not available currently.

Functions that are not displayed in the response are supported by HUAWEI Wallet regardless of the version.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json
{
  "issuerAndFlag": "key_car_entrance#0|swipe_optimization#1|1040034#2|ihg_hotel_control#3|key_car#0",
  "queryAddress": "https://nfcws.wallet.hicloud.com/h5/queryruleissuer"
}

Call Example

public String queryIssuerAndFlag(String url, String terminal, String romVersion, String clientVerison) {
    // Construct the HTTP header.
    HttpHeaders header = constructHttpHeaders();
    // Construct the HTTP URL.
    String baseUrl = ConfigHelper.instants().getValue("walletGateWayBaseUrl");
    String walletServerUrl = baseUrl + url + terminal + url + terminal;

    // Send the HTTP request and obtain response.
    ResponseEntity<String> response =
        REST_TEMPLATE.exchange(walletServerUrl, HttpMethod.GET, new HttpEntity(header), String);

    // Return the issuer and flag by the Wallet server.
    return response.getBody();
}