智能客服
你问我答,随时在线为你解决问题

























HMS Core
重写modelId对应的优惠券模板。
开发者可以调用该API,全量更新modelId对应的优惠券模板。除了passTypeIdentifier和passStyleIdentifier(modelId),其余字段均可更新。卡券模板被更新后,与之关联的已被华为钱包用户领取的卡券都会被相应地更新,不同的更新场景请查看同步/异步更新规则。
需在华为AGC网站上创建应用并申请卡券对应的服务。只能更新已添加到华为服务器的卡券模板。
承载协议 | HTTPS PUT |
|---|---|
接口方向 | 开发者服务器->华为钱包服务器 |
接口URL | {url}/hmspass/v1/offer/model/{modelId} {url}变量需要开发者根据服务器所属区域自行选择,请参见钱包服务器地址。 |
数据格式 | 请求消息:Content-Type: application/json 响应消息:Content-Type: application/json |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
modelId | 是 | String | 卡券模板的唯一标识符。这个ID在同一个appId下唯一。这个ID只能包含字母、数字和(.)、(-)、(_)。 |
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”。 |
Request Body:
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
详见HwWalletObject参数描述 | 是 | 待更新的卡券模板 |
- PUT /hmspass/v1/offer/model/offerModelTest HTTP/1.1
- Content-Type: application/json;charset=utf-8
- Authorization: Bearer ***
- Accept: application/json;charset=utf-8
- Host: wallet-passentrust-drcn.cloud.huawei.com.cn
- {
- "passVersion": "2.0",
- "passTypeIdentifier": "hwpass.com.huawei.wallet.offer.test",
- "passStyleIdentifier": "offerModelTest",
- "organizationName": "Huawei",
- "fields": {
- "countryCode": "CN",
- "locationList": [
- {
- "longitude": "114.0679603815",
- "latitude": "22.6592051284"
- }
- ],
- "commonFields": [
- {
- "key": "logo",
- "value": "https://www.huawei.com/XXX.png"
- },
- {
- "key": "name",
- "value": "70%-Off Coupon",
- "localizedValue": "nameI18N"
- },
- {
- "key": "providerName",
- "value": "YYY Producer"
- },
- {
- "key": "merchantName",
- "value": "HUAWEI Vmall",
- "localizedValue": "merchantNameI18N"
- }
- ],
- "appendFields": [
- {
- "key": "details",
- "value": "Detail information of this coupon.",
- "localizedValue": "detailsI18N"
- },
- {
- "key": "declaration",
- "value": "Coupon disclaimer provided by merchant.",
- "localizedValue": "declarationI18N"
- },
- {
- "key": "backgroundColor",
- "value": "#FF1C2635"
- }
- ],
- "messageList": [
- {
- "key": "message[0]",
- "value": "Don't miss this great offer!",
- "label": "Important!",
- "localizedValue": "message[0]I18N"
- }
- ],
- "imageList": [
- {
- "key": "mainImage[0]",
- "value": "https://www.huawei.com/XXX0.png"
- },
- {
- "key": "mainImage[1]",
- "value": "https://www.huawei.com/XXX1.png"
- },
- {
- "key": "mainImage[2]",
- "value": "https://www.huawei.com/XXX2.png"
- }
- ],
- "localized": [
- {
- "key": "merchantNameI18N",
- "language": "zh-cn",
- "value": "华为商城"
- },
- {
- "key": "merchantNameI18N",
- "language": "en",
- "value": "HUAWEI Vmall"
- },
- {
- "key": "message[0]I18N",
- "language": "zh-cn",
- "value": "不要错过这次的优惠!"
- },
- {
- "key": "message[0]I18N",
- "language": "en",
- "value": "Don't miss this great offer!"
- }
- ]
- }
- }
- HTTP/1.1 200 OK
- Content-Type: application/json
- {
- "passVersion": "2.0",
- "passTypeIdentifier": "hwpass.com.huawei.wallet.offer.test",
- "passStyleIdentifier": "offerModelTest",
- "organizationName": "Huawei",
- "fields": {
- "countryCode": "CN",
- "locationList": [
- {
- "longitude": "114.0679603815",
- "latitude": "22.6592051284"
- }
- ],
- "commonFields": [
- {
- "key": "logo",
- "value": "https://www.huawei.com/XXX.png"
- },
- {
- "key": "name",
- "value": "70%-Off Coupon",
- "localizedValue": "nameI18N"
- },
- {
- "key": "providerName",
- "value": "YYY Producer"
- },
- {
- "key": "merchantName",
- "value": "HUAWEI Vmall",
- "localizedValue": "merchantNameI18N"
- }
- ],
- "appendFields": [
- {
- "key": "details",
- "value": "Detail information of this coupon.",
- "localizedValue": "detailsI18N"
- },
- {
- "key": "declaration",
- "value": "Coupon disclaimer provided by merchant.",
- "localizedValue": "declarationI18N"
- },
- {
- "key": "backgroundColor",
- "value": "#FF1C2635"
- }
- ],
- "messageList": [
- {
- "key": "message[0]",
- "value": "Don't miss this great offer!",
- "label": "Important!",
- "localizedValue": "message[0]I18N"
- }
- ],
- "imageList": [
- {
- "key": "mainImage[0]",
- "value": "https://www.huawei.com/XXX0.png"
- },
- {
- "key": "mainImage[1]",
- "value": "https://www.huawei.com/XXX1.png"
- },
- {
- "key": "mainImage[2]",
- "value": "https://www.huawei.com/XXX2.png"
- }
- ],
- "localized": [
- {
- "key": "merchantNameI18N",
- "language": "zh-cn",
- "value": "华为商城"
- },
- {
- "key": "merchantNameI18N",
- "language": "en",
- "value": "HUAWEI Vmall"
- },
- {
- "key": "message[0]I18N",
- "language": "zh-cn",
- "value": "不要错过这次的优惠!"
- },
- {
- "key": "message[0]I18N",
- "language": "en",
- "value": "Don't miss this great offer!"
- }
- ]
- }
- }
详见错误码。
- public HwWalletObject fullUpdateWalletModel(String url, String modelId, String body) {
- // Construct the http header.
- HttpHeaders header = constructHttpHeaders();
- // Construct the http URL.
- String baseUrl = ConfigHelper.instants().getValue("walletServerBaseUrl");
- String walletServerUrl = baseUrl + url + modelId;
- // Construct the http body.
- JSONObject jsonObj = JSONObject.parseObject(body);
-
- // Send the http request and get response.
- HttpEntity<JSONObject> entity = new HttpEntity<>(jsonObj, header);
- ResponseEntity<HwWalletObject> response =
- REST_TEMPLATE.exchange(walletServerUrl, HttpMethod.PUT, entity, HwWalletObject.class);
-
- // Return the updated wallet model.
- return response.getBody();
- }
智能客服
你问我答,随时在线为你解决问题
合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
解决方案
精准高效的一站式服务支持,助力开发者商业成功