Commit 1db90850 by ping.wu

Merge remote-tracking branch 'origin/qa' into qa

parents 8f3b3993 7ad60200
......@@ -13,14 +13,14 @@ package com.freemud.sdk.api.assortment.order.enums;
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
public enum PayRefundStatus {
SUCCESS(1,"退款成功"),
FAIL(2,"退款失败"),
RUNNING(4,"退款中"),
SUCCESS(1, "退款成功"),
FAIL(2, "退款失败"),
RUNNING(4, "退款中"),
/**
* 额外状态码 用于判断逻辑,
*/
NOT_SUFFICIENT_FUNDS(8200201,"余额不足"),
COMPATIBILITY_STATUS(9999999,"退款异常");
NOT_SUFFICIENT_FUNDS(8200201, "余额不足"),
COMPATIBILITY_STATUS(9999999, "退款异常");
private Integer code;
private String desc;
......@@ -30,17 +30,27 @@ public enum PayRefundStatus {
this.desc = desc;
}
public static PayRefundStatus getByCode(Integer code) {
public static PayRefundStatus getByPayResultCode(Integer code) {
if (code == null) {
return null;
return PayRefundStatus.FAIL;
}
for (PayRefundStatus payStatus : values()) {
if (payStatus.getCode().equals(code)) {
return payStatus;
switch (code) {
// 退款中状态码需要单独处理
case 8200305:
return PayRefundStatus.RUNNING;
// 重复请求,按照退款中处理
case 82004005:
return PayRefundStatus.RUNNING;
// 退款成功
case 100:
return PayRefundStatus.SUCCESS;
// 已退款订单 当做退款成功处理
case 101:
return PayRefundStatus.SUCCESS;
default:
return PayRefundStatus.FAIL;
}
}
return null;
}
public Integer getCode() {
return code;
......
package com.freemud.sdk.api.assortment.order.response.order;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -33,6 +32,10 @@ public class MultiOrderRefundResponse<T> {
* 退款成功
*/
public static Integer REFUND_SUCCESS = 100;
/**
* 101已退款订单(当成功处理)
*/
public static Integer REFUND_SUCCESSED = 101;
private String endTransTradeNo;
private String fmRefundNo;
private String fmTradeNo;
......@@ -50,7 +53,7 @@ public class MultiOrderRefundResponse<T> {
private String transId;
private String ebcode;
@ApiModelProperty(value = "业务返回码 8200305 代表退款中 100是成功 其他 都是失败")
@ApiModelProperty(value = "业务返回码 8200305 代表退款中 100是成功 101已退款订单(当成功处理) 其他 都是失败")
private Integer resultCode;
@ApiModelProperty(value = "业务返回消息")
......
......@@ -130,7 +130,7 @@ public class OrderCallBackConfig {
/**
* 有数上报/ 支付门店 queue 绑定
* task-center-order-consumer服务 订单状态处理中心queue 优化原有相同queue代码
*
* @return
*/
......
......@@ -113,4 +113,14 @@ public class ExposureOrderController {
payService.putPayQueryDelMq(putDeadLetterVo.getPartnerId(), putDeadLetterVo.getStoreId(), putDeadLetterVo.getFmId(), putDeadLetterVo.getOrderId(), putDeadLetterVo.getPayChanelType());
return ResponseUtil.success();
}
/**
* 查询支付虚拟门店配置
*/
@ApiAnnotation(logMessage = "查询支付虚拟门店配置")
@PostMapping("/getVirtualStore")
public BaseResponse<String> getVirtualStore(@Validated @LogParams @RequestBody GetVirtualStoreRequest req) {
return ResponseUtil.success(exposureOrderService.getVirtualStore(req.getAppId(), req.getType()));
}
}
package cn.freemud.entities.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: GetMallPayConfigVo
* @Package cn.freemud.entities.vo
* @Description:
* @author: ping.wu
* @date: 22-5-24 下午5:51
* @Copyright: 2022 www.freemud.cn Inc. All rights reserved.
*/
@Data
public class GetVirtualStoreRequest {
@NotBlank(message = "商户号不能为空")
private String partnerId;
@NotBlank(message = "小程序id不能为空")
private String appId;
/**
* @see cn.freemud.enums.AggregationTypeEnum
*/
@NotBlank
private String type;
}
......@@ -14,7 +14,7 @@ public enum AggregationTypeEnum {
*/
TYPE_6("6","会员卡支付门店"),
/**
* 微商城支付门店
* 微商城支付门店(FM商城)
*/
TYPE_7("7","微商城支付门店"),
/**
......
......@@ -73,4 +73,15 @@ public class ExposureOrderService {
vo.setStoreId(wxAppStore.getStoreId());
return vo;
}
/**
* 查询支付虚拟门店配置
* @param appId 小程序应用appId
* @param type 虚拟门店类型 {@link AggregationTypeEnum}
* @return 虚拟门店号
*/
public String getVirtualStore(String appId, String type) {
AssortmentOpenPlatformIappWxappStore wxAppStore = payService.getIappWxappStoreInfo(appId, type);
return wxAppStore == null ? "" : wxAppStore.getStoreId();
}
}
......@@ -371,15 +371,15 @@ public class OrderVerifyHandle {
//订单
boolean isRefundDeliveryFee=false;
//saas渠道订单,已完成的订单不能操作, 商户配置已完成订单可退款可退款
if (ObjectUtils.equals(orderBean.getSource(), OrderSourceV1.SAAS.getCode())) {
isCanRefund = getRefundConfig(orderBean);
if (!isCanRefund) {
return ResponseUtil.error(ResponseResult.ORDER_HAD_AFFIRM_CAN_NOT_REFUND);
}
}
if (isCanRefund) {
// if (ObjectUtils.equals(orderBean.getSource(), OrderSourceV1.SAAS.getCode())) {
// isCanRefund = getRefundConfig(orderBean);
// if (!isCanRefund) {
// return ResponseUtil.error(ResponseResult.ORDER_HAD_AFFIRM_CAN_NOT_REFUND);
// }
// }
// if (isCanRefund) {
orderBean.setAmount(getRefundAmount(orderBean,isRefundDeliveryFee).longValue());
}
// }
return ResponseUtil.success();
}
......
......@@ -19,8 +19,6 @@ import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformIapp
import com.freemud.application.sdk.api.base.BaseResponse;
import com.freemud.application.sdk.api.log.ErrorLog;
import com.freemud.application.sdk.api.ordercenter.entities.v1.OrderBeanV1;
import com.freemud.application.sdk.api.ordercenter.enums.PayChannelType;
import com.freemud.application.sdk.api.ordercenter.enums.orderv1.OrderTypeV1;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtInfoDto;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtendedReq;
import com.freemud.application.sdk.api.ordercenter.response.OrderBaseResp;
......@@ -35,11 +33,11 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
......@@ -147,7 +145,7 @@ public class PaymentHandle {
message = orderRefundResponse.getMessage();
}
PayRefundResponse payRefundResponse = handlePayRefundResponse(refundStatus, orderRefundRequest.getRefundId());
if(message != null){
if (message != null) {
payRefundResponse.setMessage(message);
}
return payRefundResponse;
......@@ -161,7 +159,9 @@ public class PaymentHandle {
MultiOrderRefundRequest multiOrderRefundRequest = paymentSdkAdapter.getMultiOrderPayRefundRequest(orderBean, getRefundAmount(orderBean));
MultiOrderRefundResponse multiOrderRefundResponse = mulitiPaymentClient.paymentApplicationRefund(multiOrderRefundRequest, orderBean.getCompanyId());
String message = "";
if (multiOrderRefundResponse == null || multiOrderRefundResponse.getData() == null || !com.freemud.sdk.api.assortment.order.domain.ResponseCodeConstant.ORDER_PAY_RESPONSE_SUCCESS.equals(multiOrderRefundResponse.getCode())) {
if (multiOrderRefundResponse == null
|| multiOrderRefundResponse.getData() == null
|| !com.freemud.sdk.api.assortment.order.domain.ResponseCodeConstant.ORDER_PAY_RESPONSE_SUCCESS.equals(multiOrderRefundResponse.getCode())) {
// fisherman 退款异常 也当做 退款中处理
refundStatus = PayRefundStatus.RUNNING;
} else {
......@@ -184,15 +184,15 @@ public class PaymentHandle {
if (refunded > 0L) {
refundStatus = PayRefundStatus.RUNNING;
}
for (MultiOrderRefundResponse.RefundPlatformResponse refundPlatformResponse : refundPlatformResponseList){
if(refundPlatformResponse.getResultCode().compareTo(MultiOrderRefundResponse.RefundPlatformResponse.REFUND_SUCCESS) != 0){
message = refundPlatformResponse.getResultMsg()+ ";" + message;
for (MultiOrderRefundResponse.RefundPlatformResponse refundPlatformResponse : refundPlatformResponseList) {
if (refundPlatformResponse.getResultCode().compareTo(MultiOrderRefundResponse.RefundPlatformResponse.REFUND_SUCCESS) != 0) {
message = refundPlatformResponse.getResultMsg() + ";" + message;
}
}
}
}
PayRefundResponse payRefundResponse = handlePayRefundResponse(refundStatus, multiOrderRefundRequest.getRefundTradeNo());
if(StringUtils.isNotEmpty(message)){
if (StringUtils.isNotEmpty(message)) {
payRefundResponse.setMessage(message);
}
return payRefundResponse;
......@@ -216,8 +216,8 @@ public class PaymentHandle {
AgentPayRefundResp.DataDTO data = resp.getData();
if (Objects.nonNull(data)) {
refundStatus = this.getFinalRefundStatus(data.getResultCode());
fmRefundNo = data.getFmRefundNo();
}
fmRefundNo = resp.getData().getFmRefundNo();
} catch (Throwable e) {
refundStatus = PayRefundStatus.FAIL;
}
......@@ -226,19 +226,7 @@ public class PaymentHandle {
private PayRefundStatus getFinalRefundStatus(Integer resultCode) {
switch (resultCode) {
// 退款中状态码需要单独处理
case 8200305:
return PayRefundStatus.RUNNING;
// 重复请求,按照退款中处理
case 82004005:
return PayRefundStatus.RUNNING;
// 退款成功
case 100:
return PayRefundStatus.SUCCESS;
default:
return PayRefundStatus.FAIL;
}
return PayRefundStatus.getByPayResultCode(resultCode);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment