diff --git a/src/main/java/com/ai/da/common/utils/SendEmailUtil.java b/src/main/java/com/ai/da/common/utils/SendEmailUtil.java index d1a30ae1..c52d3d8c 100644 --- a/src/main/java/com/ai/da/common/utils/SendEmailUtil.java +++ b/src/main/java/com/ai/da/common/utils/SendEmailUtil.java @@ -782,7 +782,8 @@ public class SendEmailUtil { public static void subscriptionEmailReminder(String type, SubscriptionEmailParamsDTO subscriptionEmailParamsDTO, String language, String receiverAddress){ try{ - String kimEmail = "kimwong@code-create.com.hk"; +// String merchantEmail = "kimwong@code-create.com.hk"; + String merchantEmail = "xupei3360@163.com"; Credential cred = new Credential(SECRET_ID, SECRET_KEy); // 实例化一个http选项,可选的,没有特殊需求可以跳过 HttpProfile httpProfile = new HttpProfile(); @@ -798,7 +799,7 @@ public class SendEmailUtil { user.setDestination(new String[]{receiverAddress}); SendEmailRequest merchant = new SendEmailRequest(); merchant.setFromEmailAddress(SEND_ADDRESS); - merchant.setDestination(new String[]{kimEmail}); + merchant.setDestination(new String[]{merchantEmail}); Template templateUser = new Template(); Template templateMerchant = new Template(); switch (type) { @@ -848,12 +849,15 @@ public class SendEmailUtil { templateMerchant.setTemplateData(JSON.toJSONString(subscriptionEmailParamsDTO)); merchant.setTemplate(templateMerchant); - // 返回的resp是一个SendEmailResponse的实例,与请求对象对应 - SendEmailResponse respUser = client.SendEmail(user); - // todo 暂时先不发商家邮件 -// SendEmailResponse respMerchant = client.SendEmail(merchant); - log.info("邮件发送结果toUser###{}", SendEmailResponse.toJsonString(respUser)); -// log.info("邮件发送结果toMerchant###{}", SendEmailResponse.toJsonString(respMerchant)); + if (!type.equals("cancel")){ + // 返回的resp是一个SendEmailResponse的实例,与请求对象对应 + SendEmailResponse respUser = client.SendEmail(user); + log.info("邮件发送结果toUser###{}", SendEmailResponse.toJsonString(respUser)); + } + if (!type.equals("reminder")){ + SendEmailResponse respMerchant = client.SendEmail(merchant); + log.info("邮件发送结果toMerchant###{}", SendEmailResponse.toJsonString(respMerchant)); + } } catch (TencentCloudSDKException e) { log.info("邮件发送失败###{}", e.toString()); throw new BusinessException("failed.to.send.mail"); diff --git a/src/main/java/com/ai/da/service/PaymentInfoService.java b/src/main/java/com/ai/da/service/PaymentInfoService.java index 6d3d2d5e..fcc69d00 100644 --- a/src/main/java/com/ai/da/service/PaymentInfoService.java +++ b/src/main/java/com/ai/da/service/PaymentInfoService.java @@ -18,7 +18,7 @@ public interface PaymentInfoService extends IService { void createPaymentInfoForAliPayHK(AlipayHKCallbackDTO alipayHKCallbackDTO); - String createPaymentInfoForStripe(Invoice invoice); + PaymentInfo createPaymentInfoForStripe(Invoice invoice); PaymentInfo getPaymentInfoByOrderId(String orderId); diff --git a/src/main/java/com/ai/da/service/impl/PaymentInfoServiceImpl.java b/src/main/java/com/ai/da/service/impl/PaymentInfoServiceImpl.java index 36acae75..e78fd856 100644 --- a/src/main/java/com/ai/da/service/impl/PaymentInfoServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/PaymentInfoServiceImpl.java @@ -176,7 +176,7 @@ public class PaymentInfoServiceImpl extends ServiceImpl resp = new HashMap<>(); - resp.put("paymentMethod", null); - resp.put("last4", null); + resp.put("paymentMethod", "N/A"); + resp.put("last4", "N/A"); return resp; } catch (StripeException e) { throw new RuntimeException(e); @@ -697,6 +698,7 @@ public class StripeServiceImpl implements StripeService { com.ai.da.mapper.primary.entity.Account account = accountMapper.selectById(subscriptionInfo.getAccountId()); String userName = account.getUserName(); String language = account.getLanguage(); + OrderInfo orderByOrderNo = orderInfoService.getOrderByOrderNo(subscriptionInfo.getOrderNo()); emailParamsDTO.setUsername(userName); emailParamsDTO.setOrderId(paymentInfo.getId().toString()); @@ -708,7 +710,7 @@ public class StripeServiceImpl implements StripeService { emailParamsDTO.setPaymentMethod(subscriptionInfo.getPaymentMethod()); emailParamsDTO.setSubscriptionId(subscriptionInfo.getId().toString()); emailParamsDTO.setSubscriptionType(subscriptionInfo.getType()); - emailParamsDTO.setStartDate(changeTimeStampFormat(subscriptionInfo.getCreateTime())); + emailParamsDTO.setStartDate(changeTimeStampFormat(orderByOrderNo.getCreateTime())); emailParamsDTO.setNextPayDate(changeTimeStampFormat(subscriptionInfo.getCurrentPeriodEnd(), "seconds", CommonConstant.TIME_FORMAT_MMM_dd_yyyy)); emailParamsDTO.setRenewalTime(changeTimeStampFormat(subscriptionInfo.getCurrentPeriodEnd(), "seconds", CommonConstant.TIME_FORMAT_MMM_dd_yyyy));