This commit is contained in:
2025-04-16 14:37:24 +08:00
parent 8ac386242d
commit f6f847e41c
20 changed files with 713 additions and 54 deletions

View File

@ -0,0 +1,10 @@
package com.ycwl.basic.pay.entity;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class CancelOrderRequest {
private String orderNo;
}

View File

@ -0,0 +1,35 @@
package com.ycwl.basic.pay.entity;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.math.BigInteger;
@Data
@Accessors(chain = true)
public class CreateOrderRequest {
/**
* 价格,单位为分
*/
private Integer price;
private String goodsName;
private String orderNo;
private String description;
private String userIdentify;
private String notifyUrl;
public BigDecimal getPriceInYuan() {
return new BigDecimal(BigInteger.valueOf(price), 2);
}
public CreateOrderRequest setPriceInCents(Integer priceInCents) {
this.price = priceInCents;
return this;
}
public CreateOrderRequest setPriceInYuan(BigDecimal priceInYuan) {
this.price = priceInYuan.multiply(new BigDecimal(100)).intValue();
return this;
}
}

View File

@ -0,0 +1,10 @@
package com.ycwl.basic.pay.entity;
import lombok.Data;
@Data
public class CreateOrderResponse {
private boolean success;
private boolean skipPay;
private String orderNo;
}

View File

@ -0,0 +1,34 @@
package com.ycwl.basic.pay.entity;
import lombok.Data;
@Data
public class PayResponse {
private boolean valid;
private String orderNo;
private Object originalResponse;
private Integer orderPrice;
private Integer payPrice;
private PAY_STATE state;
private String payTime;
public boolean isPay() {
return state == PAY_STATE.SUCCESS;
}
public boolean isCancel() {
return state == PAY_STATE.CANCEL;
}
public boolean isRefund() {
return state == PAY_STATE.REFUND;
}
public enum PAY_STATE {
SUCCESS,
CANCEL,
REFUND,
FAIL,
UNKNOWN;
}
}

View File

@ -0,0 +1,14 @@
package com.ycwl.basic.pay.entity;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class RefundOrderRequest {
private Integer price;
private Integer refundPrice;
private String orderNo;
private String refundNo;
private String notifyUrl;
}

View File

@ -0,0 +1,9 @@
package com.ycwl.basic.pay.entity;
import lombok.Data;
@Data
public class RefundOrderResponse {
private boolean success;
private String refundNo;
}

View File

@ -0,0 +1,28 @@
package com.ycwl.basic.pay.entity;
import lombok.Data;
@Data
public class RefundResponse {
private boolean valid;
private String orderNo;
private String refundNo;
private Object originalResponse;
private Integer orderPrice;
private Integer refundPrice;
private PAY_STATE state;
private String refundTime;
public void setSuccess() {
state = PAY_STATE.SUCCESS;
}
public void setFail() {
state = PAY_STATE.FAIL;
}
public enum PAY_STATE {
SUCCESS,
FAIL
}
}

View File

@ -0,0 +1,12 @@
package com.ycwl.basic.pay.entity;
import lombok.Data;
@Data
public class WxMpPayConfig {
private String merchantId;
private String appId;
private String privateKey;
private String serialNumber;
private String apiV3Key;
}