This commit is contained in:
Your Name
2026-03-01 14:17:59 +08:00
parent 65aa12f146
commit a07e844c47
6071 changed files with 777651 additions and 0 deletions
@@ -0,0 +1,134 @@
/**
* Alipay.com Inc. Copyright (c) 2004-2020 All Rights Reserved.
*/
package com.alipay.easysdk;
import com.alipay.easysdk.kernel.Config;
import com.alipay.easysdk.kms.aliyun.AliyunKMSConfig;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;
/**
* @author zhongyu
* @version $Id: TestAccount.java, v 0.1 2020年01月19日 4:42 PM zhongyu Exp $
*/
public class TestAccount {
/**
* 从文件中读取私钥
* <p>
* 注意:实际开发过程中,请务必注意不要将私钥信息配置在源码中(比如配置为常量或储存在配置文件的某个字段中等),因为私钥的保密等级往往比源码高得多,将会增加私钥泄露的风险。推荐将私钥信息储存在专用的私钥文件中,
* 将私钥文件通过安全的流程分发到服务器的安全储存区域上,仅供自己的应用运行时读取。
* <p>
* 此处为了单元测试执行的环境普适性,私钥文件配置在resources资源下,实际过程中请不要这样做。
*
* @param appId 私钥对应的APP_ID
* @return 私钥字符串
*/
private static String getPrivateKey(String appId) {
InputStream stream = TestAccount.class.getResourceAsStream("/fixture/privateKey.json");
Map<String, String> result = new Gson().fromJson(new InputStreamReader(stream), new TypeToken<Map<String, String>>() {}.getType());
return result.get(appId);
}
/**
* 从文件中读取阿里云AccessKey配置信息
* 此处为了单元测试执行的环境普适性,AccessKey信息配置在resources资源下,实际过程中请不要这样做。
* @param key AccessKey配置对应的key
* @return AccessKey配置字符串
*/
private static String getAliyunAccessKey(String key){
InputStream stream = TestAccount.class.getResourceAsStream("/fixture/aliyunAccessKey.json");
Map<String, String> result = new Gson().fromJson(new InputStreamReader(stream), new TypeToken<Map<String, String>>() {}.getType());
return result.get(key);
}
/**
* 线上小程序测试账号
*/
public static class Mini {
public static final Config CONFIG = getConfig();
public static Config getConfig() {
Config config = new Config();
config.protocol = "https";
config.gatewayHost = "openapi.alipay.com";
config.appId = "2019022663440152";
config.signType = "RSA2";
config.alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAumX1EaLM4ddn1Pia4SxTRb62aVYxU8I2mHMqrc"
+ "pQU6F01mIO/DjY7R4xUWcLi0I2oH/BK/WhckEDCFsGrT7mO+JX8K4sfaWZx1aDGs0m25wOCNjp+DCVBXotXSCurqgGI/9UrY+"
+ "QydYDnsl4jB65M3p8VilF93MfS01omEDjUW+1MM4o3FP0khmcKsoHnYGs21btEeh0LK1gnnTDlou6Jwv3Ew36CbCNY2cYkuyP"
+ "AW0j47XqzhWJ7awAx60fwgNBq6ZOEPJnODqH20TAdTLNxPSl4qGxamjBO+RuInBy+Bc2hFHq3pNv6hTAfktggRKkKzDlDEUwg"
+ "SLE7d2eL7P6rwIDAQAB";
config.merchantPrivateKey = getPrivateKey(config.appId);
config.notifyUrl = "https://www.test.com/callback";
return config;
}
}
/**
* 线上生活号测试账号
*/
public static class OpenLife {
public static final Config CONFIG = getConfig();
private static Config getConfig() {
Config config = new Config();
config.protocol = "https";
config.gatewayHost = "openapi.alipay.com";
config.appId = "2021002177673029";
config.signType = "RSA2";
config.alipayCertPath = "src/test/resources/fixture/alipayCertPublicKey_RSA2.crt";
config.alipayRootCertPath = "src/test/resources/fixture/alipayRootCert.crt";
config.merchantCertPath = "src/test/resources/fixture/appCertPublicKey_2021002177673029.crt";
config.merchantPrivateKey = getPrivateKey(config.appId);
return config;
}
}
/**
* Aliyun KMS签名测试账号
*/
public static class AliyunKMS {
public static final AliyunKMSConfig CONFIG = getConfig();
private static AliyunKMSConfig getConfig() {
AliyunKMSConfig config = new AliyunKMSConfig();
config.protocol = "https";
config.gatewayHost = "openapi.alipay.com";
config.appId = "2021001163614348";
config.signType = "RSA2";
config.notifyUrl = "https://www.test.com/callback";
config.alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiOgupSXhUE3GkMDeCpeDwoEM2z+krBpaKPFbfS" +
"JgFVoN/M1s62VC6LhFI9aL4F76bqMGilQPpe2ukW5UmLR+C3OmliuqE/v5/UEpasnndcZMEKadQbWOpQ4eBHGkKTASQhtbgYb3U" +
"WS+viD5MfHS0+3h+sko8cW06jONmjG2tvFpnmooIjMawXByK8/f4vBMBk4ZQQodo4TT18mhyyyIoilhLH2EatQp/lov54ZhwHi9" +
"8LXeLw7Yt4QK8q7u+lB34V8lsu9zVMEMZExhoblsdjgzFAY6KzCn/QGnQE5e54i59+wONAyf2npUkz4cpPDJPLQ7KBu1febsZjk" +
"g9vZrXwIDAQAB";
//如果使用阿里云KMS签名,则不需要配置私钥
//config.merchantPrivateKey = getPrivateKey(config.appId);
//如果使用第三方签名服务,则需要指定签名提供方名称,阿里云KMS的名称为"AliyunKMS"
config.signProvider = "AliyunKMS";
//如果使用阿里云KMS签名,需要更换为您的阿里云账号信息
config.aliyunAccessKeyId = getAliyunAccessKey("AccessKeyId");
config.aliyunAccessKeySecret = getAliyunAccessKey("AccessKeySecret");
config.kmsKeyId = "4358f298-8e30-4849-9791-52e68dbd9d1e";
config.kmsKeyVersionId = "e71daa69-c321-4014-b0c4-ba070c7839ee";
//如果使用阿里云KMS签名,需要更换为您的KMS服务地址
// KMS服务地址列表详情,请参考:
// https://help.aliyun.com/document_detail/69006.html?spm=a2c4g.11186623.2.9.783f77cfAoNhY6#concept-69006-zh
config.kmsEndpoint = "kms.cn-hangzhou.aliyuncs.com";
return config;
}
}
}
@@ -0,0 +1,38 @@
package com.alipay.easysdk.base.image;
import com.alipay.easysdk.TestAccount.Mini;
import com.alipay.easysdk.base.image.models.AlipayOfflineMaterialImageUploadResponse;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.factory.Factory.Base;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(Mini.CONFIG);
}
@Test
public void testUpload() throws Exception {
AlipayOfflineMaterialImageUploadResponse response = Base.Image().upload("测试图片",
"src/test/resources/fixture/sample.png");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.imageId, not(nullValue()));
assertThat(response.imageUrl, startsWith("https://"));
}
}
@@ -0,0 +1,44 @@
package com.alipay.easysdk.base.oauth;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.base.oauth.models.AlipaySystemOauthTokenResponse;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.Mini.CONFIG);
}
@Test
public void testGetToken() throws Exception {
AlipaySystemOauthTokenResponse response = Factory.Base.OAuth().getToken("fe1ae5abacd54ba2a6c8f6902533TX64");
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40002"));
assertThat(response.msg, is("Invalid Arguments"));
assertThat(response.subCode, is("isv.code-invalid"));
assertThat(response.subMsg, is("授权码code无效"));
assertThat(response.httpBody, not(nullValue()));
}
@Test
public void testRefreshToken() throws Exception {
AlipaySystemOauthTokenResponse response = Factory.Base.OAuth().refreshToken("1234567890");
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40002"));
assertThat(response.msg, is("Invalid Arguments"));
assertThat(response.subCode, is("isv.refresh-token-invalid"));
assertThat(response.subMsg, is("刷新令牌refresh_token无效"));
assertThat(response.httpBody, not(nullValue()));
}
}
@@ -0,0 +1,34 @@
package com.alipay.easysdk.base.qrcode;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.base.qrcode.models.AlipayOpenAppQrcodeCreateResponse;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.Mini.CONFIG);
}
@Test
public void testCreate() throws Exception {
AlipayOpenAppQrcodeCreateResponse response = Factory.Base.Qrcode().create(
"https://opendocs.alipay.com", "ageIndex=1", "文档站点");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.qrCodeUrl, not(nullValue()));
}
}
@@ -0,0 +1,38 @@
package com.alipay.easysdk.base.video;
import com.alipay.easysdk.TestAccount.Mini;
import com.alipay.easysdk.base.video.models.AlipayOfflineMaterialImageUploadResponse;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.factory.Factory.Base;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(Mini.CONFIG);
}
@Test
public void testUpload() throws Exception {
AlipayOfflineMaterialImageUploadResponse response = Base.Video().upload("测试视频",
"src/test/resources/fixture/sample.mp4");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.imageId, not(nullValue()));
assertThat(response.imageUrl, startsWith("https://"));
}
}
@@ -0,0 +1,202 @@
package com.alipay.easysdk.marketing.openlife;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.factory.Factory.Marketing;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.marketing.openlife.models.AlipayOpenPublicLifeMsgRecallResponse;
import com.alipay.easysdk.marketing.openlife.models.AlipayOpenPublicMessageContentCreateResponse;
import com.alipay.easysdk.marketing.openlife.models.AlipayOpenPublicMessageContentModifyResponse;
import com.alipay.easysdk.marketing.openlife.models.AlipayOpenPublicMessageSingleSendResponse;
import com.alipay.easysdk.marketing.openlife.models.AlipayOpenPublicMessageTotalSendResponse;
import com.alipay.easysdk.marketing.openlife.models.AlipayOpenPublicSettingCategoryQueryResponse;
import com.alipay.easysdk.marketing.openlife.models.AlipayOpenPublicTemplateMessageIndustryModifyResponse;
import com.alipay.easysdk.marketing.openlife.models.Article;
import com.alipay.easysdk.marketing.openlife.models.Context;
import com.alipay.easysdk.marketing.openlife.models.Keyword;
import com.alipay.easysdk.marketing.openlife.models.Template;
import com.google.common.collect.Lists;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.OpenLife.CONFIG);
}
@Test
public void testCreateImageTextContent() throws Exception {
AlipayOpenPublicMessageContentCreateResponse response = Marketing.OpenLife().createImageTextContent("标题",
"http://dl.django.t.taobao.com/rest/1.0/image?fileIds=hOTQ1lT1TtOjcxGflvnUXgAAACMAAQED",
"示例", "T", "activity", "满100减10",
"关键,热度", "13434343432,xxx@163.com");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.contentId, is(notNullValue()));
assertThat(response.contentUrl, is(notNullValue()));
}
@Test
public void testModifyImageTextContent() throws Exception {
AlipayOpenPublicMessageContentModifyResponse response = Marketing.OpenLife().modifyImageTextContent(
"2021002177673029ecae71f5-9af3-4317-b9ce-d3a8f238f8ce", "新标题",
"http://dl.django.t.taobao.com/rest/1.0/image?fileIds=hOTQ1lT1TtOjcxGflvnUXgAAACMAAQED",
"新示例", "T", "activity", "满100减20",
"关键,热度", "13434343432,xxx@163.com");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.contentId, is("2021002177673029ecae71f5-9af3-4317-b9ce-d3a8f238f8ce"));
assertThat(response.contentUrl, is(notNullValue()));
}
@Test
public void testSendText() throws Exception {
AlipayOpenPublicMessageTotalSendResponse response = Marketing.OpenLife().sendText("测试");
if (response.code.equals("10000")) {
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.messageId, is(notNullValue()));
} else {
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40004"));
assertThat(response.msg, is("Business Failed"));
assertThat(response.subCode, is("PUB.MSG_BATCH_SD_OVER"));
assertThat(response.subMsg, is("批量发送消息频率超限"));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.messageId, is(nullValue()));
}
}
@Test
public void testSendImageText() throws Exception {
Article article = new Article();
article.actionName = "测试";
article.desc = "测试";
article.title = "测试";
article.imageUrl = "http://dl.django.t.taobao.com/rest/1.0/image?fileIds=hOTQ1lT1TtOjcxGflvnUXgAAACMAAQED";
article.url = "https://docs.open.alipay.com/api_6/alipay.open.public.message.total.send";
AlipayOpenPublicMessageTotalSendResponse response = Marketing.OpenLife().sendImageText(Lists.newArrayList(article));
if (response.code.equals("10000")) {
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.messageId, is(notNullValue()));
} else {
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40004"));
assertThat(response.msg, is("Business Failed"));
assertThat(response.subCode, is("PUB.MSG_BATCH_SD_OVER"));
assertThat(response.subMsg, is("批量发送消息频率超限"));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.messageId, is(nullValue()));
}
}
@Test
public void testSendSingleMessage() throws Exception {
Keyword keyword = new Keyword();
keyword.color = "#85be53";
keyword.value = "HU7142";
Context context = new Context();
context.headColor = "#85be53";
context.url = "https://docs.open.alipay.com/api_6/alipay.open.public.message.single.send";
context.actionName = "查看详情";
context.keyword1 = keyword;
context.keyword2 = keyword;
context.first = keyword;
context.remark = keyword;
Template template = new Template();
template.templateId = "TM9f1a1af9c3d9418bb0f66af22c817f41";
template.context = context;
AlipayOpenPublicMessageSingleSendResponse response = Marketing.OpenLife().sendSingleMessage(
"2088002656718920", template);
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40004"));
assertThat(response.msg, is("Business Failed"));
assertThat(response.subCode, is("MSG_TEMPLATE_NOT_EXIST"));
assertThat(response.subMsg, is("消息模板不存在"));
assertThat(response.httpBody, not(nullValue()));
}
@Test
public void testRecallMessage() throws Exception {
AlipayOpenPublicLifeMsgRecallResponse response = Marketing.OpenLife().recallMessage(
"201905106452100327f456f6-8dd2-4a06-8b0e-ec8a3a85c46a");
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40004"));
assertThat(response.msg, is("Business Failed"));
assertThat(response.subCode, is("PUB.RCD_MSG_NOT_EXIST"));
assertThat(response.subMsg, is("撤回的消息不存在"));
assertThat(response.httpBody, not(nullValue()));
}
@Test
public void testSetIndustry() throws Exception {
AlipayOpenPublicTemplateMessageIndustryModifyResponse response = Marketing.OpenLife().setIndustry(
"10001/20102", "IT科技/IT软件与服务",
"10001/20102", "IT科技/IT软件与服务");
if (response.code.equals("10000")) {
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
} else {
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40004"));
assertThat(response.msg, is("Business Failed"));
assertThat(response.subCode, is("3002"));
assertThat(response.subMsg, is("模板消息行业一月只能修改一次"));
assertThat(response.httpBody, not(nullValue()));
}
}
@Test
public void testGetIndustry() throws Exception {
AlipayOpenPublicSettingCategoryQueryResponse response = Marketing.OpenLife().getIndustry();
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.primaryCategory, is("IT科技/IT软件与服务"));
assertThat(response.secondaryCategory, is("IT科技/IT软件与服务"));
}
}
@@ -0,0 +1,100 @@
package com.alipay.easysdk.marketing.pass;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.marketing.pass.models.AlipayPassInstanceAddResponse;
import com.alipay.easysdk.marketing.pass.models.AlipayPassInstanceUpdateResponse;
import com.alipay.easysdk.marketing.pass.models.AlipayPassTemplateAddResponse;
import com.alipay.easysdk.marketing.pass.models.AlipayPassTemplateUpdateResponse;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.Mini.CONFIG);
}
@Test
public void testCreateTemplate() throws Exception {
AlipayPassTemplateAddResponse response = Factory.Marketing.Pass().createTemplate("123456789", getTplContent());
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.success, is(true));
assertThat(response.result, containsString("tpl_id"));
}
@Test
public void testUpdateTemplate() throws Exception {
AlipayPassTemplateUpdateResponse response = Factory.Marketing.Pass().updateTemplate("2020012014534017917956080", getTplContent());
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.success, is(true));
assertThat(response.result, containsString("tpl_id"));
}
@Test
public void testAddInstance() throws Exception {
AlipayPassInstanceAddResponse response = Factory.Marketing.Pass().addInstance("2020012014534017917956080", "{}",
"1", "{\"partner_id\":\"2088102114633762\",\"out_trade_no\":\"1234567\"}");
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40004"));
assertThat(response.msg, is("Business Failed"));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.success, is(false));
}
@Test
public void testUpdateInstance() throws Exception {
AlipayPassInstanceUpdateResponse response = Factory.Marketing.Pass().updateInstance("209919213",
"2088918273", "{}", "USED", "8612231273", "wave");
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40004"));
assertThat(response.msg, is("Business Failed"));
assertThat(response.subCode, is("KP.AE_ALIPASS_NOTEXIST"));
assertThat(response.subMsg, is("卡券不存在"));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.success, is(false));
assertThat(response.result, containsString("{\"operate\":\"UPDATE\"}"));
}
private String getTplContent() {
return "{\"logo\":\"http://img01.taobaocdn.com/top/i1/LB1NDJuQpXXXXbYXFXXXXXXXXXX\",\"strip\":null,\"icon\":null,"
+ "\"content\":{\"evoucherInfo\":{\"goodsId\":\"\",\"title\":\"test\",\"type\":\"boardingPass\","
+ "\"product\":\"air\",\"startDate\":\"2020-01-20 13:45:56\",\"endDate\":\"2020-01-25 13:45:56\","
+ "\"operation\":[{\"message\":{\"img\":\"http://img01.taobaocdn.com/top/i1/LB1NDJuQpXXXXbYXFXXXXXXXXXX\","
+ "\"target\":\"\"},\"format\":\"img\",\"messageEncoding\":\"utf-8\",\"altText\":\"\"}],"
+ "\"einfo\":{\"logoText\":\"test\",\"headFields\":[{\"key\":\"test\",\"label\":\"测试\",\"value\":\"\","
+ "\"type\":\"text\"}],\"primaryFields\":[{\"key\":\"from\",\"label\":\"测试\",\"value\":\"\",\"type\":\"text\"},"
+ "{\"key\":\"to\",\"label\":\"测试\",\"value\":\"\",\"type\":\"text\"}],\"secondaryFields\":[{\"key\":\"fltNo\","
+ "\"label\":\"航班号\",\"value\":\"CA123\",\"type\":\"text\"}],\"auxiliaryFields\":[{\"key\":\"test\","
+ "\"label\":\"测试\",\"value\":\"\",\"type\":\"text\"}],\"backFields\":[]},\"locations\":[]},"
+ "\"merchant\":{\"mname\":\"钟雨\",\"mtel\":\"\",\"minfo\":\"\"},\"platform\":{\"channelID\":\"2088201564809153\","
+ "\"webServiceUrl\":\"https://alipass.alipay.com/builder/syncRecord.htm?tempId=2020012013442621326446216\"},"
+ "\"style\":{\"backgroundColor\":\"RGB(26,150,219)\"},\"fileInfo\":{\"formatVersion\":\"2\",\"canShare\":true,"
+ "\"canBuy\":false,\"canPresent\":true,\"serialNumber\":\"2020012013520759738677158\",\"supportTaxi\":\"true\","
+ "\"taxiSchemaUrl\":\"alipays://platformapi/startapp?appId=20000778&bizid=260&channel=71322\"},"
+ "\"appInfo\":{\"app\":{\"android_appid\":\"\",\"ios_appid\":\"\",\"android_launch\":\"\",\"ios_launch\":\"\","
+ "\"android_download\":\"\",\"ios_download\":\"\"},\"label\":\"测试\",\"message\":\"\"},"
+ "\"source\":\"alipassprod\",\"alipayVerify\":[\"qrcode\"]}}";
}
}
@@ -0,0 +1,39 @@
package com.alipay.easysdk.marketing.templatemessage;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.factory.Factory.Marketing;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.marketing.templatemessage.models.AlipayOpenAppMiniTemplatemessageSendResponse;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.Mini.CONFIG);
}
@Test
public void testSend() throws Exception {
AlipayOpenAppMiniTemplatemessageSendResponse response = Marketing.TemplateMessage().send(
"2088102122458832",
"2017010100000000580012345678",
"MDI4YzIxMDE2M2I5YTQzYjUxNWE4MjA4NmU1MTIyYmM=",
"page/component/index",
"{\"keyword1\": {\"value\" : \"12:00\"},\"keyword2\": {\"value\" : \"20180808\"},\"keyword3\": {\"value\" : \"支付宝\"}}");
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40004"));
assertThat(response.msg, is("Business Failed"));
assertThat(response.subCode, is("USER_TEMPLATE_ILLEGAL"));
assertThat(response.subMsg, is("模板非法"));
assertThat(response.httpBody, not(nullValue()));
}
}
@@ -0,0 +1,74 @@
package com.alipay.easysdk.member.identification;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.factory.Factory.Member;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.member.identification.models.AlipayUserCertifyOpenCertifyResponse;
import com.alipay.easysdk.member.identification.models.AlipayUserCertifyOpenInitializeResponse;
import com.alipay.easysdk.member.identification.models.AlipayUserCertifyOpenQueryResponse;
import com.alipay.easysdk.member.identification.models.IdentityParam;
import com.alipay.easysdk.member.identification.models.MerchantConfig;
import org.junit.Before;
import org.junit.Test;
import java.util.UUID;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.Mini.CONFIG);
}
@Test
public void testInit() throws Exception {
IdentityParam identityParam = new IdentityParam();
identityParam.identityType = "CERT_INFO";
identityParam.certType = "IDENTITY_CARD";
identityParam.certName = "张三";
identityParam.certNo = "5139011988090987631";
MerchantConfig merchantConfig = new MerchantConfig();
merchantConfig.returnUrl = "www.taobao.com";
AlipayUserCertifyOpenInitializeResponse response = Member.Identification().init(
UUID.randomUUID().toString(), "FACE", identityParam, merchantConfig);
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.certifyId, not(nullValue()));
}
@Test
public void testCertify() throws Exception {
AlipayUserCertifyOpenCertifyResponse response = Member.Identification().certify("1226a454daf65c2abbbe0b7b8dc30d20");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.body, containsString("https://openapi.alipay.com/gateway.do?alipay_sdk=alipay-easysdk-java-"));
assertThat(response.body, containsString("sign"));
}
@Test
public void testQuery() throws Exception {
AlipayUserCertifyOpenQueryResponse response = Member.Identification().query("89ad1f1b8171d9741c3e5620fd77f9de");
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40004"));
assertThat(response.msg, is("Business Failed"));
assertThat(response.subCode, is("CERTIFY_ID_EXPIRED"));
assertThat(response.subMsg, is("认证已失效"));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.passed, is(nullValue()));
assertThat(response.identityInfo, is(nullValue()));
assertThat(response.materialInfo, is(nullValue()));
}
}
@@ -0,0 +1,62 @@
/**
* Alipay.com Inc.
* Copyright (c) 2004-2020 All Rights Reserved.
*/
package com.alipay.easysdk.multipleFactory;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.base.image.models.AlipayOfflineMaterialImageUploadResponse;
import com.alipay.easysdk.factory.MultipleFactory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.marketing.openlife.models.AlipayOpenPublicMessageContentCreateResponse;
import org.junit.Assert;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* @author junying
* @version : MultipleFactoryTest.java, v 0.1 2020年12月23日 4:19 下午 junying Exp $
*/
public class MultipleFactoryTest {
@Test
public void testImageUpload() throws Exception {
MultipleFactory factory = new MultipleFactory();
factory.setOptions(TestAccount.Mini.CONFIG);
AlipayOfflineMaterialImageUploadResponse response = factory.Image().upload("测试图片",
"src/test/resources/fixture/sample.png");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.imageId, not(nullValue()));
assertThat(response.imageUrl, startsWith("https://"));
}
@Test
public void testCreateImageTextContent() throws Exception {
MultipleFactory factory = new MultipleFactory();
factory.setOptions(TestAccount.OpenLife.CONFIG);
AlipayOpenPublicMessageContentCreateResponse response = factory.OpenLife().createImageTextContent("标题",
"http://dl.django.t.taobao.com/rest/1.0/image?fileIds=hOTQ1lT1TtOjcxGflvnUXgAAACMAAQED",
"示例", "T", "activity", "满100减10",
"关键,热度", "13434343432,xxx@163.com");
Assert.assertThat(ResponseChecker.success(response), is(true));
Assert.assertThat(response.code, is("10000"));
Assert.assertThat(response.msg, is("Success"));
Assert.assertThat(response.subCode, is(nullValue()));
Assert.assertThat(response.subMsg, is(nullValue()));
Assert.assertThat(response.httpBody, not(nullValue()));
Assert.assertThat(response.contentId, is(notNullValue()));
Assert.assertThat(response.contentUrl, is(notNullValue()));
}
}
@@ -0,0 +1,62 @@
/**
* Alipay.com Inc.
* Copyright (c) 2004-2020 All Rights Reserved.
*/
package com.alipay.easysdk.payment.app;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.payment.app.models.AlipayTradeAppPayResponse;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.Mini.CONFIG);
}
@Test
public void testPay() throws Exception {
AlipayTradeAppPayResponse response = Factory.Payment.App().pay("iPhone6 16G",
"f4833085-0c46-4bb0-8e5f-622a02a4cffc", "0.10");
assertThat(ResponseChecker.success(response), is(true));
Assert.assertThat(response.body, containsString("app_id=2019022663440152&biz_content=%7B%22"
+ "out_trade_no%22%3A%22f4833085-0c46-4bb0-8e5f-622a02a4cffc%22%2C%22"
+ "total_amount%22%3A%220.10%22%2C%22subject%22%3A%22iPhone6+16G%22%7D&"
+ "charset=UTF-8&format=json&method=alipay.trade.app.pay"
+ "&notify_url=https%3A%2F%2Fwww.test.com%2Fcallback&sign="));
}
@Test
public void testPayWithOptional() throws Exception {
AlipayTradeAppPayResponse response = Factory.Payment.App()
.agent("ca34ea491e7146cc87d25fca24c4cD11")
.optional("extend_params", getHuabeiConfig())
.pay("iPhone6 16G", "f4833085-0c46-4bb0-8e5f-622a02a4cffc", "0.10");
Assert.assertThat(response.body, containsString("app_auth_token=ca34ea491e7146cc87d25fca24c4cD11&"
+ "app_id=2019022663440152&biz_content=%7B%22extend_params%22%3A%7B%22hb_fq_seller_percent%22%3A%22100%22%2C%22"
+ "hb_fq_num%22%3A%223%22%7D%2C%22out_trade_no%22%3A%22f4833085-0c46-4bb0-8e5f-622a02a4cffc%22%2C%22"
+ "total_amount%22%3A%220.10%22%2C%22subject%22%3A%22iPhone6+16G%22%7D&charset=UTF-8&format=json&"
+ "method=alipay.trade.app.pay&notify_url=https%3A%2F%2Fwww.test.com%2Fcallback&sign="));
}
private Map<String, String> getHuabeiConfig() {
Map<String, String> extendParams = new HashMap<>();
extendParams.put("hb_fq_num", "3");
extendParams.put("hb_fq_seller_percent", "100");
return extendParams;
}
}
@@ -0,0 +1,154 @@
package com.alipay.easysdk.payment.common;
import com.alipay.easysdk.TestAccount.Mini;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.payment.common.models.AlipayDataDataserviceBillDownloadurlQueryResponse;
import com.alipay.easysdk.payment.common.models.AlipayTradeCancelResponse;
import com.alipay.easysdk.payment.common.models.AlipayTradeCloseResponse;
import com.alipay.easysdk.payment.common.models.AlipayTradeCreateResponse;
import com.alipay.easysdk.payment.common.models.AlipayTradeFastpayRefundQueryResponse;
import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse;
import com.alipay.easysdk.payment.common.models.AlipayTradeRefundResponse;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(Mini.CONFIG);
}
@Test
public void testCreate() throws Exception {
String outTradeNo = UUID.randomUUID().toString();
AlipayTradeCreateResponse response = Factory.Payment.Common().create(
"iPhone6 16G", outTradeNo, "0.01", "2088002656718920");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.outTradeNo, is(outTradeNo));
assertThat(response.tradeNo, startsWith("202"));
}
@Test
public void testCreateWithOptional() throws Exception {
String outTradeNo = UUID.randomUUID().toString();
AlipayTradeCreateResponse response = Factory.Payment.Common().optional("goods_detail", getGoodsDetail())
.create("iPhone6 16G", outTradeNo, "0.01", "2088002656718920");
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.outTradeNo, is(outTradeNo));
assertThat(response.tradeNo, startsWith("202"));
}
private List<Object> getGoodsDetail() {
List<Object> goodsDetail = new ArrayList<>();
Map<String, Object> goodDetail = new HashMap<>();
goodDetail.put("goods_id", "apple-01");
goodDetail.put("goods_name", "iPhone6 16G");
goodDetail.put("quantity", 1);
goodDetail.put("price", "0.01");
goodsDetail.add(goodDetail);
return goodsDetail;
}
@Test
public void testQuery() throws Exception {
AlipayTradeQueryResponse response = Factory.Payment.Common().query("6f149ddb-ab8c-4546-81fb-5880b4aaa318");
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.outTradeNo, is("6f149ddb-ab8c-4546-81fb-5880b4aaa318"));
}
@Test
public void testCancel() throws Exception {
AlipayTradeCancelResponse response = Factory.Payment.Common().cancel(createNewAndReturnOutTradeNo());
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.action, is("close"));
}
@Test
public void testClose() throws Exception {
AlipayTradeCloseResponse response = Factory.Payment.Common().close(createNewAndReturnOutTradeNo());
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
}
@Test
public void testRefund() throws Exception {
AlipayTradeRefundResponse response = Factory.Payment.Common().refund(
"64628156-f784-4572-9540-485b7c91b850", "0.01");
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.refundFee, is("0.01"));
}
@Test
public void testQueryRefund() throws Exception {
AlipayTradeFastpayRefundQueryResponse response = Factory.Payment.Common().queryRefund(
"64628156-f784-4572-9540-485b7c91b850", "64628156-f784-4572-9540-485b7c91b850");
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.refundAmount, is("0.01"));
assertThat(response.totalAmount, is("0.01"));
}
@Test
public void testDownloadBill() throws Exception {
AlipayDataDataserviceBillDownloadurlQueryResponse response = Factory.Payment.Common().downloadBill("trade", "2020-01");
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.billDownloadUrl.startsWith("http://dwbillcenter.alipay.com/"), is(true));
}
private String createNewAndReturnOutTradeNo() throws Exception {
return Factory.Payment.Common().create("iPhone6 16G", UUID.randomUUID().toString(),
"88.88", "2088002656718920").outTradeNo;
}
}
@@ -0,0 +1,56 @@
package com.alipay.easysdk.payment.facetoface;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.payment.facetoface.models.AlipayTradePayResponse;
import com.alipay.easysdk.payment.facetoface.models.AlipayTradePrecreateResponse;
import org.junit.Before;
import org.junit.Test;
import java.util.UUID;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.Mini.CONFIG);
}
@Test
public void testPay() throws Exception {
AlipayTradePayResponse response = Factory.Payment.FaceToFace().pay("iPhone6 16G",
"64628156-f784-4572-9540-485b7c91b850", "0.01", "289821051157962364");
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("40004"));
assertThat(response.msg, is("Business Failed"));
assertThat(response.subCode, is("ACQ.PAYMENT_AUTH_CODE_INVALID"));
assertThat(response.subMsg, is("支付失败,获取顾客账户信息失败,请顾客刷新付款码后重新收款,如再次收款失败,请联系管理员处理。[SOUNDWAVE_PARSER_FAIL]"));
assertThat(response.httpBody, not(nullValue()));
}
@Test
public void testPreCreate() throws Exception {
AlipayTradePrecreateResponse response = Factory.Payment.FaceToFace().preCreate("iPhone6 16G",
createNewAndReturnOutTradeNo(), "0.10");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.qrCode.startsWith("https://qr.alipay.com/"), is(true));
}
private String createNewAndReturnOutTradeNo() throws Exception {
return Factory.Payment.Common().create("Iphone6 16G", UUID.randomUUID().toString(),
"88.88", "2088002656718920").outTradeNo;
}
}
@@ -0,0 +1,45 @@
package com.alipay.easysdk.payment.huabei;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.payment.huabei.models.AlipayTradeCreateResponse;
import com.alipay.easysdk.payment.huabei.models.HuabeiConfig;
import org.junit.Before;
import org.junit.Test;
import java.util.UUID;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.Mini.CONFIG);
}
@Test
public void testCreate() throws Exception {
String outTradeNo = UUID.randomUUID().toString();
HuabeiConfig config = new HuabeiConfig();
config.hbFqNum = "3";
config.hbFqSellerPercent = "0";
AlipayTradeCreateResponse response = Factory.Payment.Huabei().create("Iphone6 16G",
outTradeNo, "0.10", "2088002656718920", config);
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.outTradeNo, is(outTradeNo));
assertThat(response.tradeNo, startsWith("202"));
}
}
@@ -0,0 +1,58 @@
/**
* Alipay.com Inc.
* Copyright (c) 2004-2020 All Rights Reserved.
*/
package com.alipay.easysdk.payment.page;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.payment.page.models.AlipayTradePagePayResponse;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.Mini.CONFIG);
}
@Test
public void testPay() throws Exception {
AlipayTradePagePayResponse response = Factory.Payment.Page().pay("iPhone6 16G",
"e5b5bd79-8310-447d-b63b-0fe3a393324d", "0.10", "https://www.taobao.com");
Assert.assertThat(ResponseChecker.success(response), is(true));
assertThat(response.body.contains("<form name=\"punchout_form\" method=\"post\" "
+ "action=\"https://openapi.alipay.com/gateway.do?"), is(true));
assertThat(response.body.contains("notify_url"), is(true));
assertThat(response.body.contains("return_url"), is(true));
assertThat(response.body.contains("<input type=\"hidden\" name=\"biz_content\" value=\"{&quot;out_trade_no&quot;:&quot;"
+ "e5b5bd79-8310-447d-b63b-0fe3a393324d&quot;,&quot;total_amount&quot;:&quot;0.10&quot;,&quot;subject&quot;:&quot;iPhone6"
+ " 16G&quot;,&quot;product_code&quot;:&quot;FAST_INSTANT_TRADE_PAY&quot;}\">"), is(true));
assertThat(response.body.contains("<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >"), is(true));
assertThat(response.body.contains("<script>document.forms[0].submit();</script>"), is(true));
}
@Test
public void testPayWithOptionalNotify() throws Exception {
AlipayTradePagePayResponse response = Factory.Payment.Page().asyncNotify("https://www.test2.com/newCallback")
.pay("iPhone6 16G", "e5b5bd79-8310-447d-b63b-0fe3a393324d",
"0.10", "https://www.taobao.com");
Assert.assertThat(ResponseChecker.success(response), is(true));
assertThat(response.body.contains("<form name=\"punchout_form\" method=\"post\" "
+ "action=\"https://openapi.alipay.com/gateway.do?"), is(true));
assertThat(response.body.contains("notify_url=https%3A%2F%2Fwww.test2.com%2FnewCallback"), is(true));
assertThat(response.body.contains("return_url"), is(true));
assertThat(response.body.contains("<input type=\"hidden\" name=\"biz_content\" value=\"{&quot;out_trade_no&quot;:&quot;"
+ "e5b5bd79-8310-447d-b63b-0fe3a393324d&quot;,&quot;total_amount&quot;:&quot;0.10&quot;,&quot;subject&quot;:&quot;iPhone6"
+ " 16G&quot;,&quot;product_code&quot;:&quot;FAST_INSTANT_TRADE_PAY&quot;}\">"), is(true));
assertThat(response.body.contains("<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >"), is(true));
assertThat(response.body.contains("<script>document.forms[0].submit();</script>"), is(true));
}
}
@@ -0,0 +1,74 @@
/**
* Alipay.com Inc.
* Copyright (c) 2004-2020 All Rights Reserved.
*/
package com.alipay.easysdk.payment.wap;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.payment.wap.models.AlipayTradeWapPayResponse;
import org.junit.Before;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.Mini.CONFIG);
}
@Test
public void testPay() throws Exception {
AlipayTradeWapPayResponse response = Factory.Payment.Wap().pay("iPhone6 16G",
"b7f4bc7d-ea4b-4efd-9072-d8ea913c8946", "0.10",
"https://www.taobao.com", "https://www.taobao.com");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.body.contains("<form name=\"punchout_form\" method=\"post\" "
+ "action=\"https://openapi.alipay.com/gateway.do?"), is(true));
assertThat(response.body.contains("notify_url"), is(true));
assertThat(response.body.contains("return_url"), is(true));
assertThat(response.body.contains("<input type=\"hidden\" name=\"biz_content\" value=\"{&quot;out_trade_no&quot;:&quot;"
+ "b7f4bc7d-ea4b-4efd-9072-d8ea913c8946&quot;,&quot;total_amount&quot;:&quot;0.10&quot;,&quot;quit_url&quot;:&quot;"
+ "https://www.taobao.com&quot;,&quot;subject&quot;:&quot;iPhone6 16G&quot;,&quot;product_code&quot;:&quot;"
+ "QUICK_WAP_WAY&quot;}\">"), is(true));
assertThat(response.body.contains("<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >"), is(true));
assertThat(response.body.contains("<script>document.forms[0].submit();</script>"), is(true));
}
@Test
public void testPayWithOptional() throws Exception {
AlipayTradeWapPayResponse response = Factory.Payment.Wap()
.agent("ca34ea491e7146cc87d25fca24c4cD11").batchOptional(getOptionalArgs())
.pay("iPhone6 16G", "b7f4bc7d-ea4b-4efd-9072-d8ea913c8946", "0.10",
"https://www.taobao.com", "https://www.taobao.com");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.body.contains("<form name=\"punchout_form\" method=\"post\" "
+ "action=\"https://openapi.alipay.com/gateway.do?"), is(true));
assertThat(response.body.contains("notify_url"), is(true));
assertThat(response.body.contains("return_url"), is(true));
assertThat(response.body.contains("app_auth_token"), is(true));
assertThat(response.body.contains("timeout_express"), is(true));
assertThat(response.body.contains("body"), is(true));
assertThat(response.body.contains("<input type=\"hidden\" name=\"biz_content\" value=\"{&quot;out_trade_no&quot;:&quot;"
+ "b7f4bc7d-ea4b-4efd-9072-d8ea913c8946&quot;,&quot;total_amount&quot;:&quot;0.10&quot;,&quot;quit_url&quot;:&quot;"
+ "https://www.taobao.com&quot;,&quot;subject&quot;:&quot;iPhone6 16G&quot;,&quot;timeout_express&quot;:&quot;10m&quot;,"
+ "&quot;product_code&quot;:&quot;QUICK_WAP_WAY&quot;,&quot;body&quot;:&quot;iPhone6 16G&quot;}\">"), is(true));
assertThat(response.body.contains("<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >"), is(true));
assertThat(response.body.contains("<script>document.forms[0].submit();</script>"), is(true));
}
private Map<String, Object> getOptionalArgs() {
Map<String, Object> optionalArgs = new HashMap<>();
optionalArgs.put("timeout_express", "10m");
optionalArgs.put("body", "iPhone6 16G");
return optionalArgs;
}
}
@@ -0,0 +1,36 @@
package com.alipay.easysdk.security.textrisk;
import com.alipay.easysdk.TestAccount;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.factory.Factory.Security;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.security.textrisk.models.AlipaySecurityRiskContentDetectResponse;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(TestAccount.Mini.CONFIG);
}
@Test
public void testDetect() throws Exception {
AlipaySecurityRiskContentDetectResponse response = Security.TextRisk().detect("test");
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
assertThat(response.action, is("PASSED"));
assertThat(response.uniqueId, not(nullValue()));
}
}
@@ -0,0 +1,36 @@
/**
* Alipay.com Inc.
* Copyright (c) 2004-2020 All Rights Reserved.
*/
package com.alipay.easysdk.util.aes;
import com.alipay.easysdk.TestAccount.Mini;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.Config;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Config config = Mini.getConfig();
config.encryptKey = "aa4BtZ4tspm2wnXLb1ThQA==";
Factory.setOptions(config);
}
@Test
public void testDecrypt() throws Exception {
String plainText = Factory.Util.AES().decrypt("ILpoMowjIQjfYMR847rnFQ==");
assertThat(plainText, is("test1234567"));
}
@Test
public void testEncrypt() throws Exception {
String cipherText = Factory.Util.AES().encrypt("test1234567");
assertThat(cipherText, is("ILpoMowjIQjfYMR847rnFQ=="));
}
}
@@ -0,0 +1,117 @@
package com.alipay.easysdk.util.generic;
import com.alipay.easysdk.TestAccount.Mini;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.util.generic.models.AlipayOpenApiGenericResponse;
import com.alipay.easysdk.util.generic.models.AlipayOpenApiGenericSDKResponse;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
public class ClientTest {
@Before
public void setUp() {
Factory.setOptions(Mini.CONFIG);
}
@Test
public void testSDKExecute() throws Exception {
Map<String, Object> bizParams = new HashMap<>();
bizParams.put("subject", "iPhone6 16G");
bizParams.put("out_trade_no", "f4833085-0c46-4bb0-8e5f-622a02a4cffc");
bizParams.put("total_amount", "0.10");
java.util.Map<String, String> textParams = new java.util.HashMap<>();
AlipayOpenApiGenericSDKResponse response = Factory.Util.Generic().sdkExecute("alipay.trade.app.pay", textParams, bizParams);
Assert.assertThat(ResponseChecker.success(response), is(true));
Assert.assertThat(response.body, containsString("app_id=2019022663440152&biz_content=%7B%22"
+ "out_trade_no%22%3A%22f4833085-0c46-4bb0-8e5f-622a02a4cffc%22%2C%22"
+ "total_amount%22%3A%220.10%22%2C%22subject%22%3A%22iPhone6+16G%22%7D&"
+ "charset=UTF-8&format=json&method=alipay.trade.app.pay"
+ "&notify_url=https%3A%2F%2Fwww.test.com%2Fcallback&sign="));
}
@Test
public void testFileExecute() throws Exception {
Map<String, String> textParams = new HashMap<>();
textParams.put("image_type", "png");
textParams.put("image_name", "海底捞");
textParams.put("image_pid", "22088021822217233");
Map<String, String> fileParams = new HashMap<>();
fileParams.put("image_content", "src/test/resources/fixture/sample.png");
AlipayOpenApiGenericResponse response = Factory.Util.Generic().fileExecute("alipay.offline.material.image.upload", textParams, null, fileParams);
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
}
@Test
public void testExecuteWithoutAppAuthToken() throws Exception {
String outTradeNo = UUID.randomUUID().toString();
AlipayOpenApiGenericResponse response = Factory.Util.Generic().execute(
"alipay.trade.create", null, getBizParams(outTradeNo));
assertThat(ResponseChecker.success(response), is(true));
assertThat(response.code, is("10000"));
assertThat(response.msg, is("Success"));
assertThat(response.subCode, is(nullValue()));
assertThat(response.subMsg, is(nullValue()));
assertThat(response.httpBody, not(nullValue()));
}
@Test
public void testExecuteWithAppAuthToken() throws Exception {
String outTradeNo = UUID.randomUUID().toString();
AlipayOpenApiGenericResponse response = Factory.Util.Generic().execute(
"alipay.trade.create", getTextParams(), getBizParams(outTradeNo));
assertThat(ResponseChecker.success(response), is(false));
assertThat(response.code, is("20001"));
assertThat(response.msg, is("Insufficient Token Permissions"));
assertThat(response.subCode, is("aop.invalid-app-auth-token"));
assertThat(response.subMsg, is("无效的应用授权令牌"));
assertThat(response.httpBody, not(nullValue()));
}
private Map<String, String> getTextParams() {
Map<String, String> bizParams = new HashMap<>();
bizParams.put("app_auth_token", "201712BB_D0804adb2e743078d1822d536956X34");
return bizParams;
}
private Map<String, Object> getBizParams(String outTradeNo) {
Map<String, Object> bizParams = new HashMap<>();
bizParams.put("subject", "Iphone6 16G");
bizParams.put("out_trade_no", outTradeNo);
bizParams.put("total_amount", "0.10");
bizParams.put("buyer_id", "2088002656718920");
bizParams.put("extend_params", getHuabeiParams());
return bizParams;
}
private Map<String, String> getHuabeiParams() {
Map<String, String> extendParams = new HashMap<>();
extendParams.put("hb_fq_num", "3");
extendParams.put("hb_fq_seller_percent", "3");
return extendParams;
}
}
@@ -0,0 +1,43 @@
-----BEGIN CERTIFICATE-----
MIIDrDCCApSgAwIBAgIQICEJBI0ke5Hyfrab8lKfETANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0
aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs
YXNzIDIgUjEwHhcNMjEwOTA0MDgyMzM4WhcNMjMwOTA0MDgyMzM4WjCBjDELMAkGA1UEBhMCQ04x
JzAlBgNVBAoMHuS9r+aclOaIj+a1i+ivlembtuS4gOeahOWFrOWPuDEPMA0GA1UECwwGQWxpcGF5
MUMwQQYDVQQDDDrmlK/ku5jlrp0o5Lit5Zu9Kee9kee7nOaKgOacr+aciemZkOWFrOWPuC0yMDg4
MDQxNjcyMzM3MDY1MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoAJUERAvj8MD0Vau
bxmbHS5+/Q7eOQ+nNrRNr8ul6/i3UQFOyBdxL+/ZQQUnI/qECsERyCknVYHv1e73jrSyZRQ/Mq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GluYSBDbGFzcyAyIFJv
b3QgQ0EgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOPPShpV
nJbMqqCw6Bz1kehnoPst9pkr0V9idOwU2oyS47/HjJXk9Rd5a9xfwkPO88trUpz5
4GmmwspDXjVFu9L0eFaRuH3KMha1Ak01citbF7cQLJlS7XI+tpkTGHEY5pt3EsQg
wykfZl/A1jrnSkspMS997r2Gim54cwz+mTMgDRhZsKK/lbOeBPpWtcFizjXYCqhw
WktvQfZBYi6o4sHCshnOswi4yV1p+LuFcQ2ciYdWvULh1eZhLxHbGXyznYHi0dGN
z+I9H8aXxqAQfHVhbdHNzi77hCxFjOy+hHrGsyzjrd2swVQ2iUWP8BfEQqGLqM1g
KgWKYfcTGdbPB1MCAwEAAaNjMGEwHQYDVR0OBBYEFG/oAMxTVe7y0+408CTAK8hA
uTyRMB8GA1UdIwQYMBaAFG/oAMxTVe7y0+408CTAK8hAuTyRMA8GA1UdEwEB/wQF
MAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBLnUTfW7hp
emMbuUGCk7RBswzOT83bDM6824EkUnf+X0iKS95SUNGeeSWK2o/3ALJo5hi7GZr3
U8eLaWAcYizfO99UXMRBPw5PRR+gXGEronGUugLpxsjuynoLQu8GQAeysSXKbN1I
UugDo9u8igJORYA+5ms0s5sCUySqbQ2R5z/GoceyI9LdxIVa1RjVX8pYOj8JFwtn
DJN3ftSFvNMYwRuILKuqUYSHc2GPYiHVflDh5nDymCMOQFcFG3WsEuB+EYQPFgIU
1DHmdZcz7Llx8UOZXX2JupWCYzK1XhJb+r4hK5ncf/w8qGtYlmyJpxk3hr1TfUJX
Yf4Zr0fJsGuv
-----END CERTIFICATE-----
@@ -0,0 +1,4 @@
{
"AccessKeyId": "<- 已脱敏,如想要执行单元测试,请开发者自行替换 ->",
"AccessKeySecret": "<- 已脱敏,如想要执行单元测试,请开发者自行替换 ->"
}
@@ -0,0 +1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CgwJjAkoCKgIIYeaHR0
cDovL2NhLmFsaXBheS5jb20vY3JsNTcuY3JsMGAGCCsGAQUFBwEBBFQwUjAoBggrBgEFBQcwAoYc
aHR0cDovL2NhLmFsaXBheS5jb20vY2E2LmNlcjAmBggrBgEFBQcwAYYaaHR0cDovL2NhLmFsaXBh
eS5jb206ODM0MC8wDQYJKoZIhvcNAQELBQADggEBAEgS8ebnKFT47mMVLW3dN0gZQXdX75tsY3wA
qmTMdP3Bd0ZodRXSHFFFMF1wWkmfKBUMP0tbKGT0cGpf1H1LCvFG+hQdxCPhn1ulq7neJx+0X7RQ
Nh1AOUuVmT8C960x3IHu57zGrRYs0wC6dL35XVxWoB6C8kpMrM0SYg7V94Qypp3efpDjDevcmzaS
M27JL6eU4eP8AZ29IRz2CD7LWEZD44RZTc/EQzoPmcFMB6VU54TGLNOWCckLL8AT7nS29JBALb1P
T0pCpDJKdrrFdq/zVcJFepszzqeqHnXc+WO4u+8ShsUXwg7s9rm3vEoEz5Yr6ZWGYQUDyNEwbIGj
ZaU=
-----END CERTIFICATE-----
@@ -0,0 +1,4 @@
{
"2019022663440152": "<- 已脱敏,如想要执行单元测试,请开发者自行替换TestAccount中的相关账号并在此重新配置新的APPID与私钥的关联 ->",
"2019051064521003": "<- 已脱敏,如想要执行单元测试,请开发者自行替换TestAccount中的相关账号并在此重新配置新的APPID与私钥的关联 ->"
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB