refactor: 先享卡优化

This commit is contained in:
dax
2020-12-28 15:41:29 +08:00
parent 37a9075157
commit c101cdd857
3 changed files with 141 additions and 82 deletions

View File

@@ -0,0 +1,36 @@
/*
*
* Copyright 2019-2020 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.enumeration;
/**
* 优惠数量的类型标识
*
* @author felord.cn
* @since 1.0.3.RELEASE
*/
public enum CountType {
/**
* 不限数量
*/
COUNT_UNLIMITED,
/**
* 有限数量
*/
COUNT_LIMIT
}

View File

@@ -14,11 +14,11 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package cn.felord.payment.wechat.v3.model.discountcard; package cn.felord.payment.wechat.v3.model.discountcard;
import cn.felord.payment.wechat.enumeration.ContractStatus; import cn.felord.payment.wechat.enumeration.ContractStatus;
import cn.felord.payment.wechat.enumeration.CountType;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@@ -33,51 +33,54 @@ import java.util.List;
public class DiscountCardAcceptedConsumeData { public class DiscountCardAcceptedConsumeData {
/** /**
* The Appid. * 应用appid需要绑定微信商户平台
*/ */
private String appid; private String appid;
/** /**
* The Card id. * 先享卡ID唯一标识一个先享卡
*/ */
private String cardId; private String cardId;
/** /**
* The Card template id. * 先享卡模板ID唯一定义此资源的标识。创建模板后可获得
*/ */
private String cardTemplateId; private String cardTemplateId;
/** /**
* The Create time. * 创建先享卡的时间
*/ */
private String createTime; private String createTime;
/** /**
* The Mchid. * 商户号
*/ */
private String mchid; private String mchid;
/** /**
* The Objectives. * 用户先享卡目标列表
*/ */
private List<Objective> objectives; private List<Objective> objectives;
/** /**
* The Openid. * 用户标识,用户在{@code appid}下的唯一标识
*/ */
private String openid; private String openid;
/** /**
* The Out card code. * 商户领卡号商户在请求领卡预受理接口时传入的领卡请求号同一个商户号下必须唯一要求32个字符内只能是数字、大小写字母_-|*
*/ */
private String outCardCode; private String outCardCode;
/** /**
* The Rewards. * 用户先享卡优惠列表
*/ */
private List<Reward> rewards; private List<Reward> rewards;
/** /**
* The Sharer openid. * 邀请者用户标识
* <p>
* 微信用户在商户对应appid下的唯一标识。
* 仅当此卡是通过“邀请有礼”渠道领卡时,会返回此字段;指此先享卡是通过此[邀请者]邀请领卡成功的。当此先享卡完成约定时,商户可给此[邀请者]下发应邀请有礼的奖励
*/ */
private String sharerOpenid; private String sharerOpenid;
/** /**
* The State. * 先享卡的守约状态
*/ */
private ContractStatus state; private ContractStatus state;
/** /**
* The Time range. * 约定时间期限
*/ */
private TimeRange timeRange; private TimeRange timeRange;
@@ -91,23 +94,27 @@ public class DiscountCardAcceptedConsumeData {
public static class Objective { public static class Objective {
/** /**
* The Count. * 目标数量
* <p>
* 履约目标需要完成的数量必须大于0。
*/ */
private Long count; private Long count;
/** /**
* The Description. * 目标描述
*/ */
private String description; private String description;
/** /**
* The Name. * 目标名称
*/ */
private String name; private String name;
/** /**
* The Objective id. * 目标id
*/ */
private String objectiveId; private String objectiveId;
/** /**
* The Unit. * 目标单位
* <p>
* 示例值:次
*/ */
private String unit; private String unit;
@@ -123,38 +130,42 @@ public class DiscountCardAcceptedConsumeData {
public static class Reward { public static class Reward {
/** /**
* The Amount. * 优惠金额
* <p>
* 1、优惠金额此项优惠对应的优惠总金额单位必须大于0。
* 2、此项优惠已享累计金额≤创建模板时配置的此项奖励的奖励金额
* 例如优惠为【满10元减3元优惠券4张】时用户一次消费使用了2张优惠券优惠金额为本次优惠总金额6元优惠数量为本次使用优惠的优惠券数量2张
*/ */
private Long amount; private Long amount;
/** /**
* The Count. * 优惠数量
*/ */
private Long count; private Long count;
/** /**
* The Count type. * 优惠数量类型
*/ */
private CountType countType; private CountType countType;
/** /**
* The Description. * 优惠描述
*/ */
private String description; private String description;
/** /**
* The Name. * 优惠名称
*/ */
private String name; private String name;
/** /**
* The Reward id. * 优惠ID
*/ */
private String rewardId; private String rewardId;
/** /**
* The Unit. * 优惠单位,例如 “个”
*/ */
private String unit; private String unit;
} }
/** /**
* The type Time range. * 先享卡约定时间期限
* *
* @author felord.cn * @author felord.cn
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
@@ -162,29 +173,13 @@ public class DiscountCardAcceptedConsumeData {
@Data @Data
public static class TimeRange { public static class TimeRange {
/** /**
* The Betin time. * 开始时间
*/ */
private String betinTime; private String betinTime;
/** /**
* The End time. * 结束时间
*/ */
private String endTime; private String endTime;
} }
/**
* 优惠数量的类型标识
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
public enum CountType{
/**
* 不限数量
*/
COUNT_UNLIMITED,
/**
* 有限数量
*/
COUNT_LIMIT
}
} }

View File

@@ -14,10 +14,11 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package cn.felord.payment.wechat.v3.model.discountcard; package cn.felord.payment.wechat.v3.model.discountcard;
import cn.felord.payment.wechat.enumeration.ContractStatus;
import cn.felord.payment.wechat.enumeration.CountType;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@@ -31,60 +32,60 @@ import java.util.List;
@Data @Data
public class DiscountCardAgreementEndConsumeData { public class DiscountCardAgreementEndConsumeData {
/** /**
* The Appid. * 应用appid需要绑定微信商户平台
*/ */
private String appid; private String appid;
/** /**
* The Card id. * 先享卡ID唯一标识一个先享卡
*/ */
private String cardId; private String cardId;
/** /**
* The Card template id. * 先享卡模板ID唯一定义此资源的标识。创建模板后可获得
*/ */
private String cardTemplateId; private String cardTemplateId;
/** /**
* The Create time. * 创建先享卡的时间
*/ */
private String createTime; private String createTime;
/** /**
* The Mchid. * 商户号
*/ */
private String mchid; private String mchid;
/** /**
* The Objectives. * 用户先享卡目标列表
*/ */
private List<Objective> objectives; private List<Objective> objectives;
/** /**
* The Openid. * 用户标识,用户在{@code appid}下的唯一标识
*/ */
private String openid; private String openid;
/** /**
* The Out card code. * 商户领卡号商户在请求领卡预受理接口时传入的领卡请求号同一个商户号下必须唯一要求32个字符内只能是数字、大小写字母_-|*
*/ */
private String outCardCode; private String outCardCode;
/** /**
* The Rewards. * 用户先享卡优惠列表
*/ */
private List<Reward> rewards; private List<Reward> rewards;
/** /**
* The State. * 先享卡的守约状态
*/ */
private String state; private ContractStatus state;
/** /**
* The Time range. * 先享卡约定时间期限
*/ */
private TimeRange timeRange; private TimeRange timeRange;
/** /**
* The Total amount. * 享受优惠总金额,单位为 “分”
*/ */
private Long totalAmount; private Long totalAmount;
/** /**
* The Unfinished reason. * 未完成约定原因
*/ */
private String unfinishedReason; private UnfinishedReason unfinishedReason;
/** /**
* The type Objective. * 目标列表属性
* *
* @author felord.cn * @author felord.cn
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
@@ -93,15 +94,17 @@ public class DiscountCardAgreementEndConsumeData {
public static class Objective { public static class Objective {
/** /**
* The Count. * 目标数量
* <p>
* 履约目标需要完成的数量必须大于0。
*/ */
private Long count; private Long count;
/** /**
* The Description. * 目标描述
*/ */
private String description; private String description;
/** /**
* The Name. * 目标名称
*/ */
private String name; private String name;
/** /**
@@ -109,18 +112,20 @@ public class DiscountCardAgreementEndConsumeData {
*/ */
private List<ObjectiveCompletionRecord> objectiveCompletionRecords; private List<ObjectiveCompletionRecord> objectiveCompletionRecords;
/** /**
* The Objective id. * 目标id
*/ */
private String objectiveId; private String objectiveId;
/** /**
* The Unit. * 目标单位
* <p>
* 示例值:次
*/ */
private String unit; private String unit;
} }
/** /**
* The type Time range. * 先享卡约定时间期限
* *
* @author felord.cn * @author felord.cn
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
@@ -128,17 +133,17 @@ public class DiscountCardAgreementEndConsumeData {
@Data @Data
public static class TimeRange { public static class TimeRange {
/** /**
* The Betin time. * 开始时间
*/ */
private String betinTime; private String betinTime;
/** /**
* The End time. * 结束时间
*/ */
private String endTime; private String endTime;
} }
/** /**
* The type Reward. * 优惠列表属性
* *
* @author felord.cn * @author felord.cn
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
@@ -147,37 +152,60 @@ public class DiscountCardAgreementEndConsumeData {
public static class Reward { public static class Reward {
/** /**
* The Amount. * 优惠金额
* <p>
* 1、优惠金额此项优惠对应的优惠总金额单位必须大于0。
* 2、此项优惠已享累计金额≤创建模板时配置的此项奖励的奖励金额
* 例如优惠为【满10元减3元优惠券4张】时用户一次消费使用了2张优惠券优惠金额为本次优惠总金额6元优惠数量为本次使用优惠的优惠券数量2张
*/ */
private Long amount; private Long amount;
/** /**
* The Count. * 优惠数量
*/ */
private Long count; private Long count;
/** /**
* The Count type. * 优惠数量类型
*/ */
private String countType; private CountType countType;
/** /**
* The Description. * 优惠描述
*/ */
private String description; private String description;
/** /**
* The Name. * 优惠名称
*/ */
private String name; private String name;
/** /**
* The Reward id. * 优惠ID
*/ */
private String rewardId; private String rewardId;
/** /**
* The Reward usage records. * 优惠单位,例如 “个”
*/
private List<RewardUsageRecord> rewardUsageRecords;
/**
* The Unit.
*/ */
private String unit; private String unit;
/**
* 优惠使用记录列表
*/
private List<RewardUsageRecord> rewardUsageRecords;
} }
/**
* 未完成约定原因
* <p>
* 当订单守约状态为{@link ContractStatus#UNFINISHED},返回此字段
*
* @since 1.0.3.RELEASE
*/
enum UnfinishedReason {
/**
* 到期未完成约
*/
DUE_TO_QUIT,
/**
* 提前退出约定
*/
EARLY_QUIT
}
} }