|
|
@@ -2,6 +2,7 @@
|
|
|
declare(strict_types=1);
|
|
|
namespace SixShop\Payment;
|
|
|
|
|
|
+use SixShop\Payment\Contracts\PaymentQueryResult;
|
|
|
use SixShop\Payment\Contracts\PaymentResponse;
|
|
|
use SixShop\Payment\Entity\ExtensionPaymentEntity;
|
|
|
use SixShop\Payment\Enum\PaymentBizEnum;
|
|
|
@@ -31,8 +32,8 @@ readonly class PaymentManager
|
|
|
{
|
|
|
/* @var PaymentInfo[] $paymentList */
|
|
|
$paymentList = Event::trigger(GatheringPaymentEvent::class);
|
|
|
- $paymentIds = array_column($paymentList, 'id');
|
|
|
- $statusMap = ExtensionModel::whereIn('id', $paymentIds)->column(['status','id'], 'id', true);
|
|
|
+ $paymentIDs = array_column($paymentList, 'id');
|
|
|
+ $statusMap = ExtensionModel::whereIn('id', $paymentIDs)->column(['status','id'], 'id', true);
|
|
|
$payTypeList = extension_config('payment', 'pay_type')??[];
|
|
|
foreach ($paymentList as $payment) {
|
|
|
$payment->status = $statusMap[$payment->id]['status'];
|
|
|
@@ -44,17 +45,26 @@ readonly class PaymentManager
|
|
|
/**
|
|
|
* 创建支付订单
|
|
|
*/
|
|
|
- public function create($paymentId, array $order, PaymentBizEnum $bizType = PaymentBizEnum::ORDER_PAY): PaymentResponse
|
|
|
+ public function create($paymentID, array $order, PaymentBizEnum $bizType = PaymentBizEnum::ORDER_PAY): PaymentResponse
|
|
|
{
|
|
|
- $extension = $this->extensionManager->getExtension($paymentId);
|
|
|
- Event::trigger(new BeforePayEvent($order, $paymentId, $bizType));
|
|
|
+ $extension = $this->extensionManager->getExtension($paymentID);
|
|
|
+ Event::trigger(new BeforePayEvent($order, $paymentID, $bizType));
|
|
|
return $extension->getPaymentProvider()->create($order, $bizType);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询支付订单
|
|
|
+ */
|
|
|
+ public function query($paymentID, $recordID): PaymentQueryResult
|
|
|
+ {
|
|
|
+ $extension = $this->extensionManager->getExtension($paymentID);
|
|
|
+ return $extension->getPaymentProvider()->query($recordID);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取指定支付方式
|
|
|
*/
|
|
|
- public function getPayment($paymentId):array
|
|
|
+ public function getPayment($paymentID):array
|
|
|
{
|
|
|
return [
|
|
|
// todo
|
|
|
@@ -64,7 +74,7 @@ readonly class PaymentManager
|
|
|
/**
|
|
|
* 开启支付方式
|
|
|
*/
|
|
|
- public function enablePayment($paymentId):bool
|
|
|
+ public function enablePayment($paymentID):bool
|
|
|
{
|
|
|
// todo
|
|
|
return true;
|
|
|
@@ -73,7 +83,7 @@ readonly class PaymentManager
|
|
|
/**
|
|
|
* 关闭支付方式
|
|
|
*/
|
|
|
- public function disablePayment($paymentId):bool
|
|
|
+ public function disablePayment($paymentID):bool
|
|
|
{
|
|
|
// todo
|
|
|
return true;
|