文档管理中心
我的
API参考钱包服务REST开发者调用接口其他接口钱包客户端支持功能查询接口

钱包客户端支持功能查询接口

功能介绍

根据客户端机型、rom版本号以及华为钱包版本号查询该钱包客户端支持的功能。

场景描述

开发者可以调用该API,判断某一华为钱包客户端支持哪些功能,如门禁卡、交通卡等。开发者服务器调用此接口前应先通过手机客户端获取机型、rom版本号、华为钱包版本号等信息。此接口会返回一个功能列表及这些功能是否被支持的flag。

使用约束

需在华为AGC网站上创建应用。

接口原型

承载协议

HTTPS GET

接口方向

开发者服务器->华为钱包服务器

接口URL

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

{gatewayUrl}变量需要开发者根据服务器所属区域自行选择,请参见钱包网关服务器地址。

数据格式

请求消息:Content-Type: application/json

响应消息:Content-Type: application/json

路径参数

展开

参数

是否必选

参数类型

描述

terminal

是

String(64)

手机机型。

romVersion

是

String(128)

手机rom版本号

clientVersion

是

String(64)

华为钱包App的版本号,可通过华为钱包包名获取,包名为"com.huawei.wallet"。

请求参数

Request Header:

展开

参数

是否必选

参数类型

描述

Authorization

是

String

鉴权码。获取方式详见基于OAuth 2.0开放鉴权,请使用“客户端模式”。“client_id”和“client_secret”即为开发者在华为AGC网站上创建应用后获取的“App ID”和“App key”。将获取到的“access_token”的值拼接在字符串“Bearer”之后,以空格符相隔,组成“Authorization”参数的值。

Content-Type

是

String

固定值:“application/json;charset=utf-8”。

Accept

是

String

固定值:“application/json;charset=utf-8”。

请求示例

收起
自动换行
深色代码主题
复制
  1. GET /hmspass/v1/LYA-TL00/LYA-TL00L 10.1.0.165(C01E164R2P8)/900103020
  2. Content-Type: application/json;charset=utf-8
  3. Authorization: Bearer ***
  4. Accept: application/json;charset=utf-8
  5. Host: wallet-gateway-drcn.cloud.huawei.com.cn

响应参数

错误码为200时:

展开

参数

参数类型

描述

issuerAndFlag

String

钱包在相应机型中支持的功能列表。每个功能采用“issuer#flag”模式展示,每个功能之间使用“|”符号分割。“issuer”即表示一个钱包功能,请联系华为技术支持获取各个“issuer”对应的具体含义。“flag”取值的具体含义如下:

“flag”为0,表示支持该功能;

“flag”为1,表示由于rom版本过低,不支持该功能;

“flag”为2,表示由于client版本过低,不支持该功能;

“flag”为3,表示由于rom版本和client版本都过低,不支持该功能。

queryAddress

String

用于展示功能列表的页面,该页面暂未开放。

说明

若某些华为钱包功能没有在响应参数中显示,则表明这些功能可被所有华为钱包客户端支持。

响应示例

收起
自动换行
深色代码主题
复制
  1. HTTP/1.1 200 OK
  2. Content-Type: application/json
  3. {
  4. "issuerAndFlag": "key_car_entrance#0|swipe_optimization#1|1040034#2|ihg_hotel_control#3|key_car#0",
  5. "queryAddress": "https://nfcws.wallet.hicloud.com/h5/queryruleissuer"
  6. }

调用示例

收起
自动换行
深色代码主题
复制
  1. public String queryIssuerAndFlag(String url, String terminal, String romVersion, String clientVerison) {
  2. // Construct the http header.
  3. HttpHeaders header = constructHttpHeaders();
  4. // Construct the http URL.
  5. String baseUrl = ConfigHelper.instants().getValue("walletGateWayBaseUrl");
  6. String walletServerUrl = baseUrl + url + terminal + url + terminal;
  7. // Send the http request and get response.
  8. ResponseEntity<String> response =
  9. REST_TEMPLATE.exchange(walletServerUrl, HttpMethod.GET, new HttpEntity(header), String);
  10. // Return the issuer and flag by wallet server.
  11. return response.getBody();
  12. }