🎨 微信支付分相关接口代码重构规范化

This commit is contained in:
Binary Wang
2020-05-19 21:28:26 +08:00
parent 8709a9c5a7
commit 39cea92171
17 changed files with 587 additions and 546 deletions

View File

@@ -0,0 +1,36 @@
package com.github.binarywang.wxpay.bean.payscore;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 明细.
*
* @author doger.wang
* @date 2020-05-19
*/
@Data
@NoArgsConstructor
public class Detail implements Serializable {
private static final long serialVersionUID = -3901373259400050385L;
/**
* seq : 1
* amount : 900
* paid_type : NEWTON
* paid_time : 20091225091210
* transaction_id : 15646546545165651651
*/
@SerializedName("seq")
private int seq;
@SerializedName("amount")
private int amount;
@SerializedName("paid_type")
private String paidType;
@SerializedName("paid_time")
private String paidTime;
@SerializedName("transaction_id")
private String transactionId;
}

View File

@@ -0,0 +1,27 @@
package com.github.binarywang.wxpay.bean.payscore;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 服务位置信息.
*
* @author doger.wang
* @date 2020-05-19
*/
@Data
@NoArgsConstructor
public class Location implements Serializable {
private static final long serialVersionUID = -4510224826631515344L;
/**
* start_location : 嗨客时尚主题展餐厅
* end_location : 嗨客时尚主题展餐厅
*/
@SerializedName("start_location")
private String startLocation;
@SerializedName("end_location")
private String endLocation;
}

View File

@@ -1,45 +0,0 @@
package com.github.binarywang.wxpay.bean.payscore;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 微信支付分确认订单跟支付回调对象
* @author doger.wang
* @date 2020/5/14 12:18
*/
@NoArgsConstructor
@Data
public class NotifyData {
/**
* id : EV-2018022511223320873
* create_time : 20180225112233
* resource_type : encrypt-resource
* event_type : PAYSCORE.USER_CONFIRM
* resource : {"algorithm":"AEAD_AES_256_GCM","ciphertext":"...","nonce":"...","associated_data":""}
*/
private String id;
private String create_time;
private String resource_type;
private String event_type;
private Resource resource;
@NoArgsConstructor
@Data
public static class Resource {
/**
* algorithm : AEAD_AES_256_GCM
* ciphertext : ...
* nonce : ...
* associated_data :
*/
private String algorithm;
private String ciphertext;
private String nonce;
private String associated_data;
}
}

View File

@@ -0,0 +1,56 @@
package com.github.binarywang.wxpay.bean.payscore;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 微信支付分确认订单跟支付回调对象
*
* @author doger.wang
* @date 2020/5/14 12:18
*/
@NoArgsConstructor
@Data
public class PayScoreNotifyData implements Serializable {
private static final long serialVersionUID = -8538014389773390989L;
/**
* id : EV-2018022511223320873
* create_time : 20180225112233
* resource_type : encrypt-resource
* event_type : PAYSCORE.USER_CONFIRM
* resource : {"algorithm":"AEAD_AES_256_GCM","ciphertext":"...","nonce":"...","associated_data":""}
*/
@SerializedName("id")
private String id;
@SerializedName("create_time")
private String createTime;
@SerializedName("resource_type")
private String resourceType;
@SerializedName("event_type")
private String eventType;
@SerializedName("resource")
private Resource resource;
@Data
public static class Resource implements Serializable {
private static final long serialVersionUID = 8530711804335261449L;
/**
* algorithm : AEAD_AES_256_GCM
* ciphertext : ...
* nonce : ...
* associated_data :
*/
@SerializedName("algorithm")
private String algorithm;
@SerializedName("ciphertext")
private String cipherText;
@SerializedName("nonce")
private String nonce;
@SerializedName("associated_data")
private String associatedData;
}
}

View File

@@ -0,0 +1,31 @@
package com.github.binarywang.wxpay.bean.payscore;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 后付费商户优惠.
*
* @author doger.wang
* @date 2020-05-19
*/
@Data
@NoArgsConstructor
public class PostDiscount implements Serializable {
private static final long serialVersionUID = 2764537888242763379L;
/**
* name : 满20减1元
* description : 不与其他优惠叠加
*/
@SerializedName("name")
private String name;
@SerializedName("description")
private String description;
@SerializedName("count")
private int count;
@SerializedName("amount")
private int amount;
}

