|
@@ -55,11 +55,18 @@ public class StripeService {
|
|
try {
|
|
try {
|
|
String productName = StringUtils.isBlank(param.getProductName()) ? "product" :param.getProductName();
|
|
String productName = StringUtils.isBlank(param.getProductName()) ? "product" :param.getProductName();
|
|
String productId = stripeProductService.getByName(productName);
|
|
String productId = stripeProductService.getByName(productName);
|
|
|
|
+ if(StringUtils.isBlank(productId)){
|
|
|
|
+ throw new BusinessException(ResultCode.STRIPE_ERROR);
|
|
|
|
+ }
|
|
|
|
+ String priceId = stripePriceService.getByParam(param.getOrderMoney(),stripeConfig.getCurrency(),productId,param.getAutoPay(),param.getAutoPayTime());
|
|
|
|
+ if(StringUtils.isBlank(priceId)){
|
|
|
|
+ throw new BusinessException(ResultCode.STRIPE_ERROR);
|
|
|
|
+ }
|
|
|
|
+
|
|
SessionCreateParams.Mode mode = SessionCreateParams.Mode.PAYMENT;
|
|
SessionCreateParams.Mode mode = SessionCreateParams.Mode.PAYMENT;
|
|
if(param.getAutoPay() == 1){
|
|
if(param.getAutoPay() == 1){
|
|
mode = SessionCreateParams.Mode.SUBSCRIPTION;
|
|
mode = SessionCreateParams.Mode.SUBSCRIPTION;
|
|
}
|
|
}
|
|
- String priceId = stripePriceService.getByParam(param.getOrderMoney(),stripeConfig.getCurrency(),productId,param.getAutoPay(),param.getAutoPayTime());
|
|
|
|
SessionCreateParams.Locale locale = SessionCreateParams.Locale.AUTO;
|
|
SessionCreateParams.Locale locale = SessionCreateParams.Locale.AUTO;
|
|
if(StringUtils.isNotBlank(lang) ){
|
|
if(StringUtils.isNotBlank(lang) ){
|
|
locale = SessionCreateParams.Locale.valueOf(lang.toUpperCase());
|
|
locale = SessionCreateParams.Locale.valueOf(lang.toUpperCase());
|