diff --git a/src/test/java/au/com/royalpay/payment/manage/kira/WechatMessageTest.java b/src/test/java/au/com/royalpay/payment/manage/kira/WechatMessageTest.java new file mode 100644 index 000000000..7a3bc4404 --- /dev/null +++ b/src/test/java/au/com/royalpay/payment/manage/kira/WechatMessageTest.java @@ -0,0 +1,42 @@ +package au.com.royalpay.payment.manage.kira; + +import au.com.royalpay.payment.core.PaymentApi; +import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; +import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; +import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +@SpringBootTest +@ActiveProfiles({"dev","alipay","wechat","jd","bestpay"}) +@RunWith(SpringRunner.class) +public class WechatMessageTest { + + @Resource + private PaymentApi paymentApi; + @Resource + private MpWechatApiProvider mpWechatApiProvider; + + @Test + public void asd(){ + String openId = "o32MzuO4s8c7iFOVxnxejkbhMoEc"; + MpWechatApi api = mpWechatApiProvider.getApiFromOpenId(openId); + String templateId = api.getTemplateId("refund-send"); + + TemplateMessage msg = new TemplateMessage(openId, templateId, ""); + msg.put("first", "退款已提交处理", "#10b24c"); + msg.put("keyword1", "test1", "#000000"); + msg.put("keyword2", "test2", "#000000"); + msg.put("keyword3","test3", "#000000"); + msg.put("keyword4", "test4", "#000000"); + msg.put("remark", "已受理您的退款申请,\n将\n\r在近期到账", "#10b24c"); + + api.sendTemplateMessage(msg); + } +}