This commit is contained in:
39
app/Service/Test/Adapter/PayService.php
Normal file
39
app/Service/Test/Adapter/PayService.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* This service file is part of item.
|
||||
*
|
||||
* @author ctexthuang
|
||||
* @contact ctexthuang@qq.com
|
||||
* @web_site https://ctexthuang.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Test\Adapter;
|
||||
|
||||
use App\Service\Test\Adapter\Pay\AlipayAdapter;
|
||||
use App\Service\Test\Adapter\Pay\AlipayService;
|
||||
use App\Service\Test\Adapter\Pay\WechatPayAdapter;
|
||||
use App\Service\Test\Adapter\Pay\WechatPayService;
|
||||
use App\Service\Test\TestBaseService;
|
||||
|
||||
class PayService extends TestBaseService
|
||||
{
|
||||
public function handle()
|
||||
{
|
||||
|
||||
$alipayRes = (new AlipayAdapter(new AlipayService))->pay(100.00);
|
||||
echo 'alipayRes:'. json_encode($alipayRes).PHP_EOL;
|
||||
|
||||
$wechatPay = new WechatPayService();
|
||||
$wechatPayAdapter = new WechatPayAdapter($wechatPay);
|
||||
$wechatPayRes = $wechatPayAdapter->pay(100.00);
|
||||
|
||||
echo 'wechatPayRes:'. json_encode($wechatPayRes).PHP_EOL;
|
||||
|
||||
return $this->return->success('success',[
|
||||
'alipayRes' => $alipayRes,
|
||||
'wechatPayRes' => $wechatPayRes,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user