diff --git a/kernel-d-pay/pay-api/pom.xml b/kernel-d-pay/pay-api/pom.xml new file mode 100644 index 000000000..b8e92f1ba --- /dev/null +++ b/kernel-d-pay/pay-api/pom.xml @@ -0,0 +1,23 @@ + + + + kernel-d-pay + cn.stylefeng.roses + 7.0.4 + + 4.0.0 + + pay-api + + + 8 + 8 + + + + + + + \ No newline at end of file diff --git a/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/PayApi.java b/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/PayApi.java new file mode 100644 index 000000000..3c0604a76 --- /dev/null +++ b/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/PayApi.java @@ -0,0 +1,79 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.pay.api; + + +import cn.stylefeng.roses.kernel.pay.api.pojo.TradeRefundResponse; + +/** + * 支付的api + * + * @author huziyang + * @date 2021/04/20 20:43 + */ +public interface PayApi { + + /** + * PC网页支付 + * + * @param orderName 订单名称 + * @param outTradeNo 商家订单编号 + * @param total 金额 + * @param returnUrl 付款完成后跳转页面 + * @return 支付页面 + * @author huziyang + * @date 2021/04/20 20:43 + */ + String page(String orderName, String outTradeNo, String total, String returnUrl); + + + /** + * 手机支付 + * + * @param orderName 订单名称 + * @param outTradeNo 商家订单编号 + * @param total 金额 + * @param quitUrl 中途退出时返回的页面 + * @param returnUrl 付款完成后跳转页面 + * @return 支付页面 + * @author huziyang + * @date 2021/04/20 20:43 + */ + String wap(String orderName, String outTradeNo, String total, String quitUrl, String returnUrl); + + + /** + * 退款 + * + * @param outTradeNo 商家订单编号 + * @param refundAmount 退款金额 + * @return 退款结果 + * @author huziyang + * @date 2021/04/20 20:43 + */ + TradeRefundResponse refund(String outTradeNo, String refundAmount); + + +} diff --git a/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/constants/PayConstants.java b/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/constants/PayConstants.java new file mode 100644 index 000000000..5a1384847 --- /dev/null +++ b/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/constants/PayConstants.java @@ -0,0 +1,56 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.pay.api.constants; + +/** + * 支付模块的常量 + * + * @author huziyang + * @date 2021/04/20 20:43 + */ +public interface PayConstants { + + /** + * mongodb模块的名称 + */ + String PAY_MODULE_NAME = "kernel-d-pay"; + + /** + * 异常枚举的步进值 + */ + String PAY_EXCEPTION_STEP_CODE = "80"; + + + /** + * 退款成功的返回码 + */ + String REFUND_SUCCESS_CODE = "10000"; + + /** + * 退款失败的返回码 + */ + String REFUND_ERROR_CODE = "40000"; + +} diff --git a/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/exception/PayException.java b/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/exception/PayException.java new file mode 100644 index 000000000..594fad767 --- /dev/null +++ b/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/exception/PayException.java @@ -0,0 +1,43 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.pay.api.exception; + +import cn.stylefeng.roses.kernel.pay.api.constants.PayConstants; +import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum; +import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException; + +/** + * 支付模块的异常 + * + * @author huziyang + * @date 2021/04/20 20:43 + */ +public class PayException extends ServiceException { + + public PayException(AbstractExceptionEnum exception) { + super(PayConstants.PAY_MODULE_NAME, exception); + } + +} diff --git a/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/pojo/TradeRefundResponse.java b/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/pojo/TradeRefundResponse.java new file mode 100644 index 000000000..41291a1a4 --- /dev/null +++ b/kernel-d-pay/pay-api/src/main/java/cn/stylefeng/roses/kernel/pay/api/pojo/TradeRefundResponse.java @@ -0,0 +1,129 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.pay.api.pojo; + +import cn.stylefeng.roses.kernel.pay.api.constants.PayConstants; +import lombok.*; + +/** + * 退款响应 + * + * @author huziyang + * @date 2021/04/20 20:43 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class TradeRefundResponse{ + + /** + * 退款状态码 + */ + private String code; + + /** + * 状态描述 + */ + private String msg; + + /** + * 商家订单号 + */ + private String outTradeNo; + + /** + * 退款金额 + */ + private String refundFee; + + /** + * 各厂商系统中的交易流水号 + */ + private String tradeNo; + + /** + * 退款实际的发生时间 + */ + private String gmtRefundPay; + + /** + * 买家账号 + */ + private String buyerLogonId; + + /** + * 买家在各厂商系统中的用户id + */ + private String buyerUserId; + + /** + * 各厂商响应值 + */ + private Object data; + + /** + * 初始化一个新创建的 TradeRefundResponse对象 + * + * @param code 状态码 + * @param msg 描述 + * @param data 对象值 + * @author huziyang + * @date 2021/04/20 20:43 + */ + public TradeRefundResponse(String code, String msg, Object data){ + this.code = code; + this.msg = msg; + this.data = data; + } + + /** + * 返回错误信息 + * + * @param msg 描述 + * @param data 对象值 + * @return TradeRefundResponse对象 + * @author huziyang + * @date 2021/04/20 20:43 + */ + public static TradeRefundResponse error(String msg, Object data){ + return new TradeRefundResponse(PayConstants.REFUND_ERROR_CODE,msg,data); + } + + + /** + * 返回错误信息 + * + * @param msg 描述 + * @return TradeRefundResponse对象 + * @author huziyang + * @date 2021/04/20 20:43 + */ + public static TradeRefundResponse error(String msg){ + return error(msg,null); + } + + +} diff --git a/kernel-d-pay/pom.xml b/kernel-d-pay/pom.xml new file mode 100644 index 000000000..f5611541b --- /dev/null +++ b/kernel-d-pay/pom.xml @@ -0,0 +1,34 @@ + + + + roses-kernel + cn.stylefeng.roses + 7.0.4 + + 4.0.0 + + kernel-d-pay + pom + + pay-api + pay-sdk-alipay + + + + 8 + 8 + + + + + + + cn.stylefeng.roses + kernel-a-rule + 7.0.4 + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 953dd9c0d..3f42d17d6 100644 --- a/pom.xml +++ b/pom.xml @@ -94,6 +94,9 @@ kernel-d-mongodb + + kernel-d-pay + kernel-s-system