|
|
@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yeepay.yop.sdk.service.common.response.YopResponse;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import lombok.NoArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -39,9 +40,13 @@ import org.springblade.yeePay.entity.MerchantInfo;
|
|
|
import org.springblade.yeePay.entity.saas.PayLinkOrderDto;
|
|
|
import org.springblade.yeePay.service.YeePayService;
|
|
|
import org.springblade.yeePay.service.YeepaySaasService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.ApplicationEventPublisher;
|
|
|
+import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
|
@@ -67,6 +72,20 @@ public class YeePayPlugin implements Payment {
|
|
|
ITransferRecService transferRecService;
|
|
|
IAgentLeagueRecordService agentLeagueRecordService;
|
|
|
BladeLogger bladeLogger;
|
|
|
+ Environment env;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String callbackUrl(String paymentType) {
|
|
|
+ String callbackDomain = env.getProperty("callback.domain");
|
|
|
+ return callbackDomain + CALLBACK_PREFIX + paymentType;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String csUrl(String paymentType) {
|
|
|
+ String callbackDomain = env.getProperty("callback.domain");
|
|
|
+ return callbackDomain + CSURL_PREFIX + paymentType;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public R nativePay(PayParam payParam) {
|
|
|
@@ -139,12 +158,12 @@ public class YeePayPlugin implements Payment {
|
|
|
public R miniProgram(PayParam payParam) {
|
|
|
Bills bills = billsService.getById(payParam.getOrderId());
|
|
|
//判断订单是否超时(默认90s)
|
|
|
- if(ObjectUtils.isEmpty(bills)){
|
|
|
+ if (ObjectUtils.isEmpty(bills)) {
|
|
|
//判断支付状态
|
|
|
- if(StringUtils.equals(bills.getPayStatus(), AppConstant.BillPayStatus.待付款.name())){
|
|
|
+ if (StringUtils.equals(bills.getPayStatus(), AppConstant.BillPayStatus.待付款.name())) {
|
|
|
//判断超时时间
|
|
|
- if(DateTime.now().getTime() >
|
|
|
- DateTime.of(bills.getCreateTime()).offset(DateField.SECOND,90).getTime()){
|
|
|
+ if (DateTime.now().getTime() >
|
|
|
+ DateTime.of(bills.getCreateTime()).offset(DateField.SECOND, 90).getTime()) {
|
|
|
SuccessParams successParams = PaymentCache.getSuccessParams(payParam.getOrderId());
|
|
|
throw new TradeException(ResCode.TRADE_TIME_OUT, successParams);
|
|
|
}
|