初始化仓库
This commit is contained in:
32
vendor/alipaysdk/easysdk/csharp/UnitTest/Base/Image/ClientTest.cs
vendored
Normal file
32
vendor/alipaysdk/easysdk/csharp/UnitTest/Base/Image/ClientTest.cs
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Base.Image.Models;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Base.Image
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpload()
|
||||
{
|
||||
AlipayOfflineMaterialImageUploadResponse response = Factory.Base.Image().Upload(
|
||||
"测试图片", TestAccount.GetSolutionBasePath() + "/UnitTest/Fixture/sample.png");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.IsNull(response.SubCode);
|
||||
Assert.IsNull(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.NotNull(response.ImageId);
|
||||
Assert.IsTrue(response.ImageUrl.StartsWith("https://"));
|
||||
}
|
||||
}
|
||||
}
|
||||
42
vendor/alipaysdk/easysdk/csharp/UnitTest/Base/OAuth/ClientTest.cs
vendored
Normal file
42
vendor/alipaysdk/easysdk/csharp/UnitTest/Base/OAuth/ClientTest.cs
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Base.OAuth.Models;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Base.OAuth
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetToken()
|
||||
{
|
||||
AlipaySystemOauthTokenResponse response = Factory.Base.OAuth().GetToken("1234567890");
|
||||
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "40002");
|
||||
Assert.AreEqual(response.Msg, "Invalid Arguments");
|
||||
Assert.AreEqual(response.SubCode, "isv.code-invalid");
|
||||
Assert.AreEqual(response.SubMsg, "授权码code无效");
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRefreshToken()
|
||||
{
|
||||
AlipaySystemOauthTokenResponse response = Factory.Base.OAuth().RefreshToken("1234567890");
|
||||
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "40002");
|
||||
Assert.AreEqual(response.Msg, "Invalid Arguments");
|
||||
Assert.AreEqual(response.SubCode, "isv.refresh-token-invalid");
|
||||
Assert.AreEqual(response.SubMsg, "刷新令牌refresh_token无效");
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
31
vendor/alipaysdk/easysdk/csharp/UnitTest/Base/Qrcode/ClientTest.cs
vendored
Normal file
31
vendor/alipaysdk/easysdk/csharp/UnitTest/Base/Qrcode/ClientTest.cs
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Base.Qrcode.Models;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Base.Qrcode
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreate()
|
||||
{
|
||||
AlipayOpenAppQrcodeCreateResponse response = Factory.Base.Qrcode().Create(
|
||||
"https://opendocs.alipay.com", "ageIndex=1", "文档站点");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.NotNull(response.QrCodeUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
32
vendor/alipaysdk/easysdk/csharp/UnitTest/Base/Video/ClientTest.cs
vendored
Normal file
32
vendor/alipaysdk/easysdk/csharp/UnitTest/Base/Video/ClientTest.cs
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Base.Video.Models;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Base.Video
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpload()
|
||||
{
|
||||
AlipayOfflineMaterialImageUploadResponse response = Factory.Base.Video().Upload(
|
||||
"测试视频", TestAccount.GetSolutionBasePath() + "/UnitTest/Fixture/sample.mp4");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.IsNull(response.SubCode);
|
||||
Assert.IsNull(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.NotNull(response.ImageId);
|
||||
Assert.IsTrue(response.ImageUrl.StartsWith("https://"));
|
||||
}
|
||||
}
|
||||
}
|
||||
33
vendor/alipaysdk/easysdk/csharp/UnitTest/Factory/FactoryTest.cs
vendored
Normal file
33
vendor/alipaysdk/easysdk/csharp/UnitTest/Factory/FactoryTest.cs
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Payment.Common.Models;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.FactoryTest
|
||||
{
|
||||
public class FactoryTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetClient()
|
||||
{
|
||||
AlipayTradeFastpayRefundQueryResponse response = Factory.GetClient<Alipay.EasySDK.Payment.Common.Client>()
|
||||
.QueryRefund("64628156-f784-4572-9540-485b7c91b850", "64628156-f784-4572-9540-485b7c91b850");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.IsNull(response.SubCode);
|
||||
Assert.IsNull(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.AreEqual(response.RefundAmount, "0.01");
|
||||
Assert.AreEqual(response.TotalAmount, "0.01");
|
||||
}
|
||||
}
|
||||
}
|
||||
22
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/alipayCertPublicKey_RSA2.crt
vendored
Normal file
22
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/alipayCertPublicKey_RSA2.crt
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDkzCCAnugAwIBAgIQIBkJAnXy/rwX3BTZaKNEzjANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
|
||||
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0
|
||||
aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQ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AQELBQADggIBAIQ8TzFy4bVIVb8+WhHKCkKNPcJe2EZuIcqvRoi727lZTJOfYy/JzLtckyZYfEI8J0lasZ29wkTta1IjSo+a6XdhudU4ONVBrL70U8Kzntplw/6TBNbLFpp7taRALjUgbCOk4EoBMbeCL0GiYYsTS0mw7xdySzmGQku4GTyqutIGPQwKxSj9iSFw1FCZqr4VP4tyXzMUgc52SzagA6i7AyLedd3tbS6lnR5BL+W9Kx9hwT8L7WANAxQzv/jGldeuSLN8bsTxlOYlsdjmIGu/C9OWblPYGpjQQIRyvs4Cc/mNhrh+14EQgwuemIIFDLOgcD+iISoN8CqegelNcJndFw1PDN6LkVoiHz9p7jzsge8RKay/QW6C03KNDpWZEUCgCUdfHfo8xKeR+LL1cfn24HKJmZt8L/aeRZwZ1jwePXFRVtiXELvgJuM/tJDIFj2KD337iV64fWcKQ/ydDVGqfDZAdcU4hQdsrPWENwPTQPfVPq2NNLMyIH9+WKx9Ed6/WzeZmIy5ZWpX1TtTolo6OJXQFeItMAjHxW/ZSZTok5IS3FuRhExturaInnzjYpx50a6kS34c5+c8hYq7sAtZ/CNLZmBnBCFDaMQqT8xFZJ5uolUaSeXxg7JFY1QsYp5RKvj4SjFwCGKJ2+hPPe9UyyltxOidNtxjaknOCeBHytOr
|
||||
-----END CERTIFICATE-----
|
||||
88
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/alipayRootCert.crt
vendored
Normal file
88
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/alipayRootCert.crt
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIBszCCAVegAwIBAgIIaeL+wBcKxnswDAYIKoEcz1UBg3UFADAuMQswCQYDVQQG
|
||||
EwJDTjEOMAwGA1UECgwFTlJDQUMxDzANBgNVBAMMBlJPT1RDQTAeFw0xMjA3MTQw
|
||||
MzExNTlaFw00MjA3MDcwMzExNTlaMC4xCzAJBgNVBAYTAkNOMQ4wDAYDVQQKDAVO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jJXk9Rd5a9xfwkPO88trUpz5
|
||||
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-----
|
||||
23
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/appCertPublicKey_2019051064521003.crt
vendored
Normal file
23
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/appCertPublicKey_2019051064521003.crt
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
-----BEGIN CERTIFICAT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BkZjAOBgNV
|
||||
HQ8BAf8EBAMCBsAwLwYDVR0fBCgwJjAkoCKgIIYeaHR0cDovL2NhLmFsaXBheS5jb20vY3JsMzcu
|
||||
Y3JsMGAGCCsGAQUFBwEBBFQwUjAoBggrBgEFBQcwAoYcaHR0cDovL2NhLmFsaXBheS5jb20vY2E2
|
||||
LmNlcjAmBggrBgEFBQcwAYYaaHR0cDovL2NhLmFsaXBheS5jb206ODM0MC8wDQYJKoZIhvcNAQEL
|
||||
BQADggEBAA0l9rTtjEl4uqE4RP4Nd+A0KgM8NmWQHLxsubDRMSeYVFMzrpSm8V9zhlxLmKdFxWP/
|
||||
OuY4SHRe8eOSA++5yJc3ihg9B7/ddK2kNTsnaB7Xtvex685kvDDR8DMZmQYeirDThGVPhUeBgPdk
|
||||
wY0R5KU6mEh2FzT3QIxDzP6t4ssSyYHhFPssZ4PXHFQ5eHzmdpJ81/85crfques67JxAm4CCfldb
|
||||
bX0DH1BUrPxcnvz4Kj5lKv1qIvBR71yUnrGFOKAVCx04VYK4dTNDI70W9lLgX1aTfLGUBTYiJe/J
|
||||
Zq/XlYhQP/T7t8HOAaCQFf2hM9tRq62EaL1UbExV2hcAP/E=
|
||||
-----END CERTIFICATE-----
|
||||
4
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/privateKey.json
vendored
Normal file
4
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/privateKey.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"2019022663440152": "<- 已脱敏,如想要执行单元测试,请开发者自行替换TestAccount中的相关账号并在此重新配置新的APPID与私钥的关联 ->",
|
||||
"2019051064521003": "<- 已脱敏,如想要执行单元测试,请开发者自行替换TestAccount中的相关账号并在此重新配置新的APPID与私钥的关联 ->"
|
||||
}
|
||||
BIN
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/sample.mp4
vendored
Normal file
BIN
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/sample.mp4
vendored
Normal file
Binary file not shown.
BIN
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/sample.png
vendored
Normal file
BIN
vendor/alipaysdk/easysdk/csharp/UnitTest/Fixture/sample.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 198 KiB |
205
vendor/alipaysdk/easysdk/csharp/UnitTest/Marketing/OpenLife/ClientTest.cs
vendored
Normal file
205
vendor/alipaysdk/easysdk/csharp/UnitTest/Marketing/OpenLife/ClientTest.cs
vendored
Normal file
@ -0,0 +1,205 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Marketing.OpenLife.Models;
|
||||
using System.Collections.Generic;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Marketing.OpenLife
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.OpenLife.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateImageTextContent()
|
||||
{
|
||||
AlipayOpenPublicMessageContentCreateResponse response = Factory.Marketing.OpenLife().CreateImageTextContent("标题",
|
||||
"http://dl.django.t.taobao.com/rest/1.0/image?fileIds=hOTQ1lT1TtOjcxGflvnUXgAAACMAAQED",
|
||||
"示例", "T", "activity", "满100减10",
|
||||
"关键,热度", "13434343432,xxx@163.com");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.NotNull(response.ContentId);
|
||||
Assert.NotNull(response.ContentUrl);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestModifyImageTextContent()
|
||||
{
|
||||
AlipayOpenPublicMessageContentModifyResponse response = Factory.Marketing.OpenLife().ModifyImageTextContent(
|
||||
"20190510645210035577f788-d6cd-4020-9dba-1a195edb7342", "新标题",
|
||||
"http://dl.django.t.taobao.com/rest/1.0/image?fileIds=hOTQ1lT1TtOjcxGflvnUXgAAACMAAQED",
|
||||
"新示例", "T", "activity", "满100减20",
|
||||
"关键,热度", "13434343432,xxx@163.com");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.AreEqual(response.ContentId, "20190510645210035577f788-d6cd-4020-9dba-1a195edb7342");
|
||||
Assert.NotNull(response.ContentUrl);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSendText()
|
||||
{
|
||||
AlipayOpenPublicMessageTotalSendResponse response = Factory.Marketing.OpenLife().SendText("测试");
|
||||
|
||||
if (response.Code.Equals("10000"))
|
||||
{
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.NotNull(response.MessageId);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "40004");
|
||||
Assert.AreEqual(response.Msg, "Business Failed");
|
||||
Assert.AreEqual(response.SubCode, "PUB.MSG_BATCH_SD_OVER");
|
||||
Assert.AreEqual(response.SubMsg, "批量发送消息频率超限");
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.Null(response.MessageId);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSendImageText()
|
||||
{
|
||||
Article article = new Article
|
||||
{
|
||||
ActionName = "测试",
|
||||
Desc = "测试",
|
||||
Title = "测试",
|
||||
ImageUrl = "http://dl.django.t.taobao.com/rest/1.0/image?fileIds=hOTQ1lT1TtOjcxGflvnUXgAAACMAAQED",
|
||||
Url = "https://docs.open.alipay.com/api_6/alipay.open.public.message.total.send"
|
||||
};
|
||||
AlipayOpenPublicMessageTotalSendResponse response = Factory.Marketing.OpenLife().SendImageText(new List<Article> { article });
|
||||
|
||||
if (response.Code.Equals("10000"))
|
||||
{
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.NotNull(response.MessageId);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "40004");
|
||||
Assert.AreEqual(response.Msg, "Business Failed");
|
||||
Assert.AreEqual(response.SubCode, "PUB.MSG_BATCH_SD_OVER");
|
||||
Assert.AreEqual(response.SubMsg, "批量发送消息频率超限");
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.Null(response.MessageId);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSendSingleMessage()
|
||||
{
|
||||
Keyword keyword = new Keyword
|
||||
{
|
||||
Color = "#85be53",
|
||||
Value = "HU7142"
|
||||
};
|
||||
Context context = new Context
|
||||
{
|
||||
HeadColor = "#85be53",
|
||||
Url = "https://docs.open.alipay.com/api_6/alipay.open.public.message.single.send",
|
||||
ActionName = "查看详情",
|
||||
Keyword1 = keyword,
|
||||
Keyword2 = keyword,
|
||||
First = keyword,
|
||||
Remark = keyword
|
||||
};
|
||||
Alipay.EasySDK.Marketing.OpenLife.Models.Template template = new Alipay.EasySDK.Marketing.OpenLife.Models.Template
|
||||
{
|
||||
TemplateId = "e44cd3e52ffa46b1a50afc145f55d1ea",
|
||||
Context = context
|
||||
};
|
||||
AlipayOpenPublicMessageSingleSendResponse response = Factory.Marketing.OpenLife().SendSingleMessage(
|
||||
"2088002656718920", template);
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.IsNull(response.SubCode);
|
||||
Assert.IsNull(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRecallMessage()
|
||||
{
|
||||
AlipayOpenPublicLifeMsgRecallResponse response = Factory.Marketing.OpenLife().RecallMessage("201905106452100327f456f6-8dd2-4a06-8b0e-ec8a3a85c46a");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.IsNull(response.SubCode);
|
||||
Assert.IsNull(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSetIndustry()
|
||||
{
|
||||
AlipayOpenPublicTemplateMessageIndustryModifyResponse response = Factory.Marketing.OpenLife().SetIndustry(
|
||||
"10001/20102", "IT科技/IT软件与服务",
|
||||
"10001/20102", "IT科技/IT软件与服务");
|
||||
|
||||
if (response.Code.Equals("10000"))
|
||||
{
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "40004");
|
||||
Assert.AreEqual(response.Msg, "Business Failed");
|
||||
Assert.AreEqual(response.SubCode, "3002");
|
||||
Assert.AreEqual(response.SubMsg, ("模板消息行业一月只能修改一次"));
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIndustry()
|
||||
{
|
||||
AlipayOpenPublicSettingCategoryQueryResponse response = Factory.Marketing.OpenLife().GetIndustry();
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.AreEqual(response.PrimaryCategory, "IT科技/IT软件与服务");
|
||||
Assert.AreEqual(response.SecondaryCategory, "IT科技/IT软件与服务");
|
||||
}
|
||||
}
|
||||
}
|
||||
100
vendor/alipaysdk/easysdk/csharp/UnitTest/Marketing/Pass/ClientTest.cs
vendored
Normal file
100
vendor/alipaysdk/easysdk/csharp/UnitTest/Marketing/Pass/ClientTest.cs
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Marketing.Pass.Models;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Marketing.Pass
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateTemplate()
|
||||
{
|
||||
AlipayPassTemplateAddResponse response = Factory.Marketing.Pass().CreateTemplate("123456789", GetTplContent());
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.True(response.Success);
|
||||
Assert.True(response.Result.Contains("tpl_id"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpdateTemplate()
|
||||
{
|
||||
AlipayPassTemplateUpdateResponse response = Factory.Marketing.Pass().UpdateTemplate("2020012014534017917956080", GetTplContent());
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.True(response.Success);
|
||||
Assert.True(response.Result.Contains("tpl_id"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddInstance()
|
||||
{
|
||||
AlipayPassInstanceAddResponse response = Factory.Marketing.Pass().AddInstance("2020012014534017917956080", "{}",
|
||||
"1", "{\"partner_id\":\"2088102114633762\",\"out_trade_no\":\"1234567\"}");
|
||||
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "40004");
|
||||
Assert.AreEqual(response.Msg, "Business Failed");
|
||||
Assert.AreEqual(response.SubCode, "KP.AE_ALIPASS_APPID_NOSUPPORT");
|
||||
Assert.AreEqual(response.SubMsg, "该AppId不支持");
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.False(response.Success);
|
||||
Assert.True(response.Result.Contains("该AppId不支持"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpdateInstance()
|
||||
{
|
||||
AlipayPassInstanceUpdateResponse response = Factory.Marketing.Pass().UpdateInstance("209919213",
|
||||
"2088918273", "{}", "USED", "8612231273", "wave");
|
||||
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "40004");
|
||||
Assert.AreEqual(response.Msg, "Business Failed");
|
||||
Assert.AreEqual(response.SubCode, "KP.AE_ALIPASS_NOTEXIST");
|
||||
Assert.AreEqual(response.SubMsg, "卡券不存在");
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.False(response.Success);
|
||||
Assert.True(response.Result.Contains("{\"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\"]}}";
|
||||
}
|
||||
}
|
||||
}
|
||||
34
vendor/alipaysdk/easysdk/csharp/UnitTest/Marketing/TemplateMessage/ClientTest.cs
vendored
Normal file
34
vendor/alipaysdk/easysdk/csharp/UnitTest/Marketing/TemplateMessage/ClientTest.cs
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Marketing.TemplateMessage.Models;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Marketing.TemplateMessage
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSend()
|
||||
{
|
||||
AlipayOpenAppMiniTemplatemessageSendResponse response = Factory.Marketing.TemplateMessage().Send(
|
||||
"2088102122458832",
|
||||
"2017010100000000580012345678",
|
||||
"MDI4YzIxMDE2M2I5YTQzYjUxNWE4MjA4NmU1MTIyYmM=",
|
||||
"page/component/index",
|
||||
"{\"keyword1\": {\"value\" : \"12:00\"},\"keyword2\": {\"value\" : \"20180808\"},\"keyword3\": {\"value\" : \"支付宝\"}}");
|
||||
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "40004");
|
||||
Assert.AreEqual(response.Msg, "Business Failed");
|
||||
Assert.AreEqual(response.SubCode, "USER_TEMPLATE_ILLEGAL");
|
||||
Assert.AreEqual(response.SubMsg, "模板非法");
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
72
vendor/alipaysdk/easysdk/csharp/UnitTest/Member/Identification/ClientTest.cs
vendored
Normal file
72
vendor/alipaysdk/easysdk/csharp/UnitTest/Member/Identification/ClientTest.cs
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Member.Identification.Models;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Member.Identification
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInit()
|
||||
{
|
||||
IdentityParam identityParam = new IdentityParam()
|
||||
{
|
||||
IdentityType = "CERT_INFO",
|
||||
CertType = "IDENTITY_CARD",
|
||||
CertName = "张三",
|
||||
CertNo = "513901198008089876"
|
||||
};
|
||||
|
||||
MerchantConfig merchantConfig = new MerchantConfig()
|
||||
{
|
||||
ReturnUrl = "www.taobao.com"
|
||||
};
|
||||
|
||||
|
||||
AlipayUserCertifyOpenInitializeResponse response = Factory.Member.Identification().Init(
|
||||
Guid.NewGuid().ToString(), "FACE", identityParam, merchantConfig);
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.IsNull(response.SubCode);
|
||||
Assert.IsNull(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.NotNull(response.CertifyId);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCertify()
|
||||
{
|
||||
AlipayUserCertifyOpenCertifyResponse response = Factory.Member.Identification().Certify("bbdb57e87211279e2c22de5846d85161");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.IsTrue(response.Body.Contains("https://openapi.alipay.com/gateway.do?alipay_sdk=alipay-easysdk-net"));
|
||||
Assert.IsTrue(response.Body.Contains("sign"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestQuery()
|
||||
{
|
||||
AlipayUserCertifyOpenQueryResponse response = Factory.Member.Identification().Query("89ad1f1b8171d9741c3e5620fd77f9de");
|
||||
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "40004");
|
||||
Assert.AreEqual(response.Msg, "Business Failed");
|
||||
Assert.AreEqual(response.SubCode, "CERTIFY_ID_EXPIRED");
|
||||
Assert.AreEqual(response.SubMsg, "认证已失效");
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.IsNull(response.Passed);
|
||||
Assert.IsNull(response.IdentityInfo);
|
||||
Assert.IsNull(response.MaterialInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
54
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/App/ClientTest.cs
vendored
Normal file
54
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/App/ClientTest.cs
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Payment.App.Models;
|
||||
using System.Collections.Generic;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Payment.App
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPay()
|
||||
{
|
||||
AlipayTradeAppPayResponse response = Factory.Payment.App().Pay("iPhone6 16G",
|
||||
"f4833085-0c46-4bb0-8e5f-622a02a4cffc", "0.10");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.IsTrue(response.Body.Contains("app_id=2019022663440152&biz_content=%7b%22subject%22%3a%22iPhone6+16G%22%2c%22" +
|
||||
"out_trade_no%22%3a%22f4833085-0c46-4bb0-8e5f-622a02a4cffc%22%2c%22total_amount%22%3a%220.10%22%7d&charset=UTF-8&" +
|
||||
"format=json&method=alipay.trade.app.pay¬ify_url=https%3a%2f%2fwww.test.com%2fcallback&sign="));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPayWithOptional()
|
||||
{
|
||||
AlipayTradeAppPayResponse response = Factory.Payment.App()
|
||||
.Agent("ca34ea491e7146cc87d25fca24c4cD11")
|
||||
.Optional("extend_params", GetHuabeiConfig())
|
||||
.Pay("iPhone6 16G", "f4833085-0c46-4bb0-8e5f-622a02a4cffc", "0.10");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.IsTrue(response.Body.Contains("app_auth_token=ca34ea491e7146cc87d25fca24c4cD11&app_id=2019022663440152&biz_content=%7b%22subject%22%3a%22iPhone6+16G%22%2c"
|
||||
+ "%22out_trade_no%22%3a%22f4833085-0c46-4bb0-8e5f-622a02a4cffc%22%2c%22total_amount%22%3a%220"
|
||||
+ ".10%22%2c%22extend_params%22%3a%7b%22hb_fq_num%22%3a%223%22%2c%22hb_fq_seller_percent%22%3a%22100%22%7d%7d&charset=UTF"
|
||||
+ "-8&format=json&method=alipay.trade.app.pay¬ify_url=https%3a%2f%2fwww.test.com%2fcallback&sign="));
|
||||
}
|
||||
|
||||
private Dictionary<string, string> GetHuabeiConfig()
|
||||
{
|
||||
Dictionary<string, string> extendParams = new Dictionary<string, string>
|
||||
{
|
||||
{ "hb_fq_num", "3" },
|
||||
{ "hb_fq_seller_percent", "100" }
|
||||
};
|
||||
return extendParams;
|
||||
}
|
||||
}
|
||||
}
|
||||
154
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/Common/ClientTest.cs
vendored
Normal file
154
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/Common/ClientTest.cs
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Payment.Common.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Payment.Common
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreate()
|
||||
{
|
||||
string outTradeNo = Guid.NewGuid().ToString();
|
||||
AlipayTradeCreateResponse response = Factory.Payment.Common().Create("iPhone6 16G",
|
||||
outTradeNo, "88.88", "2088002656718920");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.AreEqual(response.OutTradeNo, outTradeNo);
|
||||
Assert.True(response.TradeNo.StartsWith("202"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateWithOptional()
|
||||
{
|
||||
string outTradeNo = Guid.NewGuid().ToString();
|
||||
AlipayTradeCreateResponse response = Factory.Payment.Common().Optional("goods_detail", GetGoodsDetail())
|
||||
.Create("iPhone6 16G", outTradeNo, "0.01", "2088002656718920");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.AreEqual(response.OutTradeNo, outTradeNo);
|
||||
Assert.True(response.TradeNo.StartsWith("202"));
|
||||
}
|
||||
|
||||
private List<object> GetGoodsDetail()
|
||||
{
|
||||
List<object> goodsDetail = new List<object>();
|
||||
Dictionary<string, object> goodDetail = new Dictionary<string, object>();
|
||||
goodDetail.Add("goods_id", "apple-01");
|
||||
goodDetail.Add("goods_name", "iPhone6 16G");
|
||||
goodDetail.Add("quantity", 1);
|
||||
goodDetail.Add("price", "0.01");
|
||||
goodsDetail.Add(goodDetail);
|
||||
return goodsDetail;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestQuery()
|
||||
{
|
||||
AlipayTradeQueryResponse response = Factory.Payment.Common().Query("6f149ddb-ab8c-4546-81fb-5880b4aaa318");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.AreEqual(response.OutTradeNo, "6f149ddb-ab8c-4546-81fb-5880b4aaa318");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCancel()
|
||||
{
|
||||
AlipayTradeCancelResponse response = Factory.Payment.Common().Cancel(CreateNewAndReturnOutTradeNo());
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.AreEqual(response.Action, "close");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClose()
|
||||
{
|
||||
AlipayTradeCloseResponse response = Factory.Payment.Common().Close(CreateNewAndReturnOutTradeNo());
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRefund()
|
||||
{
|
||||
AlipayTradeRefundResponse response = Factory.Payment.Common().Refund(CreateNewAndReturnOutTradeNo(), "0.01");
|
||||
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "40004");
|
||||
Assert.AreEqual(response.Msg, "Business Failed");
|
||||
Assert.AreEqual(response.SubCode, "ACQ.TRADE_STATUS_ERROR");
|
||||
Assert.AreEqual(response.SubMsg, "交易状态不合法");
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestQueryRefund()
|
||||
{
|
||||
AlipayTradeFastpayRefundQueryResponse response = Factory.Payment.Common().QueryRefund(
|
||||
"64628156-f784-4572-9540-485b7c91b850", "64628156-f784-4572-9540-485b7c91b850");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.IsNull(response.SubCode);
|
||||
Assert.IsNull(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.AreEqual(response.RefundAmount, "0.01");
|
||||
Assert.AreEqual(response.TotalAmount, "0.01");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDownloadBill()
|
||||
{
|
||||
AlipayDataDataserviceBillDownloadurlQueryResponse response = Factory.Payment.Common().DownloadBill("trade", "2020-01");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.IsNull(response.SubCode);
|
||||
Assert.IsNull(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.IsTrue(response.BillDownloadUrl.StartsWith("http://dwbillcenter.alipay.com/"));
|
||||
}
|
||||
|
||||
private string CreateNewAndReturnOutTradeNo()
|
||||
{
|
||||
return Factory.Payment.Common().Create("iPhone6 16G", Guid.NewGuid().ToString(),
|
||||
"88.88", "2088002656718920").OutTradeNo;
|
||||
}
|
||||
}
|
||||
}
|
||||
51
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/FaceToFace/ClientTest.cs
vendored
Normal file
51
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/FaceToFace/ClientTest.cs
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Payment.FaceToFace.Models;
|
||||
using System;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Payment.FaceToFace
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPay()
|
||||
{
|
||||
AlipayTradePayResponse response = Factory.Payment.FaceToFace().Pay("Iphone6 16G", CreateNewAndReturnOutTradeNo(), "0.01", "1234567890");
|
||||
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "40004");
|
||||
Assert.AreEqual(response.Msg, "Business Failed");
|
||||
Assert.AreEqual(response.SubCode, "ACQ.PAYMENT_AUTH_CODE_INVALID");
|
||||
Assert.AreEqual(response.SubMsg, "支付失败,获取顾客账户信息失败,请顾客刷新付款码后重新收款,如再次收款失败,请联系管理员处理。[SOUNDWAVE_PARSER_FAIL]");
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPreCreate()
|
||||
{
|
||||
AlipayTradePrecreateResponse response = Factory.Payment.FaceToFace().PreCreate("iPhone6 16G",
|
||||
CreateNewAndReturnOutTradeNo(), "0.10");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.IsNull(response.SubCode);
|
||||
Assert.IsNull(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.IsTrue(response.QrCode.StartsWith("https://qr.alipay.com/"));
|
||||
}
|
||||
|
||||
private string CreateNewAndReturnOutTradeNo()
|
||||
{
|
||||
return Factory.Payment.Common().Create("Iphone6 16G", Guid.NewGuid().ToString(),
|
||||
"88.88", "2088002656718920").OutTradeNo;
|
||||
}
|
||||
}
|
||||
}
|
||||
39
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/Huabei/ClientTest.cs
vendored
Normal file
39
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/Huabei/ClientTest.cs
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Payment.Huabei.Models;
|
||||
using System;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Payment.HuaBei
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCrate()
|
||||
{
|
||||
string outTradeNo = Guid.NewGuid().ToString();
|
||||
HuabeiConfig config = new HuabeiConfig()
|
||||
{
|
||||
HbFqNum = "3",
|
||||
HbFqSellerPercent = "0"
|
||||
};
|
||||
AlipayTradeCreateResponse response = Factory.Payment.Huabei().Create("Iphone6 16G",
|
||||
outTradeNo, "88.88", "2088002656718920", config);
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.AreEqual(response.OutTradeNo, outTradeNo);
|
||||
Assert.True(response.TradeNo.StartsWith("202"));
|
||||
}
|
||||
}
|
||||
}
|
||||
50
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/Page/ClientTest.cs
vendored
Normal file
50
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/Page/ClientTest.cs
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Payment.Page.Models;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Payment.Page
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPay()
|
||||
{
|
||||
AlipayTradePagePayResponse response = Factory.Payment.Page().Pay("iPhone6 16G",
|
||||
"e5b5bd79-8310-447d-b63b-0fe3a393324d", "0.10", "https://www.taobao.com");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.IsTrue(response.Body.Contains("<form name=\"punchout_form\" method=\"post\" action=\"https://openapi.alipay.com/gateway.do?"));
|
||||
Assert.IsTrue(response.Body.Contains("notify_url"));
|
||||
Assert.IsTrue(response.Body.Contains("return_url"));
|
||||
Assert.IsTrue(response.Body.Contains("<input type=\"hidden\" name=\"biz_content\" value=\"{"subject":"iPhone6 16G",""
|
||||
+ "out_trade_no":"e5b5bd79-8310-447d-b63b-0fe3a393324d","total_amount":"0.10",""
|
||||
+ "product_code":"FAST_INSTANT_TRADE_PAY"}\">"));
|
||||
Assert.IsTrue(response.Body.Contains("<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >"));
|
||||
Assert.IsTrue(response.Body.Contains("<script>document.forms[0].submit();</script>"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPayWithOptionalNotify()
|
||||
{
|
||||
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.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.IsTrue(response.Body.Contains("<form name=\"punchout_form\" method=\"post\" action=\"https://openapi.alipay.com/gateway.do?"));
|
||||
Assert.IsTrue(response.Body.Contains("notify_url=https%3a%2f%2fwww.test2.com%2fnewCallback"));
|
||||
Assert.IsTrue(response.Body.Contains("return_url"));
|
||||
Assert.IsTrue(response.Body.Contains("<input type=\"hidden\" name=\"biz_content\" value=\"{"subject":"iPhone6 16G","out_trade_no":""
|
||||
+ "e5b5bd79-8310-447d-b63b-0fe3a393324d","total_amount":"0.10","product_code":""
|
||||
+ "FAST_INSTANT_TRADE_PAY"}\">"));
|
||||
Assert.IsTrue(response.Body.Contains("<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >"));
|
||||
Assert.IsTrue(response.Body.Contains("<script>document.forms[0].submit();</script>"));
|
||||
}
|
||||
}
|
||||
}
|
||||
65
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/Wap/ClientTest.cs
vendored
Normal file
65
vendor/alipaysdk/easysdk/csharp/UnitTest/Payment/Wap/ClientTest.cs
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Payment.Wap.Models;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnitTest.Payment.Wap
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPay()
|
||||
{
|
||||
AlipayTradeWapPayResponse response = Factory.Payment.Wap().Pay("iPhone6 16G",
|
||||
"b7f4bc7d-ea4b-4efd-9072-d8ea913c8946", "0.10",
|
||||
"https://www.taobao.com", "https://www.taobao.com");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.IsTrue(response.Body.Contains("<form name=\"punchout_form\" method=\"post\" action=\"https://openapi.alipay.com/gateway.do?"));
|
||||
Assert.IsTrue(response.Body.Contains("notify_url"));
|
||||
Assert.IsTrue(response.Body.Contains("return_url"));
|
||||
Assert.IsTrue(response.Body.Contains("<input type=\"hidden\" name=\"biz_content\" value=\"{"subject":"iPhone6 16G",""
|
||||
+ "out_trade_no":"b7f4bc7d-ea4b-4efd-9072-d8ea913c8946",""
|
||||
+ "total_amount":"0.10","quit_url":"https://www.taobao.com",""
|
||||
+ "product_code":"QUICK_WAP_WAY"}\">"));
|
||||
Assert.IsTrue(response.Body.Contains("<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >"));
|
||||
Assert.IsTrue(response.Body.Contains("<script>document.forms[0].submit();</script>"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPayWithOptional()
|
||||
{
|
||||
Dictionary<string, object> optionalArgs = new Dictionary<string, object>
|
||||
{
|
||||
{ "timeout_express", "10m" },
|
||||
{ "body", "iPhone6 16G"}
|
||||
};
|
||||
AlipayTradeWapPayResponse response = Factory.Payment.Wap()
|
||||
.Agent("ca34ea491e7146cc87d25fca24c4cD11").BatchOptional(optionalArgs)
|
||||
.Pay("iPhone6 16G", "b7f4bc7d-ea4b-4efd-9072-d8ea913c8946", "0.10",
|
||||
"https://www.taobao.com", "https://www.taobao.com");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.IsTrue(response.Body.Contains("<form name=\"punchout_form\" method=\"post\" "
|
||||
+ "action=\"https://openapi.alipay.com/gateway.do?"));
|
||||
Assert.IsTrue(response.Body.Contains("notify_url"));
|
||||
Assert.IsTrue(response.Body.Contains("return_url"));
|
||||
Assert.IsTrue(response.Body.Contains("app_auth_token"));
|
||||
Assert.IsTrue(response.Body.Contains("timeout_express"));
|
||||
Assert.IsTrue(response.Body.Contains("body"));
|
||||
Assert.IsTrue(response.Body.Contains("<input type=\"hidden\" name=\"biz_content\" value=\"{"subject":"iPhone6 16G","out_trade_no":""
|
||||
+ "b7f4bc7d-ea4b-4efd-9072-d8ea913c8946","total_amount":"0.10","quit_url":""
|
||||
+ "https://www.taobao.com","product_code":"QUICK_WAP_WAY","timeout_express":""
|
||||
+ "10m","body":"iPhone6 16G"}\">"));
|
||||
Assert.IsTrue(response.Body.Contains("<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >"));
|
||||
Assert.IsTrue(response.Body.Contains("<script>document.forms[0].submit();</script>"));
|
||||
}
|
||||
}
|
||||
}
|
||||
31
vendor/alipaysdk/easysdk/csharp/UnitTest/Security/TextRisk/ClientTest.cs
vendored
Normal file
31
vendor/alipaysdk/easysdk/csharp/UnitTest/Security/TextRisk/ClientTest.cs
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Security.TextRisk.Models;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Security.TextRisk
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDetect()
|
||||
{
|
||||
AlipaySecurityRiskContentDetectResponse response = Factory.Security.TextRisk().Detect("test");
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.Null(response.SubCode);
|
||||
Assert.Null(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
Assert.AreEqual(response.Action, "PASSED");
|
||||
Assert.NotNull(response.UniqueId);
|
||||
}
|
||||
}
|
||||
}
|
||||
87
vendor/alipaysdk/easysdk/csharp/UnitTest/TestAccount.cs
vendored
Normal file
87
vendor/alipaysdk/easysdk/csharp/UnitTest/TestAccount.cs
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System;
|
||||
using Alipay.EasySDK.Kernel;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
public static class TestAccount
|
||||
{
|
||||
/// <summary>
|
||||
/// 从文件中读取私钥
|
||||
///
|
||||
/// 注意:实际开发过程中,请务必注意不要将私钥信息配置在源码中(比如配置为常量或储存在配置文件的某个字段中等),因为私钥的保密等级往往比源码高得多,将会增加私钥泄露的风险。
|
||||
/// 推荐将私钥信息储存在专用的私钥文件中,将私钥文件通过安全的流程分发到服务器的安全储存区域上,仅供自己的应用运行时读取。
|
||||
/// </summary>
|
||||
/// <param name="appId">私钥对应的APP_ID</param>
|
||||
/// <returns>私钥字符串</returns>
|
||||
private static string GetPrivateKey(string appId)
|
||||
{
|
||||
IDictionary<string, string> json = JsonConvert.DeserializeObject<IDictionary<string, string>>(
|
||||
File.ReadAllText(GetSolutionBasePath() + "/UnitTest/Fixture/privateKey.json"));
|
||||
return json[appId];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取解决方案所在路径
|
||||
/// </summary>
|
||||
/// <returns>解决方案所在绝对路径</returns>
|
||||
public static string GetSolutionBasePath()
|
||||
{
|
||||
string current = Directory.GetCurrentDirectory();
|
||||
do
|
||||
{
|
||||
current = Directory.GetParent(current).ToString();
|
||||
}
|
||||
while (!current.EndsWith("bin", StringComparison.Ordinal));
|
||||
return current + "/../..";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线上小程序测试账号
|
||||
/// </summary>
|
||||
public static class Mini
|
||||
{
|
||||
public static Config CONFIG = GetConfig();
|
||||
|
||||
public static Config GetConfig()
|
||||
{
|
||||
return new Config
|
||||
{
|
||||
Protocol = "https",
|
||||
GatewayHost = "openapi.alipay.com",
|
||||
AppId = "<-- 请填写您的AppId,例如:2019022663440152 -->",
|
||||
SignType = "RSA2",
|
||||
|
||||
AlipayPublicKey = "<-- 请填写您的支付宝公钥,例如:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAumX1EaLM4ddn1Pia4SxTRb62aVYxU8I2mHMqrc"
|
||||
+ "pQU6F01mIO/DjY7R4xUWcLi0I2oH/BK/WhckEDCFsGrT7mO+JX8K4sfaWZx1aDGs0m25wOCNjp+DCVBXotXSCurqgGI/9UrY+"
|
||||
+ "QydYDnsl4jB65M3p8VilF93MfS01omEDjUW+1MM4o3FP0khmcKsoHnYGs21btEeh0LK1gnnTDlou6Jwv3Ew36CbCNY2cYkuyP"
|
||||
+ "AW0j47XqzhWJ7awAx60fwgNBq6ZOEPJnODqH20TAdTLNxPSl4qGxamjBO+RuInBy+Bc2hFHq3pNv6hTAfktggRKkKzDlDEUwg"
|
||||
+ "SLE7d2eL7P6rwIDAQAB -->",
|
||||
MerchantPrivateKey = GetPrivateKey("<-- 请填写您的AppId,例如:2019022663440152 -->"),
|
||||
NotifyUrl = "<-- 请填写您的异步通知接收服务器地址,例如:https://www.test.com/callback"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线上生活号测试账号
|
||||
/// </summary>
|
||||
public static class OpenLife
|
||||
{
|
||||
public static Config CONFIG = new Config
|
||||
{
|
||||
Protocol = "https",
|
||||
GatewayHost = "openapi.alipay.com",
|
||||
AppId = "<-- 请填写您的AppId,例如:2019051064521003 -->",
|
||||
SignType = "RSA2",
|
||||
|
||||
AlipayCertPath = "<-- 请填写您的支付宝公钥证书文件路径,例如:GetSolutionBasePath() + \"/UnitTest/Fixture/alipayCertPublicKey_RSA2.crt\" -->",
|
||||
AlipayRootCertPath = "<-- 请填写您的支付宝根证书文件路径,例如:GetSolutionBasePath() + \"/UnitTest/Fixture/alipayRootCert.crt\" -->",
|
||||
MerchantCertPath = "<-- 请填写您的应用公钥证书文件路径,例如:GetSolutionBasePath() + \"/UnitTest/Fixture/appCertPublicKey_2019051064521003.crt\" -->",
|
||||
MerchantPrivateKey = GetPrivateKey("<-- 请填写您的AppId,例如:2019051064521003 -->")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
50
vendor/alipaysdk/easysdk/csharp/UnitTest/UnitTest.csproj
vendored
Normal file
50
vendor/alipaysdk/easysdk/csharp/UnitTest/UnitTest.csproj
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="nunit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Fixture\" />
|
||||
<Folder Include="Base\" />
|
||||
<Folder Include="Base\OAuth\" />
|
||||
<Folder Include="Marketing\" />
|
||||
<Folder Include="Marketing\Pass\" />
|
||||
<Folder Include="Payment\" />
|
||||
<Folder Include="Base\Qrcode\" />
|
||||
<Folder Include="Marketing\OpenLife\" />
|
||||
<Folder Include="Marketing\TemplateMessage\" />
|
||||
<Folder Include="Member\" />
|
||||
<Folder Include="Security\" />
|
||||
<Folder Include="Security\TextRisk\" />
|
||||
<Folder Include="Base\Image\" />
|
||||
<Folder Include="Base\Video\" />
|
||||
<Folder Include="Member\Identification\" />
|
||||
<Folder Include="Payment\Common\" />
|
||||
<Folder Include="Payment\FaceToFace\" />
|
||||
<Folder Include="Util\" />
|
||||
<Folder Include="Util\Generic\" />
|
||||
<Folder Include="Payment\Wap\" />
|
||||
<Folder Include="Payment\Page\" />
|
||||
<Folder Include="Payment\App\" />
|
||||
<Folder Include="Util\AES\" />
|
||||
<Folder Include="Factory\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Payment\FaceToFace\ClientTest %28副本%29.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AlipayEasySDK\AlipayEasySDK.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
31
vendor/alipaysdk/easysdk/csharp/UnitTest/Util/AES/ClientTest.cs
vendored
Normal file
31
vendor/alipaysdk/easysdk/csharp/UnitTest/Util/AES/ClientTest.cs
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Kernel;
|
||||
|
||||
namespace UnitTest.Util.AES
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Config config = TestAccount.Mini.GetConfig();
|
||||
config.EncryptKey = "aa4BtZ4tspm2wnXLb1ThQA==";
|
||||
Factory.SetOptions(config);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDecrypt()
|
||||
{
|
||||
string plainText = Factory.Util.AES().Decrypt("ILpoMowjIQjfYMR847rnFQ==");
|
||||
Assert.AreEqual(plainText, "test1234567");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEncrypt()
|
||||
{
|
||||
string cipherText = Factory.Util.AES().Encrypt("test1234567");
|
||||
Assert.AreEqual(cipherText, "ILpoMowjIQjfYMR847rnFQ==");
|
||||
}
|
||||
}
|
||||
}
|
||||
79
vendor/alipaysdk/easysdk/csharp/UnitTest/Util/Generic/ClientTest.cs
vendored
Normal file
79
vendor/alipaysdk/easysdk/csharp/UnitTest/Util/Generic/ClientTest.cs
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
using NUnit.Framework;
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Util.Generic.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
|
||||
namespace UnitTest.Util.Generic
|
||||
{
|
||||
public class ClientTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Factory.SetOptions(TestAccount.Mini.CONFIG);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestExecuteWithoutAppAuthToken()
|
||||
{
|
||||
string outTradeNo = Guid.NewGuid().ToString();
|
||||
AlipayOpenApiGenericResponse response = Factory.Util.Generic().Execute(
|
||||
"alipay.trade.create", null, GetBizParams(outTradeNo));
|
||||
|
||||
Assert.IsTrue(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "10000");
|
||||
Assert.AreEqual(response.Msg, "Success");
|
||||
Assert.IsNull(response.SubCode);
|
||||
Assert.IsNull(response.SubMsg);
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestExecuteWithAppAuthToken()
|
||||
{
|
||||
string outTradeNo = Guid.NewGuid().ToString();
|
||||
AlipayOpenApiGenericResponse response = Factory.Util.Generic().Execute(
|
||||
"alipay.trade.create", GetTextParams(), GetBizParams(outTradeNo));
|
||||
|
||||
Assert.IsFalse(ResponseChecker.Success(response));
|
||||
Assert.AreEqual(response.Code, "20001");
|
||||
Assert.AreEqual(response.Msg, "Insufficient Token Permissions");
|
||||
Assert.AreEqual(response.SubCode, "aop.invalid-app-auth-token");
|
||||
Assert.AreEqual(response.SubMsg, "无效的应用授权令牌");
|
||||
Assert.NotNull(response.HttpBody);
|
||||
}
|
||||
|
||||
private Dictionary<string, string> GetTextParams()
|
||||
{
|
||||
return new Dictionary<string, string>
|
||||
{
|
||||
{ "app_auth_token", "201712BB_D0804adb2e743078d1822d536956X34" }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
private Dictionary<string, object> GetBizParams(string outTradeNo)
|
||||
{
|
||||
return new Dictionary<string, object>
|
||||
{
|
||||
{ "subject", "Iphone6 16G" },
|
||||
{ "out_trade_no", outTradeNo },
|
||||
{ "total_amount", "0.10" },
|
||||
{ "buyer_id", "2088002656718920" },
|
||||
{ "extend_params", GetHuabeiParams() }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
private Dictionary<string, string> GetHuabeiParams()
|
||||
{
|
||||
return new Dictionary<string, string>
|
||||
{
|
||||
{ "hb_fq_num", "3"},
|
||||
{ "hb_fq_seller_percent", "3"}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user