voucher/api/v1/cmb_cpn.proto

257 lines
8.6 KiB
Protocol Buffer
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
package api.v1;
option go_package = "voucher/api/v1;v1";
import "validate/validate.proto";
import "google/api/annotations.proto";
import "v1/common.proto";
service Cmb {
rpc Order (CmbRequest) returns (CmbReply) {
option (google.api.http) = {
post: "/voucher/cmb/v1/order",
body: "*"
};
}
rpc Query (CmbRequest) returns (CmbReply) {
option (google.api.http) = {
post: "/voucher/cmb/v1/query",
body: "*"
};
}
rpc QueryProduct (CmbRequest) returns (CmbReply) {
option (google.api.http) = {
post: "/voucher/cmb/v1/product/query",
body: "*"
};
}
rpc OrderRetry (OrderRetryRequest) returns (Empty) {
option (google.api.http) = {
post: "/voucher/cmb/v1/orderRetry",
body: "*"
};
}
rpc OrderMock (CmbOrderRequest) returns (CmbRequest) {
option (google.api.http) = {
post: "/voucher/cmb/v1/orderMock",
body: "*"
};
}
rpc QueryMock (CmbQueryRequest) returns (CmbRequest) {
option (google.api.http) = {
post: "/voucher/cmb/v1/queryMock",
body: "*"
};
}
rpc QueryProductMock (CmbQueryProductRequest) returns (CmbRequest) {
option (google.api.http) = {
post: "/voucher/cmb/v1/product/queryMock",
body: "*"
};
}
rpc DecryptBody (EncryptBodyRequest) returns (DecryptBodyReply) {
option (google.api.http) = {
post: "/voucher/cmb/v1/decryptBody",
body: "*"
};
}
}
message OrderRetryRequest {
repeated string transactionIds = 1 [json_name = "transactionIds"];
}
message CmbRequest {
// 请求公共参数
// 合作方唯一ID,32位定长
string mid = 1 [json_name = "mid"];
// 应用唯一ID,32位定长
string aid = 2 [json_name = "aid"];
// 时间戳 yyyyMMddHHmmss
string date = 3 [json_name = "date"];
// 随机字符串,保证签名不可预测,不长于32位
string random = 4 [json_name = "random"];
// 合作方密钥对别名
string keyAlias = 5 [json_name = "keyAlias"];
// 掌上生活密钥对别名
string cmbKeyAlias = 6 [json_name = "cmbKeyAlias"];
// 加密报文,是否需要加密,请查看各API的说明文档
string encryptBody = 7 [json_name = "encryptBody"];
// 签名,具体详见签名规范
string sign = 8 [json_name = "sign"];
}
message CmbReply {
// 响应公共参数
// 接口调用返回码,1000 成功,1001 失败
string respCode = 1 [json_name = "respCode"];
// 返回话术,失败信息落此字段
string respMsg = 2 [json_name = "respMsg"];
// 时间戳 yyyyMMddHHmmss
string date = 3 [json_name = "date"];
// 合作方密钥对别名
string keyAlias = 5 [json_name = "keyAlias"];
// 掌上生活密钥对别名
string cmbKeyAlias = 6 [json_name = "cmbKeyAlias"];
// 加密报文,是否需要加密,请查看各API的说明文档
string encryptBody = 7 [json_name = "encryptBody"];
// 签名,具体详见签名规范
string sign = 8 [json_name = "sign"];
}
message CmbOrderRequest {
// 业务参数
// 唯一流水号,需支持14天内幂等
string transactionId = 9 [json_name = "transactionId", (validate.rules).string = {min_len: 1,max_len: 50}];
// 外部合作方权益批次号
string activityId = 10 [json_name = "activityId", (validate.rules).string = {min_len: 1,max_len: 32}];
// 招商银行用户号 用户标识,比如手机号、支付宝openId
string cmbUid = 11 [json_name = "cmbUid", (validate.rules).string = {min_len: 1,max_len: 50}];
// 应用id
string appId = 14 [json_name = "appId", (validate.rules).string = {min_len: 1,max_len: 20}];
// 用户标识类型,0-手机号,1-支付宝openId
string cmbUidType = 12 [json_name = "cmbUidType", (validate.rules).string = {min_len: 1,max_len: 10}];
// 时间戳,长度为13位,精度为毫秒
string timestamp = 13 [json_name = "timestamp", (validate.rules).string = {min_len: 1,max_len: 14}];
// 拓展参数
string attach = 15 [json_name = "attach"];
}
message CmbOrderReply {
// 业务参数
// 接口调用返回码,1000 成功,1001 失败
string respCode = 1 [json_name = "respCode"];
// 返回话术,失败信息落此字段
string respMsg = 2 [json_name = "respMsg"];
// 权益标识,优惠券券码,最大长度为50位
string codeNo = 9 [json_name = "codeNo"];
// 错误码
string thirdErrCode = 3 [json_name = "thirdErrCode"];
}
message CmbQueryRequest {
// 业务参数
// 外部合作方权益批次号
string codeNo = 9 [json_name = "codeNo", (validate.rules).string = {min_len: 1,max_len: 32}];
}
message CmbQueryReply {
// 优惠券券码,codeNo
string ticket = 9 [json_name = "ticket"];
// 更新后串码状态,0:可使用,1:已使用
string status = 10 [json_name = "status"];
// 验码日期,格式yyyy-mm-dd hh:mm:ss.sss
string transDate = 11 [json_name = "transDate"];
// 发码机构号,固定值,掌上生活优惠券系统提供
string orgNo = 12 [json_name = "orgNo"];
// 扩展字段
string ext = 13 [json_name = "ext"];
}
message CmbQueryProductRequest {
// 业务参数
// 外部合作方权益批次号
string activityId = 9 [json_name = "activityId", (validate.rules).string = {min_len: 1,max_len: 32}];
}
message CmbQueryProductReply {
// 接口调用返回码,1000 成功,1001 失败
string respCode = 1 [json_name = "respCode"];
// 返回话术,失败信息落此字段
string respMsg = 2 [json_name = "respMsg"];
// 业务参数
// 批次名称
string activityName = 9 [json_name = "activityName"];
// 外部合作方权益批次号
string activityId = 10 [json_name = "activityId"];
// 面额,单位为分
string amount = 11 [json_name = "amount"];
// 门槛,单位为分
string minAmount = 12 [json_name = "minAmount"];
// 有效期形式,0:固定有效期,1:动态有效期
string availableType = 13 [json_name = "availableType"];
// 动态有效期天数-非必填
string availableDays = 14 [json_name = "availableDays"];
// 有效期开始时间-非必填
string startTime = 15 [json_name = "startTime"];
// 有效期结束时间-非必填
string endTime = 16 [json_name = "endTime"];
// 当前可用库存
string availableStock = 17 [json_name = "availableStock"];
// 细则描述
string detail = 18 [json_name = "detail"];
// 批次开始日期 格式yyyy-mm-dd hh:mm:ss.sss
string saleStartTime = 19 [json_name = "saleStartTime"];
// 批次结束时间,格式yyyy-mm-dd hh:mm:ss.sss
string saleEndTime = 20 [json_name = "saleEndTime"];
// 错误码
string thirdErrCode = 21 [json_name = "thirdErrCode"];
}
message CmbNotifyRequest {
// 优惠券券码,codeNo
string ticket = 9 [json_name = "ticket"];
// 更新后串码状态,0:可使用,1:已使用
string status = 10 [json_name = "status"];
// 验码日期,格式yyyy-mm-dd hh:mm:ss.sss
string transDate = 11 [json_name = "transDate"];
// 发码机构号,固定值,掌上生活优惠券系统提供
string orgNo = 12 [json_name = "orgNo"];
// 扩展字段
string ext = 13 [json_name = "ext"];
string attach = 14 [json_name = "attach"];
// 招行唯一流水号
string transactionId = 15 [json_name = "transactionId"];
}
message CmbNotifyReply {
// 接口调用返回码,1000 成功,1001 失败
string respCode = 1 [json_name = "respCode"];
// 返回信息,失败信息落此字段
string respMsg = 2 [json_name = "respMsg"];
}
message CmbMultiNotifyRequest {
// cmb业务号
string transactionId = 1 [json_name = "transactionId"];
// 活动编号
string activityId = 2 [json_name = "activityId"];
// 微信券id
string couponId = 3 [json_name = "couponId"];
// 券领取时间
string acquiredDate = 4 [json_name = "acquiredDate"];
// 券状态0:可使用,1:已使用
string status = 5 [json_name = "status"];
// String|M 整张券总状态0:可使用,1:已使用
string couponStatus = 13 [json_name = "couponStatus"];
// 券核销时间 格式:yyyy-MM-dd HH:mm:ss.sss
string transDate = 6 [json_name = "transDate"];
// 券核销金额,单位-分
string transAmount = 7 [json_name = "transAmount"];
// 券核销支付单号,微信支付系统生成的订单号
string orderId = 8 [json_name = "orderId"];
// 优惠券券码 codeNo
string ticket = 9 [json_name = "ticket"];
// 发码机构号,固定值,掌上生活优惠券系统提供
string orgNo = 10 [json_name = "orgNo"];
// 500 标识位
string attach = 12 [json_name = "attach"];
// 扩展字段
string ext = 11 [json_name = "ext"];
}
message EncryptBodyRequest {
string encryptBody = 1 [json_name = "encryptBody"];
}
message DecryptBodyReply {
string decryptBody = 1 [json_name = "decryptBody"];
}