添加判断,确认邮件是否发送成功
This commit is contained in:
@@ -840,7 +840,7 @@ public class SendEmailUtil {
|
|||||||
private final static Long PAYMENT_FAILED_RENEWAL_USER_EN = 131563L;
|
private final static Long PAYMENT_FAILED_RENEWAL_USER_EN = 131563L;
|
||||||
private final static Long PAYMENT_FAILED_RENEWAL_USER_CN = 131564L;
|
private final static Long PAYMENT_FAILED_RENEWAL_USER_CN = 131564L;
|
||||||
|
|
||||||
public static void subscriptionEmailReminder(String type, SubscriptionEmailParamsDTO subscriptionEmailParamsDTO, String language, String receiverAddress) {
|
public static boolean subscriptionEmailReminder(String type, SubscriptionEmailParamsDTO subscriptionEmailParamsDTO, String language, String receiverAddress) {
|
||||||
try {
|
try {
|
||||||
String merchantEmail = "kimwong@code-create.com.hk";
|
String merchantEmail = "kimwong@code-create.com.hk";
|
||||||
String developer = "xupei3360@163.com";
|
String developer = "xupei3360@163.com";
|
||||||
@@ -917,6 +917,7 @@ public class SendEmailUtil {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log.error("unknown subscription email type");
|
log.error("unknown subscription email type");
|
||||||
|
return false;
|
||||||
// throw new BusinessException("unknown subscription email type");
|
// throw new BusinessException("unknown subscription email type");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -935,9 +936,11 @@ public class SendEmailUtil {
|
|||||||
SendEmailResponse respMerchant = client.SendEmail(merchant);
|
SendEmailResponse respMerchant = client.SendEmail(merchant);
|
||||||
log.info("邮件主题:{},发送结果toMerchant###{}", merchant.getSubject(), SendEmailResponse.toJsonString(respMerchant));
|
log.info("邮件主题:{},发送结果toMerchant###{}", merchant.getSubject(), SendEmailResponse.toJsonString(respMerchant));
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} catch (TencentCloudSDKException e) {
|
} catch (TencentCloudSDKException e) {
|
||||||
log.info("邮件发送失败###{}", e.toString());
|
log.info("邮件发送失败###{}", e.toString());
|
||||||
throw new BusinessException("failed.to.send.mail");
|
return false;
|
||||||
|
// throw new BusinessException("failed.to.send.mail");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ public class StripeServiceImpl implements StripeService {
|
|||||||
InvoiceLineItem invoiceLineItem = invoice.getLines().getData().get(0);
|
InvoiceLineItem invoiceLineItem = invoice.getLines().getData().get(0);
|
||||||
String description = invoiceLineItem.getDescription();
|
String description = invoiceLineItem.getDescription();
|
||||||
Long amount = invoiceLineItem.getAmount();
|
Long amount = invoiceLineItem.getAmount();
|
||||||
log.info("单次订阅 description : {}, amount: {}", description, amount);
|
log.info("单次订阅 description : {}, amount: {} 分", description, amount);
|
||||||
boolean b = createSubscriptionAndUpdateAccount(orderNo, orderByOrderNo.getAccountId(), description, amount);
|
boolean b = createSubscriptionAndUpdateAccount(orderNo, orderByOrderNo.getAccountId(), description, amount);
|
||||||
// 邮件通知用户
|
// 邮件通知用户
|
||||||
if (b){
|
if (b){
|
||||||
@@ -1002,7 +1002,8 @@ public class StripeServiceImpl implements StripeService {
|
|||||||
emailParamsDTO.setEndOfPrepaidTerm(DateUtil.changeTimeStampFormat(subscriptionInfo.getCurrentPeriodEnd(), "seconds", CommonConstant.TIME_FORMAT_MMM_dd_yyyy));
|
emailParamsDTO.setEndOfPrepaidTerm(DateUtil.changeTimeStampFormat(subscriptionInfo.getCurrentPeriodEnd(), "seconds", CommonConstant.TIME_FORMAT_MMM_dd_yyyy));
|
||||||
setSubscriptionParams(paymentInfo, subscriptionInfo, orderByOrderNo, emailParamsDTO, language);
|
setSubscriptionParams(paymentInfo, subscriptionInfo, orderByOrderNo, emailParamsDTO, language);
|
||||||
|
|
||||||
SendEmailUtil.subscriptionEmailReminder(type, emailParamsDTO, language, account.getUserEmail());
|
boolean b = SendEmailUtil.subscriptionEmailReminder(type, emailParamsDTO, language, account.getUserEmail());
|
||||||
|
if (!b) return false;
|
||||||
|
|
||||||
// 邮件通知成功后,更新标志
|
// 邮件通知成功后,更新标志
|
||||||
if (!type.equals("reminder") && !type.equals("cancel")){
|
if (!type.equals("reminder") && !type.equals("cancel")){
|
||||||
@@ -1039,7 +1040,8 @@ public class StripeServiceImpl implements StripeService {
|
|||||||
emailParamsDTO.setPaymentMethod(paymentInfo.getPaymentMethod());
|
emailParamsDTO.setPaymentMethod(paymentInfo.getPaymentMethod());
|
||||||
emailParamsDTO.setLast4(paymentInfo.getLast4());
|
emailParamsDTO.setLast4(paymentInfo.getLast4());
|
||||||
|
|
||||||
SendEmailUtil.subscriptionEmailReminder("fail_new", emailParamsDTO, language, account.getUserEmail());
|
boolean b = SendEmailUtil.subscriptionEmailReminder("fail_new", emailParamsDTO, language, account.getUserEmail());
|
||||||
|
if (!b) return false;
|
||||||
|
|
||||||
// 邮件通知成功后,更新标志
|
// 邮件通知成功后,更新标志
|
||||||
PaymentInfo payment = new PaymentInfo();
|
PaymentInfo payment = new PaymentInfo();
|
||||||
@@ -1100,7 +1102,8 @@ public class StripeServiceImpl implements StripeService {
|
|||||||
setSubscriptionParams(paymentInfo, subscriptionInfo, orderByOrderNo, emailParamsDTO, language);
|
setSubscriptionParams(paymentInfo, subscriptionInfo, orderByOrderNo, emailParamsDTO, language);
|
||||||
|
|
||||||
// 4、发邮件
|
// 4、发邮件
|
||||||
SendEmailUtil.subscriptionEmailReminder("fail_renewal", emailParamsDTO, language, account.getUserEmail());
|
boolean b = SendEmailUtil.subscriptionEmailReminder("fail_renewal", emailParamsDTO, language, account.getUserEmail());
|
||||||
|
if (!b) return false;
|
||||||
|
|
||||||
PaymentInfo payment = new PaymentInfo();
|
PaymentInfo payment = new PaymentInfo();
|
||||||
payment.setId(paymentInfo.getId());
|
payment.setId(paymentInfo.getId());
|
||||||
|
|||||||
Reference in New Issue
Block a user