From d1b611805254be3369644c67e87d87c6edcd68e9 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Sat, 28 Nov 2020 23:32:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=BF=81=E7=A7=BB=E4=B8=89=E6=96=B9=20Pay?= =?UTF-8?q?Client=20=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pay-service-project/pay-service-app/pom.xml | 19 +++ .../mall/payservice/client/package-info.java | 1 + .../thirdpay/AbstractThirdPayClient.java | 19 +-- .../client/thirdpay/PaySDKFactory.java | 24 ++++ .../client/thirdpay/PingxxThirdPayClient.java | 32 ++--- .../dto/ThirdPayRefundSuccessRespDTO.java | 6 +- .../ThirdPayTransactionSuccessRespDTO.java | 6 +- .../mysql/dataobject/refund}/PayRefundDO.java | 10 +- .../transaction}/PayRepeatTransactionDO.java | 2 +- .../PayTransactionExtensionDO.java | 10 +- pay/pay-application/pom.xml | 105 ---------------- .../src/main/resources/application-test.yaml | 6 - .../src/main/resources/application.yaml | 32 ----- pay/pay-service-api/pom.xml | 39 ------ .../mall/pay/biz/client/PaySDKFactory.java | 24 ---- .../pay/biz/dataobject/PayTransactionDO.java | 112 ------------------ pom.xml | 3 - 17 files changed, 94 insertions(+), 356 deletions(-) create mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/package-info.java rename pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/AbstractPaySDK.java => pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/AbstractThirdPayClient.java (70%) create mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/PaySDKFactory.java rename pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/PingxxPaySDK.java => pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/PingxxThirdPayClient.java (85%) rename pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/RefundSuccessBO.java => pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/dto/ThirdPayRefundSuccessRespDTO.java (75%) rename pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/TransactionSuccessBO.java => pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/dto/ThirdPayTransactionSuccessRespDTO.java (72%) rename {pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject => pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/refund}/PayRefundDO.java (85%) rename {pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject => pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction}/PayRepeatTransactionDO.java (77%) rename {pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject => pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction}/PayTransactionExtensionDO.java (69%) delete mode 100644 pay/pay-application/pom.xml delete mode 100644 pay/pay-application/src/main/resources/application-test.yaml delete mode 100644 pay/pay-application/src/main/resources/application.yaml delete mode 100644 pay/pay-service-api/pom.xml delete mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/PaySDKFactory.java delete mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionDO.java diff --git a/pay-service-project/pay-service-app/pom.xml b/pay-service-project/pay-service-app/pom.xml index f719ac414..06966ea3f 100644 --- a/pay-service-project/pay-service-app/pom.xml +++ b/pay-service-project/pay-service-app/pom.xml @@ -59,6 +59,14 @@ spring-boot-starter-actuator + + + Pingplusplus + pingpp-java + 2.2.4 + jar + + org.springframework.boot @@ -105,4 +113,15 @@ + + + + false + + central + bintray + http://jcenter.bintray.com + + + diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/package-info.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/package-info.java new file mode 100644 index 000000000..e211ca48a --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.mall.payservice.client; diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/AbstractPaySDK.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/AbstractThirdPayClient.java similarity index 70% rename from pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/AbstractPaySDK.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/AbstractThirdPayClient.java index 28f29475e..3d6bbe3bb 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/AbstractPaySDK.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/AbstractThirdPayClient.java @@ -1,13 +1,18 @@ -package cn.iocoder.mall.pay.biz.client; +package cn.iocoder.mall.payservice.client.thirdpay; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.pay.biz.dataobject.PayRefundDO; -import cn.iocoder.mall.pay.biz.dataobject.PayTransactionDO; -import cn.iocoder.mall.pay.biz.dataobject.PayTransactionExtensionDO; +import cn.iocoder.mall.payservice.client.thirdpay.dto.ThirdPayRefundSuccessRespDTO; +import cn.iocoder.mall.payservice.client.thirdpay.dto.ThirdPayTransactionSuccessRespDTO; +import cn.iocoder.mall.payservice.dal.mysql.dataobject.refund.PayRefundDO; +import cn.iocoder.mall.payservice.dal.mysql.dataobject.transaction.PayTransactionDO; +import cn.iocoder.mall.payservice.dal.mysql.dataobject.transaction.PayTransactionExtensionDO; import java.util.Map; -public abstract class AbstractPaySDK { +/** + * 三方支付平台的 Client 抽象类 + */ +public abstract class AbstractThirdPayClient { /** * 提交支付请求给支付平台,并返回请求结果 @@ -28,7 +33,7 @@ public abstract class AbstractPaySDK { * @return 解析结果 */ // TODO 芋艿,理论来说不会出现解析失败的情况,先返回这个参数列。等后面封装支付宝和微信支付的时候,在看看。 - public abstract CommonResult parseTransactionSuccessParams(String params); + public abstract CommonResult parseTransactionSuccessParams(String params); /** * 提交退款请求给支付平台,并返回请求结果 @@ -49,6 +54,6 @@ public abstract class AbstractPaySDK { * @return 解析结果 */ // TODO 芋艿,理论来说不会出现解析失败的情况,先返回这个参数列。等后面封装支付宝和微信支付的时候,在看看。 - public abstract CommonResult parseRefundSuccessParams(String params); + public abstract CommonResult parseRefundSuccessParams(String params); } diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/PaySDKFactory.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/PaySDKFactory.java new file mode 100644 index 000000000..46d0b449c --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/PaySDKFactory.java @@ -0,0 +1,24 @@ +package cn.iocoder.mall.payservice.client.thirdpay; + +import cn.iocoder.mall.payservice.enums.PayChannelEnum; + +import java.util.HashMap; +import java.util.Map; + +public class PaySDKFactory { + + private static Map CLIENTS = new HashMap<>(); + + static { + CLIENTS.put(PayChannelEnum.PINGXX.getId(), new PingxxThirdPayClient()); + } + + public static AbstractThirdPayClient getSDK(Integer payChannel) { + AbstractThirdPayClient client = CLIENTS.get(payChannel); + if (client == null) { + throw new NullPointerException("找不到合适的 ThirdPayClient :" + payChannel); + } + return client; + } + +} diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/PingxxPaySDK.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/PingxxThirdPayClient.java similarity index 85% rename from pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/PingxxPaySDK.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/PingxxThirdPayClient.java index 9cbbe1102..e58012caf 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/PingxxPaySDK.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/PingxxThirdPayClient.java @@ -1,9 +1,11 @@ -package cn.iocoder.mall.pay.biz.client; +package cn.iocoder.mall.payservice.client.thirdpay; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.pay.biz.dataobject.PayRefundDO; -import cn.iocoder.mall.pay.biz.dataobject.PayTransactionDO; -import cn.iocoder.mall.pay.biz.dataobject.PayTransactionExtensionDO; +import cn.iocoder.mall.payservice.client.thirdpay.dto.ThirdPayRefundSuccessRespDTO; +import cn.iocoder.mall.payservice.client.thirdpay.dto.ThirdPayTransactionSuccessRespDTO; +import cn.iocoder.mall.payservice.dal.mysql.dataobject.refund.PayRefundDO; +import cn.iocoder.mall.payservice.dal.mysql.dataobject.transaction.PayTransactionDO; +import cn.iocoder.mall.payservice.dal.mysql.dataobject.transaction.PayTransactionExtensionDO; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.google.common.collect.ImmutableMap; @@ -17,7 +19,7 @@ import java.util.HashMap; import java.util.Map; // TODO 代码略乱,后面重构下 -public class PingxxPaySDK extends AbstractPaySDK { +public class PingxxThirdPayClient extends AbstractThirdPayClient { static { Pingpp.privateKeyPath = "/Users/yunai/Downloads/pingxx.pem"; @@ -65,14 +67,14 @@ public class PingxxPaySDK extends AbstractPaySDK { } @Override - public CommonResult parseTransactionSuccessParams(String params) { + public CommonResult parseTransactionSuccessParams(String params) { JSONObject paramsObj = JSON.parseObject(params); JSONObject chargeObj = paramsObj.getJSONObject("data").getJSONObject("object"); - TransactionSuccessBO transactionPaySuccessBO = new TransactionSuccessBO() + ThirdPayTransactionSuccessRespDTO successRespDTO = new ThirdPayTransactionSuccessRespDTO() .setTransactionCode(chargeObj.getString("order_no")) .setPaymentTime(new Date(chargeObj.getLong("time_paid") * 1000)) .setTradeNo(chargeObj.getString("transaction_no")); - return CommonResult.success(transactionPaySuccessBO); + return CommonResult.success(successRespDTO); } @Override @@ -99,16 +101,16 @@ public class PingxxPaySDK extends AbstractPaySDK { // {"id":"evt_400190427005305341228202","created":1556297585,"livemode":false,"type":"refund.succeeded","data":{"object":{"id":"re_HO0m9GOGOi50KCmX104ufHe1","object":"refund","order_no":"HO0m9GOGOi50KCmX104ufHe1","amount":1,"created":1556297585,"succeed":true,"status":"succeeded","time_succeed":1556297585,"description":"测试下退款","failure_code":null,"failure_msg":null,"metadata":{},"charge":"ch_y1iXjLnDS4G4OO4uT4a5C4W1","charge_order_no":"20190427004410165545","transaction_no":"201904270053053608824","extra":{}}},"object":"event","request":"iar_Oa188KCiHC40iLibbHX5WrHC","pending_webhooks":0} @Override - public CommonResult parseRefundSuccessParams(String params) { + public CommonResult parseRefundSuccessParams(String params) { JSONObject paramsObj = JSON.parseObject(params); JSONObject chargeObj = paramsObj.getJSONObject("data").getJSONObject("object"); - RefundSuccessBO refundSuccessBO = new RefundSuccessBO() + ThirdPayRefundSuccessRespDTO successRespDTO = new ThirdPayRefundSuccessRespDTO() .setRefundCode(chargeObj.getJSONObject("metadata").getString("refundCode")) .setRefundTime(new Date(chargeObj.getLong("time_succeed") * 1000)) .setTradeNo(chargeObj.getString("transaction_no")) // TODO 芋艿,需要测试下,退款失败 .setSuccess(chargeObj.containsValue("failure_code") || chargeObj.containsValue("failure_msg")); - return CommonResult.success(refundSuccessBO); + return CommonResult.success(successRespDTO); } private Map createRefundRequest(PayRefundDO refund, String chargeId, String orderDescription, Integer price) { @@ -123,7 +125,7 @@ public class PingxxPaySDK extends AbstractPaySDK { } public static void main(String[] args) { - if (false) { // 测试支付请求 + if (true) { // 测试支付请求 PayTransactionDO transaction = new PayTransactionDO(); transaction.setOrderSubject("测试商品"); transaction.setOrderDescription("测试描述"); @@ -133,14 +135,14 @@ public class PingxxPaySDK extends AbstractPaySDK { extension.setTransactionCode(System.currentTimeMillis() + ""); extension.setCreateIp("127.0.0.1"); - new PingxxPaySDK().submitTransaction(transaction, extension, null); + new PingxxThirdPayClient().submitTransaction(transaction, extension, null); } - if (true) { // 测试退款请求 + if (false) { // 测试退款请求 PayRefundDO refund = new PayRefundDO().setPrice(9999999).setOrderDescription("测试描述"); PayTransactionExtensionDO transactionExtension = new PayTransactionExtensionDO() .setExtensionData("{\"id\":\"evt_400190423100354205607502\",\"created\":1555985033,\"livemode\":false,\"type\":\"charge.succeeded\",\"data\":{\"object\":{\"id\":\"ch_DCGyXTmDGuHKb1C0yTzjPOGC\",\"object\":\"charge\",\"created\":1555985032,\"livemode\":false,\"paid\":true,\"refunded\":false,\"reversed\":false,\"app\":\"app_aTyfXDjrvzDSbLuz\",\"channel\":\"wx_pub\",\"order_no\":\"20190423100352158401\",\"client_ip\":\"114.87.158.59\",\"amount\":10,\"amount_settle\":10,\"currency\":\"cny\",\"subject\":\"kafka 实战\",\"body\":\"测试描述\",\"extra\":{\"open_id\":\"just_for_test\",\"bank_type\":\"your bank type\"},\"time_paid\":1555985033,\"time_expire\":1555992232,\"time_settle\":null,\"transaction_no\":\"1244341374201904238178164740\",\"refunds\":{\"object\":\"list\",\"url\":\"/v1/charges/ch_DCGyXTmDGuHKb1C0yTzjPOGC/refunds\",\"has_more\":false,\"data\":[]},\"amount_refunded\":0,\"failure_code\":null,\"failure_msg\":null,\"metadata\":{},\"credential\":{},\"description\":\"测试备注\"}},\"object\":\"event\",\"request\":\"iar_4e9mPODW5ujPqLen5OOmvL8S\",\"pending_webhooks\":0}"); - new PingxxPaySDK().submitRefund(refund, transactionExtension, null); + new PingxxThirdPayClient().submitRefund(refund, transactionExtension, null); } } diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/RefundSuccessBO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/dto/ThirdPayRefundSuccessRespDTO.java similarity index 75% rename from pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/RefundSuccessBO.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/dto/ThirdPayRefundSuccessRespDTO.java index 64624df22..ce2233449 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/RefundSuccessBO.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/dto/ThirdPayRefundSuccessRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.pay.biz.client; +package cn.iocoder.mall.payservice.client.thirdpay.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -6,11 +6,11 @@ import lombok.experimental.Accessors; import java.util.Date; /** - * 交易退款成功结果 + * 三方平台的交易退款成功 Response DTO */ @Data @Accessors(chain = true) -public class RefundSuccessBO { +public class ThirdPayRefundSuccessRespDTO { /** * 生成传输给第三方的订单号 diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/TransactionSuccessBO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/dto/ThirdPayTransactionSuccessRespDTO.java similarity index 72% rename from pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/TransactionSuccessBO.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/dto/ThirdPayTransactionSuccessRespDTO.java index 038791f95..1bfae7509 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/TransactionSuccessBO.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/client/thirdpay/dto/ThirdPayTransactionSuccessRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.pay.biz.client; +package cn.iocoder.mall.payservice.client.thirdpay.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -6,11 +6,11 @@ import lombok.experimental.Accessors; import java.util.Date; /** - * 交易支付成功结果 + * 三方平台的交易支付成功 Response DTO */ @Data @Accessors(chain = true) -public class TransactionSuccessBO { +public class ThirdPayTransactionSuccessRespDTO { /** * 生成传输给第三方的订单号 diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayRefundDO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/refund/PayRefundDO.java similarity index 85% rename from pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayRefundDO.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/refund/PayRefundDO.java index e66cec676..92268f848 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayRefundDO.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/refund/PayRefundDO.java @@ -1,7 +1,9 @@ -package cn.iocoder.mall.pay.biz.dataobject; +package cn.iocoder.mall.payservice.dal.mysql.dataobject.refund; -import cn.iocoder.common.framework.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import java.util.Date; @@ -9,9 +11,11 @@ import java.util.Date; /** * 退款单 DO */ +@TableName("pay_refund") @Data +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) -public class PayRefundDO extends BaseDO { +public class PayRefundDO extends DeletableDO { /** * 编号,自增 diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayRepeatTransactionDO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/PayRepeatTransactionDO.java similarity index 77% rename from pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayRepeatTransactionDO.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/PayRepeatTransactionDO.java index 2452db36b..813e680b8 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayRepeatTransactionDO.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/PayRepeatTransactionDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.pay.biz.dataobject; +package cn.iocoder.mall.payservice.dal.mysql.dataobject.transaction; import lombok.Data; import lombok.experimental.Accessors; diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionExtensionDO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/PayTransactionExtensionDO.java similarity index 69% rename from pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionExtensionDO.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/PayTransactionExtensionDO.java index f6071043b..d63b43f61 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionExtensionDO.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/PayTransactionExtensionDO.java @@ -1,13 +1,17 @@ -package cn.iocoder.mall.pay.biz.dataobject; +package cn.iocoder.mall.payservice.dal.mysql.dataobject.transaction; -import cn.iocoder.common.framework.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** * 交易扩展表 */ +@TableName("pay_transaction_extension") @Data +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) public class PayTransactionExtensionDO extends DeletableDO { @@ -42,7 +46,7 @@ public class PayTransactionExtensionDO extends DeletableDO { /** * 状态 * - * @see cn.iocoder.mall.pay.api.constant.PayTransactionStatusEnum + * @see cn.iocoder.mall.payservice.enums.transaction.PayTransactionStatusEnum * 注意,只包含上述枚举的 WAITING 和 SUCCESS */ private Integer status; diff --git a/pay/pay-application/pom.xml b/pay/pay-application/pom.xml deleted file mode 100644 index f7b70d7b4..000000000 --- a/pay/pay-application/pom.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - pay - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - pay-application - - - - - cn.iocoder.mall - common-framework - 1.0-SNAPSHOT - - - cn.iocoder.mall - mall-spring-boot - 1.0-SNAPSHOT - - - cn.iocoder.mall - pay-service-impl - 1.0-SNAPSHOT - - - cn.iocoder.mall - system-sdk - 1.0-SNAPSHOT - - - cn.iocoder.mall - user-sdk - 1.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-web - - - - io.springfox - springfox-swagger2 - - - com.github.xiaoymin - swagger-bootstrap-ui - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-sentinel - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - de.codecentric - spring-boot-admin-starter-client - - - - org.springframework.boot - spring-boot-starter-actuator - - - - io.micrometer - micrometer-registry-prometheus - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/pay/pay-application/src/main/resources/application-test.yaml b/pay/pay-application/src/main/resources/application-test.yaml deleted file mode 100644 index fe7f43541..000000000 --- a/pay/pay-application/src/main/resources/application-test.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swagger: - enable: true - title: 支付子系统 - description: 支付子系统 - version: 1.0.0 - base-package: cn.iocoder.mall.pay.application.controller diff --git a/pay/pay-application/src/main/resources/application.yaml b/pay/pay-application/src/main/resources/application.yaml deleted file mode 100644 index 4fce75138..000000000 --- a/pay/pay-application/src/main/resources/application.yaml +++ /dev/null @@ -1,32 +0,0 @@ -spring: - application: - name: pay-application - - # Spring Cloud 配置项 - cloud: - # Spring Cloud Sentinel 配置项 - sentinel: - transport: - dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址 - eager: true # 项目启动时,直接连接到 Sentinel - -# server -server: - port: 18084 - servlet: - context-path: /pay-api/ - -swagger: - enable: true - title: 支付子系统 - description: 支付子系统 - version: 1.0.0 - base-package: cn.iocoder.mall.pay.application.controller - -management: - endpoints: - web: - exposure: - include: health,info,env,metrics,prometheus - metrics: - enabled: true diff --git a/pay/pay-service-api/pom.xml b/pay/pay-service-api/pom.xml deleted file mode 100644 index d862a0d36..000000000 --- a/pay/pay-service-api/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - pay - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - pay-service-api - - - - - cn.iocoder.mall - common-framework - 1.0-SNAPSHOT - - - - - org.mapstruct - mapstruct - - - org.mapstruct - mapstruct-jdk8 - - - - org.projectlombok - lombok - - - - - diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/PaySDKFactory.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/PaySDKFactory.java deleted file mode 100644 index 1efbebfcf..000000000 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/client/PaySDKFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.mall.pay.biz.client; - -import cn.iocoder.mall.pay.api.constant.PayChannelEnum; - -import java.util.HashMap; -import java.util.Map; - -public class PaySDKFactory { - - private static Map SDKS = new HashMap<>(); - - static { - SDKS.put(PayChannelEnum.PINGXX.getId(), new PingxxPaySDK()); - } - - public static AbstractPaySDK getSDK(Integer payChannel) { - AbstractPaySDK sdk = SDKS.get(payChannel); - if (sdk == null) { - throw new NullPointerException("找不到合适的 PaySDK :" + payChannel); - } - return sdk; - } - -} \ No newline at end of file diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionDO.java deleted file mode 100644 index a7eeabb7f..000000000 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayTransactionDO.java +++ /dev/null @@ -1,112 +0,0 @@ -package cn.iocoder.mall.pay.biz.dataobject; - -import cn.iocoder.common.framework.dataobject.DeletableDO; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * 支付交易 DO - */ -@Data -@Accessors(chain = true) -public class PayTransactionDO extends DeletableDO { - - /** - * 编号,自增 - */ - private Integer id; - /** - * 应用编号 - * - * 不同业务线分配不同的 appId - * 举个例子, - * 1. 电商系统的订单,appId = 1024 - * 2. 活动系统的订单,appId = 2048 - */ - private String appId; - /** - * 业务线的订单编号 - * - * 1. 使用 String 的原因是,业务线可能使用 String 做为编号 - * 2. 每个 appId 下,orderId 唯一 - */ - private String orderId; - /** - * 发起交易的 IP - */ - private String createIp; - /** - * 订单商品名 - */ - private String orderSubject; - /** - * 订单商品描述 - */ - private String orderDescription; - /** - * 订单备注 - */ - private String orderMemo; - /** - * 支付金额,单位:分。 - * - * TODO 暂时不考虑货币类型。 - */ - private Integer price; - /** - * 支付状态 - * - * @see cn.iocoder.mall.pay.api.constant.PayTransactionStatusEnum - */ - private Integer status; - /** - * 交易过期时间 - */ - private Date expireTime; - /** - * 回调业务线完成时间 - */ - private Date finishTime; - /** - * 异步通知地址 - */ - private String notifyUrl; - // TODO return url - - /** - * 成功支付的交易拓展编号 - * - * @see PayTransactionExtensionDO#getId() - */ - private Integer extensionId; - /** - * 支付成功的支付渠道 - * - * @see cn.iocoder.mall.pay.api.constant.PayChannelEnum - */ - private Integer payChannel; - /** - * 第三方支付成功的时间 - */ - private Date paymentTime; - /** - * 收到第三方系统通知的时间 - * - * 一般情况下,即第三方系统的异步通知 - */ - private Date notifyTime; - /** - * 第三方的流水号 - */ - private String tradeNo; - - // ========== 退款相关 ========== - - /** - * 退款总金额 - */ - private Integer refundTotal; - -} diff --git a/pom.xml b/pom.xml index 56004b0e7..2227b0297 100644 --- a/pom.xml +++ b/pom.xml @@ -14,10 +14,7 @@ onemall 1.0-SNAPSHOT - common - - mall-dependencies user-service-project user-web-app