|
|
@ -1,6 +1,7 @@
|
|
|
|
package au.com.royalpay.payment.manage.apps.core.impls;
|
|
|
|
package au.com.royalpay.payment.manage.apps.core.impls;
|
|
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
|
|
|
|
import au.com.royalpay.payment.tools.mail.MailGunClient;
|
|
|
|
import au.com.royalpay.payment.tools.mail.MailGunClient;
|
|
|
@ -9,6 +10,7 @@ import au.com.royalpay.payment.tools.mail.SendMail;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
@ -21,8 +23,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
import java.nio.charset.Charset;
|
|
|
|
import java.nio.charset.Charset;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
@ -34,7 +40,7 @@ import cn.yixblog.platform.http.HttpRequestResult;
|
|
|
|
* Created by wangning on 05/01/2018.
|
|
|
|
* Created by wangning on 05/01/2018.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@SpringBootTest
|
|
|
|
@SpringBootTest
|
|
|
|
@ActiveProfiles({ "local", "alipay", "wechat", "jd", "bestpay" })
|
|
|
|
@ActiveProfiles({ "proxy", "alipay", "wechat", "jd", "bestpay" })
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
|
public class CustomerImpressionImplTest {
|
|
|
|
public class CustomerImpressionImplTest {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
@ -48,7 +54,8 @@ public class CustomerImpressionImplTest {
|
|
|
|
private OrgMapper orgMapper;
|
|
|
|
private OrgMapper orgMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private MailGunClient mailGunClient;
|
|
|
|
private MailGunClient mailGunClient;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ClientConfigMapper clientConfigMapper;
|
|
|
|
|
|
|
|
|
|
|
|
// @Test
|
|
|
|
// @Test
|
|
|
|
// public void redisQueue() {
|
|
|
|
// public void redisQueue() {
|
|
|
@ -94,7 +101,6 @@ public class CustomerImpressionImplTest {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void sendSimpleMessage() throws Exception {
|
|
|
|
public void sendSimpleMessage() throws Exception {
|
|
|
|
String url = "https://api.mailgun.net/v3/dev.showcodes.com/messages?from=postmaster@mail.royalpay.com.au&to=164851225@qq.com,1029811920@qq.com&subject=啊是记录&text=暗杀苏&v:my-custom-data={\"key\":\"value\"}";
|
|
|
|
String url = "https://api.mailgun.net/v3/dev.showcodes.com/messages?from=postmaster@mail.royalpay.com.au&to=164851225@qq.com,1029811920@qq.com&subject=啊是记录&text=暗杀苏&v:my-custom-data={\"key\":\"value\"}";
|
|
|
@ -155,13 +161,15 @@ public class CustomerImpressionImplTest {
|
|
|
|
public void sendSimpleMessages() throws Exception {
|
|
|
|
public void sendSimpleMessages() throws Exception {
|
|
|
|
SendMail sendMail = new SendMail();
|
|
|
|
SendMail sendMail = new SendMail();
|
|
|
|
sendMail.setFrom("info@mail.royalpay.com.au");
|
|
|
|
sendMail.setFrom("info@mail.royalpay.com.au");
|
|
|
|
sendMail.setContent("<html><p>Hi kira</p ></html>");
|
|
|
|
sendMail.setContent("<html><p>Hi</p ></html>");
|
|
|
|
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
|
|
|
|
list.add("testTag");
|
|
|
|
|
|
|
|
// sendMail.setTags(list);
|
|
|
|
Set<String> mailCCs = new HashSet<>();
|
|
|
|
Set<String> mailCCs = new HashSet<>();
|
|
|
|
mailCCs.add("asd1159111@163.com");
|
|
|
|
mailCCs.add("asd1159111@163.com");
|
|
|
|
sendMail.setMailCcs(mailCCs);
|
|
|
|
sendMail.setMailCcs(mailCCs);
|
|
|
|
Set<String> mailtos = new HashSet<>();
|
|
|
|
Set<String> mailtos = new HashSet<>();
|
|
|
|
mailtos.add("eason.qian@royalpay.com.au");
|
|
|
|
mailtos.add("eason.qian@royalpay.com.au");
|
|
|
|
mailtos.add("164851225@qq.com");
|
|
|
|
|
|
|
|
sendMail.setMailTos(mailtos);
|
|
|
|
sendMail.setMailTos(mailtos);
|
|
|
|
sendMail.setTitle("Final Test");
|
|
|
|
sendMail.setTitle("Final Test");
|
|
|
|
|
|
|
|
|
|
|
@ -171,4 +179,43 @@ public class CustomerImpressionImplTest {
|
|
|
|
System.out.println(result.toJSONString());
|
|
|
|
System.out.println(result.toJSONString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void asd() {
|
|
|
|
|
|
|
|
JSONObject client = clientMapper.findClient(9);
|
|
|
|
|
|
|
|
JSONObject var = new JSONObject();
|
|
|
|
|
|
|
|
var.put("client_moniker", client.getString("client_moniker"));
|
|
|
|
|
|
|
|
var.put("short_name", client.getString("short_name"));
|
|
|
|
|
|
|
|
JSONObject result = mailGunClient.addListMember(client.getString("contact_email"), "merchants@mail.royalpay.com.au", client.getString("contact_person"),
|
|
|
|
|
|
|
|
var);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void qwe() {
|
|
|
|
|
|
|
|
List<JSONObject> clients = clientMapper.AllClients();
|
|
|
|
|
|
|
|
List<JSONObject> clientConfigs = clientConfigMapper.getAll();
|
|
|
|
|
|
|
|
Map<String, JSONObject> clientConfigMap = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String, JSONObject> clientMap = new HashMap<>();
|
|
|
|
|
|
|
|
clientConfigs.forEach(p -> {
|
|
|
|
|
|
|
|
clientConfigMap.put(p.getString("client_moniker"), p);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
clients.forEach(p -> {
|
|
|
|
|
|
|
|
clientMap.put(p.getString("client_moniker"), p);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
String split = "--";
|
|
|
|
|
|
|
|
String cc = "cc:";
|
|
|
|
|
|
|
|
String c = "c";
|
|
|
|
|
|
|
|
clientConfigMap.values().forEach(p -> {
|
|
|
|
|
|
|
|
String clientMoniker = p.getString("client_moniker");
|
|
|
|
|
|
|
|
JSONObject tmpClient = clientMap.get(clientMoniker);
|
|
|
|
|
|
|
|
tmpClient.keySet().forEach(o->{
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(p.getString(o))){
|
|
|
|
|
|
|
|
if(!tmpClient.getString(o).equals(p.getString(o))){
|
|
|
|
|
|
|
|
System.out.println(clientMoniker+split+o+split+cc+p.getString(o)+split+c+tmpClient.getString(o));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|