【7.0.4】整理支付代码

pull/22/head
fengshuonan 2021-06-01 22:29:04 +08:00
parent 1f3a58c356
commit 2b8ec525b6
12 changed files with 41 additions and 61 deletions

View File

@ -11,10 +11,4 @@
<artifactId>pay-api</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
</project>

View File

@ -38,36 +38,34 @@ public interface PayApi {
/**
* PC
*
* @param orderName
* @param orderName
* @param outTradeNo
* @param total
* @param returnUrl
* @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 orderName
* @param outTradeNo
* @param total
* @param quitUrl 退
* @param returnUrl
* @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 outTradeNo
* @param refundAmount 退
* @return 退
* @author huziyang
@ -75,5 +73,4 @@ public interface PayApi {
*/
TradeRefundResponse refund(String outTradeNo, String refundAmount);
}

View File

@ -42,7 +42,6 @@ public interface PayConstants {
*/
String PAY_EXCEPTION_STEP_CODE = "80";
/**
* 退
*/

View File

@ -25,7 +25,10 @@
package cn.stylefeng.roses.kernel.pay.api.pojo;
import cn.stylefeng.roses.kernel.pay.api.constants.PayConstants;
import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 退
@ -37,7 +40,7 @@ import lombok.*;
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TradeRefundResponse{
public class TradeRefundResponse {
/**
* 退
@ -88,12 +91,12 @@ public class TradeRefundResponse{
* TradeRefundResponse
*
* @param code
* @param msg
* @param msg
* @param data
* @author huziyang
* @date 2021/04/20 20:43
*/
public TradeRefundResponse(String code, String msg, Object data){
public TradeRefundResponse(String code, String msg, Object data) {
this.code = code;
this.msg = msg;
this.data = data;
@ -102,17 +105,16 @@ public class TradeRefundResponse{
/**
*
*
* @param msg
* @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);
public static TradeRefundResponse error(String msg, Object data) {
return new TradeRefundResponse(PayConstants.REFUND_ERROR_CODE, msg, data);
}
/**
*
*
@ -121,9 +123,8 @@ public class TradeRefundResponse{
* @author huziyang
* @date 2021/04/20 20:43
*/
public static TradeRefundResponse error(String msg){
return error(msg,null);
public static TradeRefundResponse error(String msg) {
return error(msg, null);
}
}

View File

@ -11,25 +11,20 @@
<artifactId>pay-sdk-alipay</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!--支付模块的api-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>pay-api</artifactId>
<version>7.0.4</version>
<version>${roses.version}</version>
</dependency>
<!--阿里支付sdk-->
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-easysdk</artifactId>
<version>2.2.0</version>
<version>${alipay.version}</version>
</dependency>
</dependencies>

View File

@ -48,7 +48,7 @@ public class AlipayConfig implements ApplicationRunner {
/**
*
*/
*/
@Value("${alipay.merchantPrivateKey}")
private String merchantPrivateKey;
@ -132,5 +132,4 @@ public class AlipayConfig implements ApplicationRunner {
return config;
}
}

View File

@ -33,4 +33,5 @@ package cn.stylefeng.roses.kernel.pay.alipay.constants;
public interface AlipayConstants {
String ALIPAY_REFUND_SUCCESS_CODE = "10000";
}

View File

@ -38,36 +38,34 @@ public interface AlipayService {
/**
* PC
*
* @param orderName
* @param orderName
* @param outTradeNo
* @param total
* @param returnUrl
* @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 orderName
* @param outTradeNo
* @param total
* @param quitUrl 退
* @param returnUrl
* @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 outTradeNo
* @param refundAmount 退
* @return 退
* @author huziyang
@ -75,5 +73,4 @@ public interface AlipayService {
*/
TradeRefundResponse refund(String outTradeNo, String refundAmount);
}

View File

@ -44,7 +44,6 @@ import org.springframework.stereotype.Service;
@Slf4j
public class AlipayServiceImpl implements AlipayService, PayApi {
@Override
public String page(String orderName, String outTradeNo, String total, String returnUrl) {
try {
@ -58,7 +57,7 @@ public class AlipayServiceImpl implements AlipayService, PayApi {
@Override
public String wap(String orderName, String outTradeNo, String total, String quitUrl, String returnUrl) {
try {
return Factory.Payment.Wap().pay(orderName, outTradeNo, total, quitUrl, returnUrl).body;
return Factory.Payment.Wap().pay(orderName, outTradeNo, total, quitUrl, returnUrl).body;
} catch (Exception e) {
log.error(e.getMessage());
return e.getMessage();
@ -69,7 +68,7 @@ public class AlipayServiceImpl implements AlipayService, PayApi {
public TradeRefundResponse refund(String outTradeNo, String refundAmount) {
try {
AlipayTradeRefundResponse response = Factory.Payment.Common().refund(outTradeNo, refundAmount);
if (AlipayConstants.ALIPAY_REFUND_SUCCESS_CODE.equals(response.getCode())){
if (AlipayConstants.ALIPAY_REFUND_SUCCESS_CODE.equals(response.getCode())) {
return TradeRefundResponse.builder()
.code(PayConstants.REFUND_SUCCESS_CODE)
.msg(response.getMsg())
@ -82,10 +81,11 @@ public class AlipayServiceImpl implements AlipayService, PayApi {
.data(response)
.build();
}
return TradeRefundResponse.error(response.msg,response);
return TradeRefundResponse.error(response.msg, response);
} catch (Exception e) {
log.error(e.getMessage());
return TradeRefundResponse.error(e.getMessage());
}
}
}

View File

@ -11,18 +11,15 @@
<artifactId>pay-spring-boot-starter</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!--alipay api模块的sdk-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>pay-sdk-alipay</artifactId>
<version>7.0.4</version>
<version>${roses.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -49,6 +49,5 @@ public class GunsPayAutoConfiguration {
return new AlipayServiceImpl();
}
}

View File

@ -20,6 +20,7 @@
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<alipay.version>2.2.0</alipay.version>
</properties>
<dependencies>
@ -28,7 +29,7 @@
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-a-rule</artifactId>
<version>7.0.4</version>
<version>${roses.version}</version>
</dependency>
</dependencies>