feat : Bridge pay
This commit is contained in:
53
app/Service/Test/Bridge/Pay/PaymentGateway.php
Normal file
53
app/Service/Test/Bridge/Pay/PaymentGateway.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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\Bridge\Pay;
|
||||
|
||||
use App\Interface\Test\Bridge\PaymentInterface;
|
||||
use App\Interface\Test\Decorator\LoggerInterface;
|
||||
|
||||
abstract class PaymentGateway
|
||||
{
|
||||
/**
|
||||
* @var PaymentInterface
|
||||
*/
|
||||
protected PaymentInterface $payment;
|
||||
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected LoggerInterface $logger;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param PaymentInterface $payment
|
||||
* @param LoggerInterface $logger
|
||||
*/
|
||||
public function __construct(PaymentInterface $payment, LoggerInterface $logger)
|
||||
{
|
||||
$this->payment = $payment;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* 抽象支付类
|
||||
* @param float $amount
|
||||
* @return array
|
||||
*/
|
||||
abstract public function processPayment(float $amount): array;
|
||||
|
||||
/**
|
||||
* 抽象退款类
|
||||
* @param float $amount
|
||||
* @return array
|
||||
*/
|
||||
abstract public function processRefund(float $amount): array;
|
||||
}
|
||||
Reference in New Issue
Block a user