|
@@ -20,6 +20,7 @@ import cn.kdan.cloud.pdf.office.common.utils.MyDateUtils;
|
|
|
import cn.kdan.cloud.pdf.office.common.vo.UserInfoVO;
|
|
|
import cn.kdan.cloud.pdf.office.common.vo.UserVO;
|
|
|
import cn.kdan.cloud.pdf.office.payment.client.GooglePayClient;
|
|
|
+import cn.kdan.cloud.pdf.office.payment.properties.GooglePayConfig;
|
|
|
import cn.kdan.cloud.pdf.office.payment.service.GooglePayService;
|
|
|
import cn.kdan.cloud.pdf.office.payment.service.OrderService;
|
|
|
import cn.kdan.cloud.pdf.office.payment.service.SubscriptionsService;
|
|
@@ -32,9 +33,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.http.HttpEntity;
|
|
|
-import org.springframework.http.HttpHeaders;
|
|
|
-import org.springframework.http.MediaType;
|
|
|
+import org.springframework.http.*;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
@@ -75,6 +74,7 @@ public class GooglePayServiceImpl implements GooglePayService {
|
|
|
|
|
|
private final EmailApi emailApi;
|
|
|
private static final RestTemplate restTemplate = new RestTemplate();
|
|
|
+ private final GooglePayConfig googlePayConfig;
|
|
|
@Value("${htmlToPdfUrl:http://139.196.160.101:3060/api/get-invoice}")
|
|
|
private String htmlToPdfUrl;
|
|
|
|
|
@@ -90,6 +90,9 @@ public class GooglePayServiceImpl implements GooglePayService {
|
|
|
}
|
|
|
log.info("谷歌权益校验,用户id:{}", googlePayDTO.getUserId());
|
|
|
SubscriptionPurchaseV3 subscriptionPurchaseV2 = this.verify(googlePayDTO.getPurchaseToken(),googlePayDTO.getPackageName());
|
|
|
+ if (subscriptionPurchaseV2.getTestPurchase() != null) {
|
|
|
+ throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_COUPON_INVALID);
|
|
|
+ }
|
|
|
// 获取票据订单信息
|
|
|
if(ObjectUtils.isEmpty(subscriptionPurchaseV2.getExternalAccountIdentifiers())){
|
|
|
throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_MSG_GOOGLE_STORE_TRANSACTION_ID_VALIDATION_FAILED);
|
|
@@ -117,7 +120,7 @@ public class GooglePayServiceImpl implements GooglePayService {
|
|
|
|
|
|
CreateSubscriptionDTO createSubscription = new CreateSubscriptionDTO();
|
|
|
String subscriptionId = CommonUtils.generateId();
|
|
|
- String orderId = CommonUtils.generateId();
|
|
|
+ String orderId = cn.kdan.cloud.pdf.office.payment.utils.CommonUtils.generateRightsId((long) ((Math.random() * 9999 + 1) * 10000));
|
|
|
String appId = product.getAppId().toString();
|
|
|
createSubscription.setId(subscriptionId);
|
|
|
createSubscription.setUserId(googlePayDTO.getUserId());
|
|
@@ -164,7 +167,6 @@ public class GooglePayServiceImpl implements GooglePayService {
|
|
|
result.setDigestPassword(null);
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
private void sendBuyEmail(ProductVO product, UserVO userVO,CreateOrderManualDTO orderManualDTO) {
|
|
|
if(product.getCode().contains("upgrade")){
|
|
|
EmailSendBO bo = new EmailSendBO();
|