View File

@@ -0,0 +1,33 @@
package com.github.binarywang.wxpay.bean.payscore;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 后付费项目.
*
* @author doger.wang
* @date 2020-05-19
*/
@Data
@NoArgsConstructor
public class PostPayment implements Serializable {
private static final long serialVersionUID = 2007722927556382895L;
/**
* name : 就餐费用服务费
* amount : 4000
* description : 就餐人均100元服务费100/小时
* count : 1
*/
@SerializedName("name")
private String name;
@SerializedName("amount")
private int amount;
@SerializedName("description")
private String description;
@SerializedName("count")
private int count;
}

View File

@@ -0,0 +1,30 @@
package com.github.binarywang.wxpay.bean.payscore;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 订单风险金信息.
*
* @author doger.wang
* @date 2020-05-19
*/
@Data
@NoArgsConstructor
public class RiskFund implements Serializable {
private static final long serialVersionUID = -3583406084396059152L;
/**
* name : ESTIMATE_ORDER_COST
* amount : 10000
* description : 就餐的预估费用
*/
@SerializedName("name")
private String name;
@SerializedName("amount")
private int amount;
@SerializedName("description")
private String description;
}

View File

@@ -0,0 +1,27 @@
package com.github.binarywang.wxpay.bean.payscore;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 服务时间范围.
*
* @author doger.wang
* @date 2020-05-19
*/
@Data
@NoArgsConstructor
public class TimeRange implements Serializable {
private static final long serialVersionUID = 8169562173656314930L;
/**
* start_time : 20091225091010
* end_time : 20091225121010
*/
@SerializedName("start_time")
private String startTime;
@SerializedName("end_time")
private String endTime;
}

View File

@@ -1,5 +1,6 @@
package com.github.binarywang.wxpay.bean.payscore;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -13,118 +14,60 @@ import java.util.List;
@NoArgsConstructor
@Data
public class WxPayScoreRequest implements Serializable {
private static final long serialVersionUID = 364764508076146082L;
/**
* out_order_no : 1234323JKHDFE1243252
* appid : wxd678efh567hg6787
* service_id : 500001
* service_introduction : 某某酒店
* post_payments : [{"name":"就餐费用服务费","amount":4000,"description":"就餐人均100元服务费100/小时","count":1}]
* post_discounts : [{"name":"满20减1元","description":"不与其他优惠叠加"}]
* time_range : {"start_time":"20091225091010","end_time":"20091225121010"}
* location : {"start_location":"嗨客时尚主题展餐厅","end_location":"嗨客时尚主题展餐厅"}
* risk_fund : {"name":"ESTIMATE_ORDER_COST","amount":10000,"description":"就餐的预估费用"}
* attach : Easdfowealsdkjfnlaksjdlfkwqoi&wl3l2sald
* notify_url : https://api.test.com
* openid : oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
* need_user_confirm : true
*/
* out_order_no : 1234323JKHDFE1243252
* appid : wxd678efh567hg6787
* service_id : 500001
* service_introduction : 某某酒店
* post_payments : [{"name":"就餐费用服务费","amount":4000,"description":"就餐人均100元服务费100/小时","count":1}]
* post_discounts : [{"name":"满20减1元","description":"不与其他优惠叠加"}]
* time_range : {"start_time":"20091225091010","end_time":"20091225121010"}
* location : {"start_location":"嗨客时尚主题展餐厅","end_location":"嗨客时尚主题展餐厅"}
* risk_fund : {"name":"ESTIMATE_ORDER_COST","amount":10000,"description":"就餐的预估费用"}
* attach : Easdfowealsdkjfnlaksjdlfkwqoi&wl3l2sald
* notify_url : https://api.test.com
* openid : oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
* need_user_confirm : true
*/
@SerializedName("out_order_no")
private String outOrderNo;
@SerializedName("appid")
private String appid;
@SerializedName("service_id")
private String serviceId;
@SerializedName("service_introduction")
private String serviceIntroduction;
@SerializedName("time_range")
private TimeRange timeRange;
@SerializedName("location")
private Location location;
@SerializedName("risk_fund")
private RiskFund riskFund;
@SerializedName("attach")
private String attach;
@SerializedName("notify_url")
private String notifyUrl;
@SerializedName("openid")
private String openid;
@SerializedName("need_user_confirm")
private boolean needUserConfirm;
@SerializedName("profit_sharing")
private boolean profitSharing;
@SerializedName("post_payments")
private List<PostPayment> postPayments;
@SerializedName("post_discounts")
private List<PostDiscount> postDiscounts;
@SerializedName("total_amount")
private int totalAmount;
@SerializedName("reason")
private String reason;
@SerializedName("goods_tag")
private String goodsTag;
@SerializedName("type")
private String type;
@SerializedName("detail")
private Detail detail;
private String out_order_no;
private String appid;
private String service_id;
private String service_introduction;
private TimeRange time_range;
private Location location;
private RiskFund risk_fund;
private String attach;
private String notify_url;
private String openid;
private boolean need_user_confirm;
private boolean profit_sharing;
private List<PostPayments> post_payments;
private List<PostDiscounts> post_discounts;
private int total_amount;
private String reason;
private String goods_tag;
private String type;
private Detail detail;
@NoArgsConstructor
@Data
public static class Detail {
private String paid_time;
}
@NoArgsConstructor
@Data
public static class TimeRange {
/**
* start_time : 20091225091010
* end_time : 20091225121010
*/
private String start_time;
private String end_time;
}
@NoArgsConstructor
@Data
public static class Location {
/**
* start_location : 嗨客时尚主题展餐厅
* end_location : 嗨客时尚主题展餐厅
*/
private String start_location;
private String end_location;
}
@NoArgsConstructor
@Data
public static class RiskFund {
/**
* name : ESTIMATE_ORDER_COST
* amount : 10000
* description : 就餐的预估费用
*/
private String name;
private int amount;
private String description;
}
@NoArgsConstructor
@Data
public static class PostPayments {
/**
* name : 就餐费用服务费
* amount : 4000
* description : 就餐人均100元服务费100/小时
* count : 1
*/
private String name;
private int amount;
private String description;
private int count;
}
@NoArgsConstructor
@Data
public static class PostDiscounts {
/**
* name : 满20减1元
* description : 不与其他优惠叠加
*/
private String name;
private String description;
private int count;
private int amount;
}
}

