优惠券接口
接口列表
接口名称 | 接口方法 | 说明 |
---|---|---|
1.查询我的优惠券 | Coupon.GetMyCoupons | 查询我的优惠券 |
2.查询优惠券信息 | Coupon.GetCoupon | 根据优惠券号获取优惠券信息 |
3.检查优惠券是否可用 | Coupon.CheckCoupon | 检查优惠券是否可用 |
4.查询可用的优惠券 | Coupon.GetAvailableCoupons | 查询可用的优惠券 |
5.使用优惠券 | Coupon.UseCoupon | 使用优惠券 |
6.查询优惠券模板 | Coupon.GetCouponTemplate | 根据优惠券模板ID查询优惠券模板 |
7.发放优惠券 | Coupon.Publish | 发放优惠券 |
8.搜索优惠券模板 | Coupon.GetCouponTemplates | 根据酒店ID或房型查询符合条件的所有优惠券模板 |
1.查询我的优惠券
Coupon.GetMyCoupons
应用场景
查询我的优惠券
请求参数
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
会员ID | MemberId | 是 | string | ||
会员手机号 | MobileNo | 否 | string | ||
用户其它标识 | UserOtherId | 否 | string | 第三方标识,比如微信的OpenId | |
用户来源类型 | UserFromType | 否 | string | 第三方标识,目前只有微信 传递Wechat即可 | |
优惠券状态 | CouponStatus | 是 | CouponStatus | ReadyForUse | 待使用:ReadyForUse、已使用:Used、过期:Expire) |
分页大小 | PageSize | 是 | int | 10 | 每页显示10条记录 |
页索引 | PageIndex | 是 | int | 1 | 从1开始 |
示例
{
"ChannelKey":"web",
"Method":"Coupon.GetMyCoupons",
"BizContent":"{\"CouponStatus\":\"ReadyForUse\",\"PageSize\":10000,
\"PageIndex\":1,\"MemberId\":\"101517429\"}",
"Sign":"C6E402F6148664A1C1CC5B927465AFE9",
"SignType":"MD5",
"Format":"json",
"Charset":"utf-8",
"Version":"1.0",
"Timestamp":"2017-02-12 14:12:13"
}
其中BizContent是接口参数的json字符串,其json格式如下:
{
"CouponStatus":"ReadyForUse",
"PageSize":10000,
"PageIndex":1,
"MemberId":"101517429"
}
返回结果
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
优惠券Id | Id | 是 | long | ||
优惠券号 | SerialNo | 否 | string | ||
优惠券有效期开始时间 | ValidStartDate | 否 | DateTime | ||
优惠券有效期结束时间 | ValidEndDate | 否 | DateTime | ||
折扣类型 | TemplateDeductionTypeId | 否 | string | ||
备注 | TemplateMemo | 否 | string | ||
折扣值 | TemplateDeductionItemValue | 否 | string | ||
使用状态 | StatusId | 否 | string | ||
使用时间 | UseDate | 否 | DateTime | ||
券持者 | HolderName | 否 | string | ||
优惠启作用的入住时间 | Date | 否 | DateTime | ||
优惠券模板Id | TemplateId | 否 | long | ||
优惠模板名称 | TemplateName | 否 | string |
示例
{
"Code":10000,
"Message":null,
"SubCode":null,
"SubMessage":null,
"Data":{
"PageSize":10000,
"PageIndex":1,
"RecordCount":6320,
"PageCount":1,
"Content":[{
"Id":660262399403982,
"SerialNo":"4964074243245337143",
"ValidStartDate":"2017-11-07T17:16:35.29",
"ValidEndDate":"2027-11-07T17:16:35.29",
"TemplateDeductionTypeId":"Discount",
"TemplateMemo":null,
"TemplateDeductionItemValue":"20",
"StatusId":"ReadyForUse",
"UseDate":null,
"HolderName":"华鹤轩",
"Date":null,
"TemplateId":1141828229365761,
"TemplateName":"10元折扣券"
},
{"
Id":660262399403983,
"SerialNo":"5417772683160661272",
"ValidStartDate":"2017-11-07T17:16:35.293",
"ValidEndDate":"2027-11-07T17:16:35.293",
"TemplateDeductionTypeId":"Discount",
"TemplateMemo":null,
"TemplateDeductionItemValue":"20",
"StatusId":"ReadyForUse",
"UseDate":null,
"HolderName":"华鹤轩",
"Date":null,
"TemplateId":1141828229365761,
"TemplateName":"10元折扣券"
}]
}}
业务异常码表
Code
(返回码) |
Message
(返回码描述) |
SubCode
(业务返回码) |
SubMessage
(业务返回码描述) |
解决方案 |
---|---|---|---|---|
50000 | 业务处理失败 | coupon.coupon-has-used | 此优惠券已使用 | |
coupon.coupon-not-apply-hotel | 此优惠券不适用于该酒店 | |||
coupon.coupon-not-apply-room-type | 此优惠券不适用于该房型 | |||
coupon.coupon-not-enough | 优惠券不足 | |||
coupon.coupon-not-found | 优惠券不存在 | |||
coupon.coupon-not-published | 此优惠券还未发布 | |||
coupon.coupon-not-within-date | 此优惠券不在有效期内 | |||
coupon.invalid-argument | 无效的参数 | |||
coupon.invalid-phone-number | 无效的手机号 | |||
coupon.invalid-room-type | 无效的房型 | |||
coupon.member-not-found | 会员不存在 | |||
coupon.missing-coupon-publish-info | 缺少需要发放的优惠券信息 | |||
coupon.unknow-error | 未知异常 | |||
coupon.user-not-found | 用户不存在 |
2.查询优惠券信息
Coupon.GetCoupon
应用场景
根据优惠券号获取优惠券信息
请求参数
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
优惠券号 | SerialNo | 是 | string |
示例
{
"ChannelKey":"web",
"Method":"Coupon.GetCoupon",
"BizContent":"{\"SerialNo\":\"4964074243245337143\"}",
"Sign":"F01124D2B7BDAE71925DE0A47C9EE534",
"SignType":"MD5",
"Format":"json",
"Charset":"utf-8",
"Version":"1.0",
"Timestamp":"2017-02-12 14:12:13"
}
返回结果
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
优惠券Id | Id | 是 | long | ||
优惠券号 | SerialNo | 否 | string | ||
优惠券有效期开始时间 | ValidStartDate | 否 | DateTime | ||
优惠券有效期结束时间 | ValidEndDate | 否 | DateTime | ||
折扣类型 | TemplateDeductionTypeId | 否 | string | ||
备注 | TemplateMemo | 否 | string | ||
折扣值 | TemplateDeductionItemValue | 否 | string | ||
使用状态 | StatusId | 否 | string | ||
使用时间 | UseDate | 否 | DateTime | ||
券持者 | HolderName | 否 | string | ||
优惠启作用的入住时间 | Date | 否 | DateTime |
示例
{
"Code":10000,
"Message":null,
"SubCode":null,
"SubMessage":null,
"Data":{
"Id":660262399403982,
"SerialNo":"4964074243245337143",
"ValidStartDate":"2017-11-07T17:16:35.29",
"ValidEndDate":"2027-11-07T17:16:35.29",
"TemplateDeductionTypeId":"Discount",
"TemplateMemo":null,
"TemplateDeductionItemValue":"20",
"StatusId":"ReadyForUse",
"UseDate":null,
"HolderName":"华鹤轩",
"Date":null
}}
3.检查优惠券是否可用
Coupon.CheckCoupon
应用场景
检查优惠券是否可用
请求参数
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
酒店ID | OrgId | 是 | long | ||
优惠券号 | SerialNo | 是 | string | ||
优惠房型 | RoomTypeId | 是 | string |
示例
{
"ChannelKey":"web",
"Method":"Coupon.CheckCoupon",
"BizContent":"{\"OrgId\":660247752032257,\"SerialNo\":\"4964074243245337143\"}",
"Sign":"35B8A3BA81ACB789D503E434CF15309C",
"SignType":"MD5",
"Format":"json",
"Charset":"utf-8",
"Version":"1.0",
"Timestamp":"2017-02-12 14:12:13"
}
返回结果
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
是 | bool | 成功或失败 |
示例
{
"Code":10000,
"Message":null,
"SubCode":null,
"SubMessage":null,
"Data":true
}
4.查询可用的优惠券
Coupon.GetAvailableCoupons
应用场景
查询可用的优惠券
请求参数
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
酒店ID | OrgId | 是 | long | ||
优惠房型 | RoomTypeId | 是 | string | ||
优惠券折扣类型 | DeductionTypeIds | 是 | string[] | 折扣率(Rate)、抵扣价(Discount)、免房费(RoomPriceFree) | |
会员ID | MemberId | 是 | string | ||
会员手机号 | MobileNo | 否 | string | ||
用户其它标识 | UserOtherId | 否 | string | ||
用户来源类型 | UserFromType | 否 | string | 目前只有微信 传递Wechat即可 |
示例
{
"ChannelKey":"web",
"Method":"Coupon.GetAvailableCoupons",
"BizContent":"{\"MemberId\":\"101517429\",
\"OrgId\":660247752032257,
\"RoomTypeId\":\"TR\",
\"DeductionTypeIds\":[\"Discount\"]}",
"Sign":"C138D0784828F278D55CB6517608E914",
"SignType":"MD5",
"Format":"json",
"Charset":"utf-8",
"Version":"1.0",
"Timestamp":"2017-02-12 14:12:13"
}
返回结果
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
优惠券Id | Id | 是 | long | ||
优惠券号 | SerialNo | 否 | string | ||
使用渠道 | Channels | 否 | string[] | ||
优惠券有效期开始时间 | ValidStartDate | 否 | DateTime | ||
优惠券有效期结束时间 | ValidEndDate | 否 | DateTime | ||
折扣类型 | TemplateDeductionTypeId | 否 | string | ||
备注 | TemplateMemo | 否 | string | ||
折扣值 | TemplateDeductionItemValue | 否 | string | ||
使用状态 | StatusId | 否 | string | ||
使用时间 | UseDate | 否 | DateTime | ||
券持者 | HolderName | 否 | string | ||
优惠启作用的入住时间 | Date | 否 | DateTime | ||
优惠券模板Id | TemplateId | 否 | long | ||
优惠模板名称 | TemplateName | 否 | string |
示例
{
"Code":10000,
"Message":null,
"SubCode":null,
"SubMessage":null,
"Data":{
"PageSize":10000,
"PageIndex":1,
"RecordCount":6320,
"PageCount":1,
"Content":[{
"Id":660262399403982,
"SerialNo":"4964074243245337143",
"Channels":["Hotel","TRIP"],
"ValidStartDate":"2017-11-07T17:16:35.29",
"ValidEndDate":"2027-11-07T17:16:35.29",
"TemplateDeductionTypeId":"Discount",
"TemplateMemo":null,
"TemplateDeductionItemValue":"20",
"StatusId":"ReadyForUse",
"UseDate":null,
"HolderName":"华鹤轩",
"Date":null,
"TemplateId":1141828229365761,
"TemplateName":"10元折扣券"
},
{"
Id":660262399403983,
"SerialNo":"5417772683160661272",
"Channels":["Hotel","TRIP"],
"ValidStartDate":"2017-11-07T17:16:35.293",
"ValidEndDate":"2027-11-07T17:16:35.293",
"TemplateDeductionTypeId":"Discount",
"TemplateMemo":null,
"TemplateDeductionItemValue":"20",
"StatusId":"ReadyForUse",
"UseDate":null,
"HolderName":"华鹤轩",
"Date":null,
"TemplateId":1141828229365761,
"TemplateName":"10元折扣券"
}]
}}
5.使用优惠券
Coupon.UseCoupon
应用场景
使用优惠券
请求参数
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
酒店ID | OrgId | 是 | long | ||
优惠券号 | SerialNo | 是 | string | ||
优惠房型 | RoomTypeId | 是 | string | ||
订单号 | OrderId | 是 | long | ||
账务ID | BillId | 是 | long | ||
会员ID | MemberId | 是 | string | ||
会员手机号 | MobileNo | 否 | string | ||
用户其它标识 | UserOtherId | 否 | string | ||
用户来源类型 | UserFromType | 否 | string | 目前只有微信 传递Wechat即可 |
示例
{
"ChannelKey":"web",
"Method":"Coupon.UseCoupon",
"BizContent":"{\"MobileNo\":\"13099999999\",\"OrgId\":660247752032257,
\"SerialNo\":\"5704573193283269669\",\"RoomTypeId\":\"TR\",\"OrderId\":678727960330241,
\"BillId\":678727964524545}",
"Sign":"DF70EFF9589C5A87699C8CF1F89BCFD3",
"SignType":"MD5",
"Format":"json",
"Charset":"utf-8",
"Version":"1.0",
"Timestamp":"2017-02-12 14:12:13"
}
返回结果
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
优惠房间号 | RoomNumber | 是 | string | ||
优惠金额 | Discount | 否 | string | ||
优惠房间对应的账务ID | BillId | 否 | long | ||
对房间的哪一天进行优惠 | Date | 否 | DateTime | ||
入账科目 | EntrySubject | 否 | string | ||
被优惠的账务项Id | DiscountedBillItemId | 否 | long | ||
被优惠的账务科目 | DiscountedBillItemSubject | 否 | string | ||
使用状态 | StatusId | 否 | string |
示例
{
"Code":10000,
"Message":null,
"SubCode":null,
"SubMessage":null,
"Data":{
"RoomNumber":null,
"Discount":20.0,
"BillId":678727964524545,
"Date":"2017-12-21T01:57:55.083294Z",
"EntrySubject":null,
"DiscountedBillItemId":0,
"DiscountedBillItemSubject":null
}}
6.查询优惠券模板
Coupon.GetCouponTemplate
应用场景
根据优惠券模板ID查询优惠券模板
请求参数
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
优惠券模板Id | TemplateId | 是 | long |
示例
{
"ChannelKey":"web",
"Method":"Coupon.GetCouponTemplate",
"BizContent":"{\"TemplateId\":660263405174785}",
"Sign":"3D249DFDA66E61657CB9D0ACC432CC8D",
"SignType":"MD5",
"Format":"json",
"Charset":"utf-8",
"Version":"1.0",
"Timestamp":"2017-02-12 14:12:13"
}
返回结果
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
模板ID | Id | 是 | long | ||
模板名称 | Name | 否 | string | ||
有效时间类型 | ValidDateTypeId | 否 | long | ||
固定有效开始时间 | FixedValidStartDate | 否 | DateTime | ||
固定有效结束时间 | FixedValidEndDate | 否 | DateTime | ||
动态有效发放后起始天数 | DynamicBeginDay | 否 | int | ||
动态有效持续天数 | DynamicStayDay | 否 | int | ||
是否有效 | IsActive | 否 | bool | ||
是否为全数字 | IsAllNumber | 否 | bool | ||
优惠券号前缀 | SerialNoPrefix | 否 | string | ||
生成状态 | GenerateStatusId | 否 | string | ||
发布状态 | PublishStatusId | 否 | string | ||
是否生成 | IsGenerated | 否 | bool | ||
是否发布 | IsPublished | 否 | bool | ||
入账方式 | EntryBehaviourId | 否 | string | ||
折扣类型 | DeductionTypeId | 否 | string | 折扣率、抵扣价、免房费 | |
折扣作用的科目 | DeductionSubject | 否 | string | ||
折扣类型对应的值 | DeductionItemValue | 否 | string | ||
备注 | Memo | 否 | string | ||
已生成数量 | GeneratedCount | 否 | int | ||
已发放数量 | PublishedCount | 否 | int | ||
已使用数量 | UsedCount | 否 | int | ||
可使用数量 | NoUsedCount | 否 | int | ||
关联酒店ID数组 | OrgInfoIDs | 否 | long[] | ||
渠道 | Channels | 否 | long[] |
示例
{
"Code":10000,
"Message":null,
"SubCode":null,
"SubMessage":null,
"Data":{
"Id":660263405174785,
"Name":"折扣价",
"ValidDateTypeId":"Always",
"FixedValidStartDate":null,
"FixedValidEndDate":null,
"DynamicBeginDay":null,
"DynamicStayDay":null,
"IsActive":true,
"IsAllNumber":true,
"SerialNoPrefix":null,
"GenerateStatusId":"Complete",
"PublishStatusId":"Complete",
"IsGenerated":true,
"IsPublished":true,
"EntryBehaviourId":"AdjustCoupon",
"DeductionTypeId":"Discount",
"DeductionSubject":"D1000",
"DeductionItemValue":"20",
"Memo":null,
"GeneratedCount":30000,
"PublishedCount":5778,
"UsedCount":223,
"NoUsedCount":5555,
"OrgInfoIDs":[467914382721028,660247752032257],
"Channels":["Hotel","Web"]
}}
7.发放优惠券
Coupon.Publish
应用场景
酒店发放优惠券
请求参数
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
优惠券模板Id | PublishDetails | 是 | CouponPublishDetailModel[] | ||
优惠券发放方式 | CouponPublishType | 是 | CouponPublishType | 请参考:数据字典->优惠券发放方式 | |
会员ID | MemberId | 是 | string | ||
会员手机号 | MobileNo | 是 | string | ||
用户其它标识 | UserOtherId | 否 | string | ||
用户来源类型 | UserFromType | 是 | string | 目前只有微信 传递Wechat即可 |
CouponPublishDetailModel
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
待发布的优惠券模板 | TemplateId | 是 | long | ||
要发布的优惠券数量 | Count | 是 | int |
示例
{
"ChannelKey":"web",
"Method":"Coupon.Publish",
"BizContent":"{\"MobileNo\":\"13099999999\",
\"PublishDetails\":[{\"TemplateId\":660263405174785,\"Count\":1}]}",
"Sign":"BE3F1C2D5F97A135D4E780B9B4BE8668",
"SignType":"MD5",
"Format":"json",
"Charset":"utf-8",
"Version":"1.0",
"Timestamp":"2017-02-12 14:12:13"
}
返回结果
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
是 | bool | 成功或者失败 |
示例
{
"Code":10000,
"Message":null,
"SubCode":null,
"SubMessage":null,
"Data":true
}
8.搜索优惠券模板
Coupon.GetCouponTemplates
应用场景
根据酒店ID或房型查询符合条件的所有优惠券模板
请求参数
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
酒店ID | OrgId | 是 | long | ||
优惠房型 | RoomTypeId | 否 | string |
示例
{
"ChannelKey":"web",
"Method":"Coupon.GetCouponTemplates",
"BizContent":"{\"OrgId\":\"2147483644\",\"RoomTypeId\":\"DT\"}",
"Sign":"B59911ECF4A719E912E8C9DED3710F8E",
"SignType":"MD5",
"Format":"json",
"Charset":"utf-8",
"Version":"1.0",
"Timestamp":"2017-02-12 14:12:13"
}
返回结果
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
模板ID | Id | 是 | long | ||
模板名称 | Name | 否 | string | ||
有效时间类型 | ValidDateTypeId | 否 | long | ||
固定有效开始时间 | FixedValidStartDate | 否 | DateTime | ||
固定有效结束时间 | FixedValidEndDate | 否 | DateTime | ||
动态有效发放后起始天数 | DynamicBeginDay | 否 | int | ||
动态有效持续天数 | DynamicStayDay | 否 | int | ||
是否有效 | IsActive | 否 | bool | ||
是否为全数字 | IsAllNumber | 否 | bool | ||
优惠券号前缀 | SerialNoPrefix | 否 | string | ||
优惠启作用的入住时间 | GenerateStatusId | 否 | string | ||
发布状态 | PublishStatusId | 否 | string | ||
是否生成 | IsGenerated | 否 | bool | ||
是否发布 | IsPublished | 否 | bool | ||
入账方式 | EntryBehaviourId | 否 | string | ||
折扣类型 | DeductionTypeId | 否 | string | 折扣率、抵扣价、免房费 | |
折扣作用的科目 | DeductionSubject | 否 | string | ||
折扣类型对应的值 | DeductionItemValue | 否 | string | ||
备注 | Memo | 否 | string | ||
已生成数量 | GeneratedCount | 否 | int | ||
已发放数量 | PublishedCount | 否 | int | ||
已使用数量 | UsedCount | 否 | int | ||
可使用数量 | NoUsedCount | 否 | int | ||
关联酒店ID数组 | OrgInfoIDs | 否 | long[] | ||
渠道 | Channels | 否 | long[] |
示例
{
"Code":10000,
"Message":null,
"SubCode":null,
"SubMessage":null,
"Data":{
"Id":660263405174785,
"Name":"折扣价",
"ValidDateTypeId":"Always",
"FixedValidStartDate":null,
"FixedValidEndDate":null,
"DynamicBeginDay":null,
"DynamicStayDay":null,
"IsActive":true,
"IsAllNumber":true,
"SerialNoPrefix":null,
"GenerateStatusId":"Complete",
"PublishStatusId":"Complete",
"IsGenerated":true,
"IsPublished":true,
"EntryBehaviourId":"AdjustCoupon",
"DeductionTypeId":"Discount",
"DeductionSubject":"D1000",
"DeductionItemValue":"20",
"Memo":null,
"GeneratedCount":30000,
"PublishedCount":5778,
"UsedCount":223,
"NoUsedCount":5555,
"OrgInfoIDs":[467914382721028,660247752032257],
"Channels":["Hotel","Web"]
}}