添加网站文件

This commit is contained in:
2025-12-22 13:59:40 +08:00
commit 117aaf83d1
19468 changed files with 2111999 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace Alipay\EasySDK\Test;
use Alipay\EasySDK\Kernel\Config;
class TestAccount
{
public function getTestAccount()
{
$options = new Config();
$options->protocol = 'https';
$options->gatewayHost = 'openapi.alipay.com';
$options->appId = '<-- 请填写您的AppId例如2019022663440152 -->';
$options->signType = 'RSA2';
$options->alipayPublicKey = '<-- 请填写您的支付宝公钥例如MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAumX1EaLM4ddn1Pia4SxTRb62aVYxU8I2mHMqrcpQU6F01mIO/DjY7R4xUWcLi0I2oH/BK/WhckEDCFsGrT7mO+JX8K4sfaWZx1aDGs0m25wOCNjp+DCVBXotXSCurqgGI/9UrY+QydYDnsl4jB65M3p8VilF93MfS01omEDjUW+1MM4o3FP0khmcKsoHnYGs21btEeh0LK1gnnTDlou6Jwv3Ew36CbCNY2cYkuyPAW0j47XqzhWJ7awAx60fwgNBq6ZOEPJnODqH20TAdTLNxPSl4qGxamjBO+RuInBy+Bc2hFHq3pNv6hTAfktggRKkKzDlDEUwgSLE7d2eL7P6rwIDAQAB -->';
$options->merchantPrivateKey = $this->getPrivateKey($options->appId);
return $options;
}
public function getTestCertAccount()
{
$options = new Config();
$options->protocol = 'https';
$options->gatewayHost = 'openapi.alipay.com';
$options->appId = '<-- 请填写您的AppId例如2019051064521003 -->';
$options->signType = 'RSA2';
$options->alipayCertPath = '<-- 请填写您的支付宝公钥证书文件路径例如dirname(__FILE__) . "/resources/fixture/alipayCertPublicKey_RSA2.crt" -->';
$options->alipayRootCertPath = '<-- 请填写您的支付宝根证书文件路径例如dirname(__FILE__) . "/resources/fixture/alipayRootCert.crt" -->';
$options->merchantCertPath = '<-- 请填写您的应用公钥证书文件路径例如dirname(__FILE__) . "/resources/fixture/appCertPublicKey_2019051064521003.crt" -->';
$options->merchantPrivateKey = $this->getPrivateKey($options->appId);
return $options;
}
private function getPrivateKey($appId)
{
$filePath = dirname(__FILE__) . '/resources/fixture/privateKey.json';
$stream = fopen($filePath, 'r');
fwrite($stream, '$filePath');
$result = json_decode(stream_get_contents($stream));
return $result->$appId;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Alipay\EasySDK\Test\base\image;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use Alipay\EasySDK\Kernel\Util\ResponseChecker;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function testUpload(){
$account = new TestAccount();
$responseChecker = new ResponseChecker();
Factory::setOptions($account->getTestAccount());
$filePath = $account->getResourcesPath(). '/resources/fixture/sample.png';
$result = Factory::base()->image()->upload("测试图片", $filePath);
$this->assertEquals(true, $responseChecker->success($result));
$this->assertEquals('Success', $result->msg);
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Alipay\EasySDK\Test\base\oauth;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
}
public function testGetTokenWhenGrantTypeIsAuthorizationCode()
{
$result = Factory::base()->oauth()->getToken('ee4b3c871f7c4f30a82251908458VB64');
$this->assertEquals('40002', $result->code);
$this->assertEquals('Invalid Arguments', $result->msg);
$this->assertEquals('isv.code-invalid', $result->subCode);
$this->assertEquals('授权码code无效', $result->subMsg);
}
public function testGetTokenWhenGrantTypeIsRefreshToken()
{
$result = Factory::base()->oauth()->refreshToken('1234567890');
$this->assertEquals('40002', $result->code);
$this->assertEquals('Invalid Arguments', $result->msg);
$this->assertEquals('isv.refresh-token-invalid', $result->subCode);
$this->assertEquals('刷新令牌refresh_token无效', $result->subMsg);
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Alipay\EasySDK\Test\Base;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Kernel\Util\ResponseChecker;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function testCreate(){
$account = new TestAccount();
$responseChecker = new ResponseChecker();
Factory::setOptions($account->getTestAccount());
$result = Factory::base()->qrcode()->create('https://opendocs.alipay.com','ageIndex=1','文档站点');
$this->assertEquals(true, $responseChecker->success($result));
$this->assertEquals('Success', $result->msg);
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Alipay\EasySDK\Test\base\video;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Kernel\Util\ResponseChecker;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function testUpload(){
$account = new TestAccount();
$responseChecker = new ResponseChecker();
Factory::setOptions($account->getTestAccount());
$filePath = $account->getResourcesPath() . '/resources/fixture/sample.mp4';
$result = Factory::base()->video()->upload("测试视频", $filePath);
$this->assertEquals(true, $responseChecker->success($result));
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
}

View File

@@ -0,0 +1,145 @@
<?php
namespace Alipay\EasySDK\Test\marketing\openlife;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Marketing\OpenLife\Models\Article;
use Alipay\EasySDK\Marketing\OpenLife\Models\Context;
use Alipay\EasySDK\Marketing\OpenLife\Models\Keyword;
use Alipay\EasySDK\Marketing\OpenLife\Models\Template;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$account = new TestAccount();
Factory::setOptions($account->getTestCertAccount());
}
public function testCreateImageTextContent()
{
$result = Factory::marketing()->openLife()->createImageTextContent("标题",
"http://dl.django.t.taobao.com/rest/1.0/image?fileIds=hOTQ1lT1TtOjcxGflvnUXgAAACMAAQED",
"示例", "T", "activity", "满100减10",
"关键,热度", "13434343432,xxx@163.com");
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
public function testModifyImageTextContent()
{
$result = 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");
if ($result->code == '10000') {
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
} else {
$this->assertEquals('40004', $result->code);
$this->assertEquals('Business Failed', $result->msg);
$this->assertEquals('PUB.MSG_BATCH_SD_OVER', $result->subCode);
$this->assertEquals('批量发送消息频率超限', $result->subMsg);
}
}
public function testSendText()
{
$result = Factory::marketing()->openLife()->sendText("测试");
if ($result->code == '10000') {
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
} else {
$this->assertEquals('40004', $result->code);
$this->assertEquals('Business Failed', $result->msg);
$this->assertEquals('PUB.MSG_BATCH_SD_OVER', $result->subCode);
$this->assertEquals('批量发送消息频率超限', $result->subMsg);
}
}
public function testSendImageText()
{
$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';
$result = Factory::marketing()->openLife()->sendImageText((array)$article);
if ($result->code == '10000') {
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
} else {
$this->assertEquals('40004', $result->code);
$this->assertEquals('Business Failed', $result->msg);
$this->assertEquals('PUB.MSG_BATCH_SD_OVER', $result->subCode);
$this->assertEquals('批量发送消息频率超限', $result->subMsg);
}
}
public function testSendSingleMessage()
{
$keyword = new Keyword();
$keyword->color = "#85be53";
$keyword->value = "HU7142";
$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 = new Template();
$template->templateId = "e44cd3e52ffa46b1a50afc145f55d1ea";
$template->context = $context;
$result = Factory::marketing()->openLife()->sendSingleMessage("2088002656718920", $template);
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
public function testRecallMessage()
{
$result = Factory::marketing()->openLife()->recallMessage("201905106452100327f456f6-8dd2-4a06-8b0e-ec8a3a85c46a");
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
public function testSetIndustry()
{
$result = Factory::marketing()->openLife()->setIndustry(
"10001/20102", "IT科技/IT软件与服务",
"10001/20102", "IT科技/IT软件与服务");
if ($result->code == '10000') {
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
} else {
$this->assertEquals('40004', $result->code);
$this->assertEquals('Business Failed', $result->msg);
$this->assertEquals('3002', $result->subCode);
$this->assertEquals('模板消息行业一月只能修改一次', $result->subMsg);
}
}
public function testGetIndustry()
{
$result = Factory::marketing()->openLife()->getIndustry();
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
$this->assertEquals('IT科技/IT软件与服务', $result->primaryCategory);
$this->assertEquals('IT科技/IT软件与服务', $result->secondaryCategory);
}
}

View File

@@ -0,0 +1,102 @@
<?php
namespace Alipay\EasySDK\Test\marketing\pass;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
}
public function testCreateTemplate()
{
$result = Factory::marketing()->pass()->createTemplate("1234567890", $this->getTplContent());
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
public function testUpdateTemplate()
{
$result = Factory::marketing()->pass()->updateTemplate("2020012014534017917956080", $this->getTplContent());
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
public function testAddInstance()
{
$result = Factory::marketing()->pass()->addInstance("2020012014534017917956080", "{}",
"1", "{\"partner_id\":\"2088102114633762\",\"out_trade_no\":\"1234567\"}");
$this->assertEquals('40004', $result->code);
$this->assertEquals('Business Failed', $result->msg);
$this->assertEquals('KP.AE_ALIPASS_APPID_NOSUPPORT', $result->subCode);
$this->assertEquals('该AppId不支持', $result->subMsg);
}
public function testUpdateInstance()
{
$result = Factory::marketing()->pass()->updateInstance("209919213",
"2088918273", "{}", "USED", "8612231273", "wave");
$this->assertEquals('40004', $result->code);
$this->assertEquals('Business Failed', $result->msg);
$this->assertEquals('KP.AE_ALIPASS_NOTEXIST', $result->subCode);
$this->assertEquals('卡券不存在', $result->subMsg);
}
private function 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": ""
},
"appInfo": {"app": {"android_appid": "","ios_appid": "","android_launch": "","ios_launch": "","android_download": "","ios_download": ""},"label": "测试","message": ""},
"source": "alipassprod",
"alipayVerify": ["qrcode"]}}';
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Alipay\EasySDK\Test\marketing\templatemessage;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function testSend(){
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
$result = Factory::marketing()->templateMessage()->send("2088102122458832",
"2017010100000000580012345678",
"MDI4YzIxMDE2M2I5YTQzYjUxNWE4MjA4NmU1MTIyYmM=",
"page/component/index",
"{\"keyword1\": {\"value\" : \"12:00\"},\"keyword2\": {\"value\" : \"20180808\"},\"keyword3\": {\"value\" : \"支付宝\"}}");
$this->assertEquals('40004',$result->code);
$this->assertEquals('Business Failed',$result->msg);
$this->assertEquals('USER_TEMPLATE_ILLEGAL',$result->subCode);
$this->assertEquals('模板非法',$result->subMsg);
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace Alipay\EasySDK\Test\member\identification;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Member\Identification\Models\IdentityParam;
use Alipay\EasySDK\Member\Identification\Models\MerchantConfig;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
}
public function testInit()
{
$identityParam = new IdentityParam();
$identityParam->identityType = "CERT_INFO";
$identityParam->certType = "IDENTITY_CARD";
$identityParam->certName = "张三";
$identityParam->certNo = "5139011988090987631";
$merchantConfig = new MerchantConfig();
$merchantConfig->returnUrl = "www.taobao.com";
$result = Factory::member()->identification()->init(microtime(),'FACE',$identityParam,$merchantConfig);
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
public function testCertify()
{
$result = Factory::member()->identification()->certify("16cbbf40de9829e337d51818a76eacc2");
$this->assertEquals(true, strpos($result->body,'sign')>0);
$this->assertEquals(true, strpos($result->body,'gateway.do')>0);
}
public function testQuery()
{
$result = Factory::member()->identification()->query("16cbbf40de9829e337d51818a76eacc2");
$this->assertEquals('40004', $result->code);
$this->assertEquals('Business Failed', $result->msg);
$this->assertEquals('CERTIFY_ID_EXPIRED',$result->subCode);
$this->assertEquals('认证已失效',$result->subMsg);
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Alipay\EasySDK\Test\multipleFactory;
use Alipay\EasySDK\Kernel\MultipleFactory;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function testSDKExecute()
{
$bizParams = array(
"subject" => "Iphone6 16G",
"out_trade_no" => "f4833085-0c46-4bb0-8e5f-622a02a4cffc",
"total_amount" => "0.10"
);
$textParams = array();
$account = new TestAccount();
MultipleFactory::setOptions($account->getTestAccount());
$result = MultipleFactory::util()->generic()->sdkExecute("alipay.trade.app.pay", $textParams, $bizParams);
$this->assertEquals(true, strpos($result->body, 'alipay_sdk=alipay-easysdk-php') > 0);
$this->assertEquals(true, strpos($result->body, 'app_id=2019022663440152') > 0);
MultipleFactory::setOptions($account->getTestCertAccount());
$result2 = MultipleFactory::util()->generic()->sdkExecute("alipay.trade.app.pay", $textParams, $bizParams);
$this->assertEquals(true, strpos($result2->body, 'alipay_sdk=alipay-easysdk-php') > 0);
$this->assertEquals(true, strpos($result2->body, 'app_id=2019051064521003') > 0);
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
}
public function testPay()
{
$result = Factory::payment()->app()->pay("Iphone6 16G", "f4833085-0c46-4bb0-8e5f-622a02a4cffc", "0.10");
$this->assertEquals(true, strpos($result->body, 'alipay_sdk=alipay-easysdk-php') > 0);
$this->assertEquals(true, strpos($result->body, 'sign') > 0);
}
public function testPayWithOptional()
{
$result = Factory::payment()->app()
->agent("ca34ea491e7146cc87d25fca24c4cD11")
->optional("extend_params",$this->getHuabeiParams())
->pay("Iphone6 16G", "f4833085-0c46-4bb0-8e5f-622a02a4cffc", "0.10");
$this->assertEquals(true, strpos($result->body, 'alipay_sdk=alipay-easysdk-php') > 0);
$this->assertEquals(true, strpos($result->body, 'sign') > 0);
}
private function getHuabeiParams()
{
$extendParams = array("hb_fq_num" => "3", "hb_fq_seller_percent" => "3");
return $extendParams;
}
}

View File

@@ -0,0 +1,93 @@
<?php
namespace Alipay\EasySDK\Test\payment\common;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
}
public function testCrate()
{
$result = Factory::payment()->common()->create("Iphone6 16G",
microtime(), "88.88", "2088002656718920");
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
return $result->outTradeNo;
}
public function testCreateWithOptional(){
$result = Factory::payment()->common()
->optional("goods_detail", $this->getGoodsDetail())
->create("Iphone6 16G",microtime(), "0.01", "2088002656718920");
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
private function getGoodsDetail(){
$goodDetail = array(
"goods_id" => "apple-01",
"goods_name" => "iPhone6 16G",
"quantity" => 1,
"price" => "0.01"
);
$goodsDetail[0] = $goodDetail;
return $goodsDetail;
}
public function testQuery()
{
$result = Factory::payment()->common()->query('6f149ddb-ab8c-4546-81fb-5880b4aaa318');
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
public function testCancel()
{
$result = Factory::payment()->common()->cancel($this->testCrate());
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
public function testClose()
{
$result = Factory::payment()->common()->close($this->testCrate());
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
public function testRefund()
{
$result = Factory::payment()->common()->refund($this->testCrate(), '0.01');
$this->assertEquals('40004', $result->code);
$this->assertEquals('Business Failed', $result->msg);
$this->assertEquals('ACQ.TRADE_STATUS_ERROR', $result->subCode);
$this->assertEquals('交易状态不合法', $result->subMsg);
}
public function testRefundQuery()
{
$result = Factory::payment()->common()->queryRefund($this->testCrate(), "20200401010101001");
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
public function testDownloadBill()
{
$result = Factory::payment()->common()->downloadBill("trade", "2020-01");
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace Alipay\EasySDK\Test\payment\facetoface;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
}
public function testPay()
{
$create =Factory::payment()->common()->create("Iphone6 16G",
microtime(), "88.88", "2088002656718920");
$result = Factory::payment()->faceToFace()->pay("Iphone6 16G", $create->outTradeNo, "0.10",
"1234567890");
$this->assertEquals('40004', $result->code);
$this->assertEquals('Business Failed', $result->msg);
$this->assertEquals('ACQ.PAYMENT_AUTH_CODE_INVALID', $result->subCode);
$this->assertEquals('支付失败获取顾客账户信息失败请顾客刷新付款码后重新收款如再次收款失败请联系管理员处理[SOUNDWAVE_PARSER_FAIL]', $result->subMsg);
}
public function testPrecreate(){
$create =Factory::payment()->common()->create("Iphone6 16G",
microtime(), "88.88", "2088002656718920");
$result = Factory::payment()->faceToFace()->precreate("Iphone6 16G", $create->outTradeNo, "0.10");
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Alipay\EasySDK\Test\payment\huabei;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Payment\Huabei\Models\HuabeiConfig;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function testCreate()
{
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
$config = new HuabeiConfig();
$config->hbFqNum = '3';
$config->hbFqSellerPercent = '0';
$result = Factory::payment()->huabei()->create("Iphone6 16G", microtime(), "0.10", "2088002656718920", $config);
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
}
public function testPay()
{
$create = Factory::payment()->common()->create("Iphone6 16G",
microtime(), "88.88", "2088002656718920");
$result = Factory::payment()->page()->pay("Iphone6 16G", $create->outTradeNo, "0.10", "https://www.taobao.com");
$this->assertEquals(true, strpos($result->body, 'alipay-easysdk-php-') > 0);
$this->assertEquals(true, strpos($result->body, 'sign') > 0);
}
public function testPayWithOptionalNotify()
{
$create = Factory::payment()->common()->create("Iphone6 16G",
microtime(), "88.88", "2088002656718920");
$result = Factory::payment()->page()
->asyncNotify("https://www.test2.com/newCallback")
->pay("Iphone6 16G", $create->outTradeNo, "0.10", "https://www.taobao.com");
$this->assertEquals(true, strpos($result->body, 'alipay-easysdk-php-') > 0);
$this->assertEquals(true, strpos($result->body, 'sign') > 0);
}
}

View File

@@ -0,0 +1,41 @@
<?php
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
}
public function testPay(){
$create =Factory::payment()->common()->create("Iphone6 16G",
microtime(), "88.88", "2088002656718920");
$result = Factory::payment()->wap()->pay("Iphone6 16G",$create->outTradeNo,"0.10","https://www.taobao.com","https://www.taobao.com");
$this->assertEquals(true, strpos($result->body,'return_url')>0);
$this->assertEquals(true, strpos($result->body,'sign')>0);
}
public function testPayWithOptional(){
$create =Factory::payment()->common()->create("Iphone6 16G",
microtime(), "88.88", "2088002656718920");
$result = Factory::payment()->wap()
->agent("ca34ea491e7146cc87d25fca24c4cD11")
->batchOptional($this->getOptionalArgs())
->pay("Iphone6 16G",$create->outTradeNo,"0.10","https://www.taobao.com","https://www.taobao.com");
$this->assertEquals(true, strpos($result->body,'return_url')>0);
$this->assertEquals(true, strpos($result->body,'sign')>0);
}
private function getOptionalArgs(){
$optionalArgs = array(
"timeout_express" => "10m",
"body" => "Iphone6 16G"
);
return $optionalArgs;
}
}

View File

@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDkzCCAnugAwIBAgIQIBkJAnXy/rwX3BTZaKNEzjANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0
aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs
YXNzIDIgUjEwHhcNMTkwOTAyMTI0NDIyWhcNMjEwOTA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XrMQ/J4PQ8mtWRMB0GA1UdDgQWBBSNSXcCsxvjAa3v5QcTyVZ183CMjzBABgNVHSAEOTA3MDUG
B2CBHAFuAQEwKjAoBggrBgEFBQcCARYcaHR0cDovL2NhLmFsaXBheS5jb20vY3BzLnBkZjAOBgNV
HQ8BAf8EBAMCBsAwLwYDVR0fBCgwJjAkoCKgIIYeaHR0cDovL2NhLmFsaXBheS5jb20vY3JsMzcu
Y3JsMGAGCCsGAQUFBwEBBFQwUjAoBggrBgEFBQcwAoYcaHR0cDovL2NhLmFsaXBheS5jb20vY2E2
LmNlcjAmBggrBgEFBQcwAYYaaHR0cDovL2NhLmFsaXBheS5jb206ODM0MC8wDQYJKoZIhvcNAQEL
BQADggEBAA0l9rTtjEl4uqE4RP4Nd+A0KgM8NmWQHLxsubDRMSeYVFMzrpSm8V9zhlxLmKdFxWP/
OuY4SHRe8eOSA++5yJc3ihg9B7/ddK2kNTsnaB7Xtvex685kvDDR8DMZmQYeirDThGVPhUeBgPdk
wY0R5KU6mEh2FzT3QIxDzP6t4ssSyYHhFPssZ4PXHFQ5eHzmdpJ81/85crfques67JxAm4CCfldb
bX0DH1BUrPxcnvz4Kj5lKv1qIvBR71yUnrGFOKAVCx04VYK4dTNDI70W9lLgX1aTfLGUBTYiJe/J
Zq/XlYhQP/T7t8HOAaCQFf2hM9tRq62EaL1UbExV2hcAP/E=
-----END CERTIFICATE-----

View File

@@ -0,0 +1,4 @@
{
"2019022663440152": "<- 已脱敏如想要执行单元测试请开发者自行替换TestAccount中的相关账号并在此重新配置新的APPID与私钥的关联 ->",
"2019051064521003": "<- 已脱敏如想要执行单元测试请开发者自行替换TestAccount中的相关账号并在此重新配置新的APPID与私钥的关联 ->"
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

View File

@@ -0,0 +1,20 @@
<?php
namespace Alipay\EasySDK\Test\security\textrisk;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function testDetectContent(){
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
$result = Factory::security()->textRisk()->detect("test");
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
}

View File

@@ -0,0 +1,27 @@
<?php
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
}
public function testDecrypt(){
$result = Factory::util()->aes()->decrypt("ILpoMowjIQjfYMR847rnFQ==");
$this->assertEquals(true, $result == 'test1234567');
}
public function testEncrypt(){
$result = Factory::util()->aes()->encrypt("test1234567");
$this->assertEquals(true, $result == 'ILpoMowjIQjfYMR847rnFQ==');
}
}

View File

@@ -0,0 +1,95 @@
<?php
namespace Alipay\EasySDK\Test\util\generic;
use Alipay\EasySDK\Kernel\Factory;
use Alipay\EasySDK\Test\TestAccount;
use Alipay\EasySDK\Kernel\Util\ResponseChecker;
use PHPUnit\Framework\TestCase;
class ClientTest extends TestCase
{
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
$account = new TestAccount();
Factory::setOptions($account->getTestAccount());
}
public function testSDKExecute()
{
$bizParams = array(
"subject" => "Iphone6 16G",
"out_trade_no" => "f4833085-0c46-4bb0-8e5f-622a02a4cffc",
"total_amount" => "0.10"
);
$textParams = array();
$result = Factory::util()->generic()->sdkExecute("alipay.trade.app.pay", $textParams, $bizParams);
$this->assertEquals(true, strpos($result->body, 'alipay_sdk=alipay-easysdk-php') > 0);
$this->assertEquals(true, strpos($result->body, 'sign') > 0);
}
public function testFileExecute()
{
$textParams = array(
"image_type" => "png",
"image_name" => "海底捞",
"image_pids" => "22088021822217233"
);
$account = new TestAccount();
$filePath = $account->getResourcesPath(). '/resources/fixture/sample.png';
$fileParams = array(
"image_content" => $filePath
);
$result = Factory::util()->generic()->fileExecute("alipay.offline.material.image.upload", $textParams, null, $fileParams);
$responseChecker = new ResponseChecker();
$this->assertEquals(true, $responseChecker->success($result));
$this->assertEquals('Success', $result->msg);
}
public function testExecuteWithoutAppAuthToken()
{
$result = Factory::util()->generic()->execute("alipay.trade.create", null, $this->getBizParams(microtime()));
$this->assertEquals('10000', $result->code);
$this->assertEquals('Success', $result->msg);
}
public function testExecuteWithAppAuthToken()
{
$result = Factory::util()->generic()->execute("alipay.trade.create", $this->getTextParams(), $this->getBizParams(microtime()));
$this->assertEquals('20001', $result->code);
$this->assertEquals('Insufficient Token Permissions', $result->msg);
$this->assertEquals('aop.invalid-app-auth-token', $result->subCode);
$this->assertEquals('无效的应用授权令牌', $result->subMsg);
}
//设置系统参数OpenAPI中非biz_content里的参数
private function getTextParams()
{
return array("app_auth_token" => "201712BB_D0804adb2e743078d1822d536956X34");
}
private function getBizParams($outTradeNo)
{
$bizParams = array(
"subject" => "Iphone6 16G",
"out_trade_no" => $outTradeNo,
"total_amount" => "0.10",
"buyer_id" => "2088002656718920",
"extend_params" => $this->getHuabeiParams()
);
return $bizParams;
}
private function getHuabeiParams()
{
$extendParams = array("hb_fq_num" => "3", "hb_fq_seller_percent" => "3");
return $extendParams;
}
}