enhance: 代金券商家券样式兼容

This commit is contained in:
xiafang
2023-06-20 09:34:20 +08:00
parent fa0cc541de
commit 348fe9b5f1
3 changed files with 56 additions and 15 deletions

View File

@@ -28,41 +28,57 @@ public enum CouponBgColor {
/** /**
* Color 010 coupon bg color. * Color 010 coupon bg color.
*/ */
COLOR010, COLOR010("Color010"),
/** /**
* COLOR 020 coupon bg color. * COLOR 020 coupon bg color.
*/ */
COLOR020, COLOR020("Color010"),
/** /**
* COLOR 030 coupon bg color. * COLOR 030 coupon bg color.
*/ */
COLOR030, COLOR030("Color010"),
/** /**
* COLOR 040 coupon bg color. * COLOR 040 coupon bg color.
*/ */
COLOR040, COLOR040("Color010"),
/** /**
* COLOR 050 coupon bg color. * COLOR 050 coupon bg color.
*/ */
COLOR050, COLOR050("Color010"),
/** /**
* COLOR 060 coupon bg color. * COLOR 060 coupon bg color.
*/ */
COLOR060, COLOR060("Color010"),
/** /**
* COLOR 070 coupon bg color. * COLOR 070 coupon bg color.
*/ */
COLOR070, COLOR070("Color010"),
/** /**
* COLOR 080 coupon bg color. * COLOR 080 coupon bg color.
*/ */
COLOR080, COLOR080("Color010"),
/** /**
* COLOR 090 coupon bg color. * COLOR 090 coupon bg color.
*/ */
COLOR090, COLOR090("Color010"),
/** /**
* COLOR 100 coupon bg color. * COLOR 100 coupon bg color.
*/ */
COLOR100 COLOR100("Color010");
private final String value;
CouponBgColor(String value) {
this.value = value;
}
/**
* Gets value.
*
* @return the value
*/
public String getValue() {
return value;
}
} }

View File

@@ -31,7 +31,7 @@ public class PatternInfo {
/** /**
* 背景色 * 背景色
*/ */
private CouponBgColor backgroundColor; private String backgroundColor;
/** /**
* 券详情图片 * 券详情图片
*/ */
@@ -49,4 +49,16 @@ public class PatternInfo {
*/ */
private String merchantName; private String merchantName;
/**
* Sets background color.
*
* @param backgroundColor the background color
*/
public void setBackgroundColor(CouponBgColor backgroundColor) {
this.backgroundColor = backgroundColor.name();
}
private void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
} }

View File

@@ -17,7 +17,7 @@
package cn.felord.payment.wechat.v3.model.busifavor; package cn.felord.payment.wechat.v3.model.busifavor;
import cn.felord.payment.wechat.enumeration.CouponBgColor; import cn.felord.payment.wechat.enumeration.CouponBgColor;
import cn.felord.payment.wechat.v3.WechatMarketingFavorApi; import cn.felord.payment.wechat.v3.WechatMediaApi;
import lombok.Data; import lombok.Data;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -33,7 +33,7 @@ public class DisplayPatternInfo {
/** /**
* 背景颜色 * 背景颜色
*/ */
private CouponBgColor backgroundColor; private String backgroundColor;
/** /**
* 商户logo * 商户logo
* <ol> * <ol>
@@ -42,7 +42,7 @@ public class DisplayPatternInfo {
* </ol> * </ol>
* 仅支持通过 <a target= "_blank" href= "https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/marketing/chapter3_1.shtml">图片上传API</a> 接口获取的图片URL地址。 * 仅支持通过 <a target= "_blank" href= "https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/marketing/chapter3_1.shtml">图片上传API</a> 接口获取的图片URL地址。
* *
* @see WechatMarketingFavorApi#marketingImageUpload(MultipartFile) * @see WechatMediaApi#marketingImageUpload(MultipartFile)
*/ */
private String merchantLogoUrl; private String merchantLogoUrl;
/** /**
@@ -54,7 +54,7 @@ public class DisplayPatternInfo {
* </ol> * </ol>
* 仅支持通过 <a target= "_blank" href= "https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/marketing/chapter3_1.shtml">图片上传API</a> 接口获取的图片URL地址。 * 仅支持通过 <a target= "_blank" href= "https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/marketing/chapter3_1.shtml">图片上传API</a> 接口获取的图片URL地址。
* *
* @see WechatMarketingFavorApi#marketingImageUpload(MultipartFile) * @see WechatMediaApi#marketingImageUpload(MultipartFile)
*/ */
private String couponImageUrl; private String couponImageUrl;
/** /**
@@ -69,4 +69,17 @@ public class DisplayPatternInfo {
* 商户名称,字数上限为16个 * 商户名称,字数上限为16个
*/ */
private String merchantName; private String merchantName;
/**
* Sets background color.
*
* @param backgroundColor the background color
*/
public void setBackgroundColor(CouponBgColor backgroundColor) {
this.backgroundColor = backgroundColor.getValue();
}
private void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
} }