feat : Proxy payment
This commit is contained in:
33
app/Service/Test/Proxy/AopService.php
Normal file
33
app/Service/Test/Proxy/AopService.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?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\Proxy;
|
||||||
|
|
||||||
|
use App\Service\Test\Proxy\Payment\PaymentService;
|
||||||
|
use App\Service\Test\TestBaseService;
|
||||||
|
use Hyperf\Di\Annotation\Inject;
|
||||||
|
|
||||||
|
class AopService extends TestBaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var PaymentService
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected PaymentService $paymentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function handle(): array
|
||||||
|
{
|
||||||
|
return $this->return->success('success',$this->paymentService->pay((float)$this->request->input('amount',1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
29
app/Service/Test/Proxy/Payment/PaymentService.php
Normal file
29
app/Service/Test/Proxy/Payment/PaymentService.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?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\Proxy\Payment;
|
||||||
|
|
||||||
|
use App\Interface\Test\Proxy\PaymentInterface;
|
||||||
|
|
||||||
|
class PaymentService implements PaymentInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param float $amount
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function pay(float $amount): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'amount' => $amount,
|
||||||
|
'msg' => 'Processing payment of '.$amount. PHP_EOL,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user