提交新功能 分销商 积分 会员体系
This commit is contained in:
@ -36,26 +36,26 @@ public class AliPayMessageHandler implements PayMessageHandler<AliPayMessage, Al
|
||||
@Override
|
||||
public PayOutMessage handle(AliPayMessage payMessage, Map<String, Object> context, AliPayService payService) throws PayErrorException {
|
||||
|
||||
Map<String, Object> message = payMessage.getPayMessage();
|
||||
//交易状态
|
||||
String trade_status = (String) message.get("trade_status");
|
||||
|
||||
//交易完成
|
||||
if ("TRADE_SUCCESS".equals(trade_status) || "TRADE_FINISHED".equals(trade_status)) {
|
||||
|
||||
String orderNo = (String) payMessage.getPayMessage().get("out_trade_no");
|
||||
//截取订单编号
|
||||
String[] split = orderNo.split("-");
|
||||
if (split.length > 0) {
|
||||
String orderId = split[0];
|
||||
log.info("支付宝回调消息处理,发送处理消息orderId={}", split[0]);
|
||||
//消息队列处理
|
||||
payNoticeProducer.sendPayNoticeMessage(orderId, PayTypeEnum.ALI.getValue());
|
||||
log.info("支付宝回调消息发送完毕");
|
||||
return payService.getPayOutMessage("success", "成功");
|
||||
}
|
||||
}
|
||||
|
||||
// Map<String, Object> message = payMessage.getPayMessage();
|
||||
// //交易状态
|
||||
// String trade_status = (String) message.get("trade_status");
|
||||
//
|
||||
// //交易完成
|
||||
// if ("TRADE_SUCCESS".equals(trade_status) || "TRADE_FINISHED".equals(trade_status)) {
|
||||
//
|
||||
// String orderNo = (String) payMessage.getPayMessage().get("out_trade_no");
|
||||
// //截取订单编号
|
||||
// String[] split = orderNo.split("-");
|
||||
// if (split.length > 0) {
|
||||
// String orderId = split[0];
|
||||
// log.info("支付宝回调消息处理,发送处理消息orderId={}", split[0]);
|
||||
// //消息队列处理
|
||||
// payNoticeProducer.sendPayNoticeMessage(orderId, PayTypeEnum.ALI.getType());
|
||||
// log.info("支付宝回调消息发送完毕");
|
||||
// return payService.getPayOutMessage("success", "成功");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
return payService.getPayOutMessage("fail", "失败");
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class WxPayMessageHandler implements PayMessageHandler<WxPayMessage, PayS
|
||||
String orderId = (String) payMessage.getPayMessage().get("out_trade_no");
|
||||
//消息队列处理
|
||||
log.info("微信回调消息处理,发送处理消息orderId={}",orderId);
|
||||
payNoticeProducer.sendPayNoticeMessage(orderId, PayTypeEnum.WEIXIN.getValue());
|
||||
payNoticeProducer.sendPayNoticeMessage(orderId, PayTypeEnum.WEIXIN.getType());
|
||||
|
||||
return payService.getPayOutMessage("SUCCESS", "OK");
|
||||
}
|
||||
|
@ -5,5 +5,7 @@ import co.yixiang.yshop.framework.common.exception.ErrorCode;
|
||||
public interface ErrorCodeConstants {
|
||||
// ========== 支付服务商配置 TODO 补充编号 ==========
|
||||
ErrorCode MERCHANT_DETAILS_NOT_EXISTS = new ErrorCode(1008009000, "支付服务商配置不存在");
|
||||
|
||||
ErrorCode PAY_TYPE_NOT_EXISTS = new ErrorCode(800000000, "支付类型不存在");
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.yshop.module.pay.enums;
|
||||
|
||||
// 支付订单常亮
|
||||
public interface PayOrderConstants {
|
||||
|
||||
// 充值订单前缀
|
||||
String RECHARGE_ORDER_PREFIX = "REC";
|
||||
|
||||
String PAY_DESC = "Yshop商城";
|
||||
|
||||
// 微信回调返回
|
||||
String WEINXIN_RESULT = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||
|
||||
// 商品回调地址
|
||||
String PAY_REDIRECT_URL = "pages/payStatus/index?type=1";
|
||||
|
||||
// 充值回调地址
|
||||
String RECHARGE_REDIRECT_URL = "views/account/balance/index";
|
||||
}
|
@ -18,26 +18,24 @@ import java.util.stream.Stream;
|
||||
@AllArgsConstructor
|
||||
public enum PayTypeEnum {
|
||||
|
||||
ALI("alipay","支付宝支付"),
|
||||
ALI_H5("alipay_h5","微信支付"),
|
||||
ALI_APP("alipay_app","微信支付"),
|
||||
WEIXIN("weixin","微信支付"),
|
||||
WEIXIN_H5("weixin_h5","微信H5支付"),
|
||||
WEIXIN_APPLET("weixin_applet","微信小程序支付"),
|
||||
WEIXIN_APP("weixin_app","微信app支付"),
|
||||
|
||||
YUE("yue","余额支付"),
|
||||
INTEGRAL("integral","积分兑换");
|
||||
|
||||
|
||||
private String value;
|
||||
private String type;
|
||||
|
||||
private String desc;
|
||||
|
||||
public static PayTypeEnum toType(String value) {
|
||||
public static PayTypeEnum toType(String type) {
|
||||
return Stream.of(PayTypeEnum.values())
|
||||
.filter(p -> p.value.equals(value))
|
||||
.filter(p -> p.type.equals(type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.yshop.module.pay.mq.message;
|
||||
|
||||
import co.yixiang.yshop.framework.mq.core.stream.AbstractStreamMessage;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PayRefundMessage extends AbstractStreamMessage {
|
||||
|
||||
/**
|
||||
* 退款订单id集合
|
||||
*/
|
||||
private List<Long> ids;
|
||||
|
||||
@Override
|
||||
public String getStreamKey() {
|
||||
return "order.pay.refund";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user