View File

@@ -1,6 +1,6 @@
package com.github.binarywang.wxpay.bean.payscore;
import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -15,119 +15,78 @@ import java.util.Map;
@NoArgsConstructor
@Data
public class WxPayScoreResult implements Serializable {
private static final long serialVersionUID = 8809250065540275770L;
/**
* appid : wxd678efh567hg6787
* mchid : 1230000109
* out_order_no : 1234323JKHDFE1243252
* service_id : 500001
* service_introduction : 某某酒店
* state : CREATED
* state_description : MCH_COMPLETE
* post_payments : [{"name":"就餐费用服务费","amount":4000,"description":"就餐人均100元服务费100/小时","count":1}]
* post_discounts : [{"name":"满20减1元","description":"不与其他优惠叠加"}]
* risk_fund : {"name":" ESTIMATE_ORDER_COST","amount":10000,"description":"就餐的预估费用"}
* time_range : {"start_time":"20091225091010","end_time":"20091225121010"}
* location : {"start_location":"嗨客时尚主题展餐厅","end_location":"嗨客时尚主题展餐厅"}
* attach : Easdfowealsdkjfnlaksjdlfkwqoi&wl3l2sald
* notify_url : https://api.test.com
* order_id : 15646546545165651651
* package : DJIOSQPYWDxsjdldeuwhdodwxasd_dDiodnwjh9we
*/
private String appid;
private String mchid;
private String out_order_no;
private String service_id;
private String service_introduction;
private String state;
private String state_description;
private RiskFund risk_fund;
private TimeRange time_range;
private Location location;
private String attach;
private String notify_url;
private String order_id;
@JSONField(name = "package")
private String packageX;
private List<PostPayments> post_payments;
private List<PostDiscounts> post_discounts;
private boolean need_collection;
/**
* appid : wxd678efh567hg6787
* mchid : 1230000109
* out_order_no : 1234323JKHDFE1243252
* service_id : 500001
* service_introduction : 某某酒店
* state : CREATED
* state_description : MCH_COMPLETE
* post_payments : [{"name":"就餐费用服务费","amount":4000,"description":"就餐人均100元服务费100/小时","count":1}]
* post_discounts : [{"name":"满20减1元","description":"不与其他优惠叠加"}]
* risk_fund : {"name":" ESTIMATE_ORDER_COST","amount":10000,"description":"就餐的预估费用"}
* time_range : {"start_time":"20091225091010","end_time":"20091225121010"}
* location : {"start_location":"嗨客时尚主题展餐厅","end_location":"嗨客时尚主题展餐厅"}
* attach : Easdfowealsdkjfnlaksjdlfkwqoi&wl3l2sald
* notify_url : https://api.test.com
* order_id : 15646546545165651651
* package : DJIOSQPYWDxsjdldeuwhdodwxasd_dDiodnwjh9we
*/
@SerializedName("appid")
private String appid;
@SerializedName("mchid")
private String mchid;
@SerializedName("out_order_no")
private String outOrderNo;
@SerializedName("service_id")
private String serviceId;
@SerializedName("service_introduction")
private String serviceIntroduction;
@SerializedName("state")
private String state;
@SerializedName("state_description")
private String stateDescription;
@SerializedName("risk_fund")
private RiskFund riskFund;
@SerializedName("time_range")
private TimeRange timeRange;
@SerializedName("location")
private Location location;
@SerializedName("attach")
private String attach;
@SerializedName("notify_url")
private String notifyUrl;
@SerializedName("order_id")
private String orderId;
@SerializedName("package")
private String packageX;
@SerializedName("post_payments")
private List<PostPayment> postPayments;
@SerializedName("post_discounts")
private List<PostDiscount> postDiscounts;
@SerializedName("need_collection")
private boolean needCollection;
/**
* 收款信息
*/
@SerializedName("collection")
private Collection collection;
//用于跳转的sign注意区分需确认模式和无需确认模式的数据差别。创单接口会返回查询请自行组装
/**
* 用于跳转的sign注意区分需确认模式和无需确认模式的数据差别。创单接口会返回查询请自行组装
*/
@SerializedName("payScoreSignInfo")
private Map<String, String> payScoreSignInfo;
@NoArgsConstructor
@Data
public static class RiskFund {
/**
* name : ESTIMATE_ORDER_COST
* amount : 10000
* description : 就餐的预估费用
*/
private String name;
private int amount;
private String description;
}
@NoArgsConstructor
@Data
public static class TimeRange {
/**
* start_time : 20091225091010
* end_time : 20091225121010
*/
private String start_time;
private String end_time;
}
@NoArgsConstructor
@Data
public static class Location {
/**
* start_location : 嗨客时尚主题展餐厅
* end_location : 嗨客时尚主题展餐厅
*/
private String start_location;
private String end_location;
}
@NoArgsConstructor
@Data
public static class PostPayments {
/**
* name : 就餐费用服务费
* amount : 4000
* description : 就餐人均100元服务费100/小时
* count : 1
*/
private String name;
private int amount;
private String description;
private int count;
}
@NoArgsConstructor
@Data
public static class PostDiscounts {
/**
* name : 满20减1元
* description : 不与其他优惠叠加
*/
private String name;
private String description;
}
@NoArgsConstructor
/**
* 收款信息
*/
@Data
public static class Collection {
@NoArgsConstructor
public static class Collection implements Serializable {
private static final long serialVersionUID = 2279516555276133086L;
/**
* state : USER_PAID
* total_amount : 3900
@@ -135,29 +94,16 @@ public class WxPayScoreResult implements Serializable {
* paid_amount : 900
* details : [{"seq":1,"amount":900,"paid_type":"NEWTON","paid_time":"20091225091210","transaction_id":"15646546545165651651"}]
*/
@SerializedName("state")
private String state;
private int total_amount;
private int paying_amount;
private int paid_amount;
private List<Details> details;
@NoArgsConstructor
@Data
public static class Details {
/**
* seq : 1
* amount : 900
* paid_type : NEWTON
* paid_time : 20091225091210
* transaction_id : 15646546545165651651
*/
private int seq;
private int amount;
private String paid_type;
private String paid_time;
private String transaction_id;
}
@SerializedName("total_amount")
private int totalAmount;
@SerializedName("paying_amount")
private int payingAmount;
@SerializedName("paid_amount")
private int paidAmount;
@SerializedName("details")
private List<Detail> details;
}
}