|
@@ -20,14 +20,14 @@ use SixShop\Payment\Enum\RefundStatusEnum;
|
|
|
use SixShop\Payment\Event\PaymentSuccessEvent;
|
|
use SixShop\Payment\Event\PaymentSuccessEvent;
|
|
|
use SixShop\Payment\Event\RefundSuccessEvent;
|
|
use SixShop\Payment\Event\RefundSuccessEvent;
|
|
|
use SixShop\Wechat\Facade\WechatUser;
|
|
use SixShop\Wechat\Facade\WechatUser;
|
|
|
-use SixShop\Wechat\Service\MiniApp;
|
|
|
|
|
use SixShop\WechatPay\Job\QueryRefundJob;
|
|
use SixShop\WechatPay\Job\QueryRefundJob;
|
|
|
|
|
+use SixShop\WechatPay\Service\NotifyService;
|
|
|
use SixShop\WechatPay\Trait\ApiTrait;
|
|
use SixShop\WechatPay\Trait\ApiTrait;
|
|
|
use SixShop\WechatPay\Trait\MiniAppTrait;
|
|
use SixShop\WechatPay\Trait\MiniAppTrait;
|
|
|
use SixShop\WechatPay\Trait\PaymentParamsTrait;
|
|
use SixShop\WechatPay\Trait\PaymentParamsTrait;
|
|
|
-use SixShop\WechatPay\Trait\UploadShippingInfoTrait;
|
|
|
|
|
use think\facade\Db;
|
|
use think\facade\Db;
|
|
|
use think\facade\Event;
|
|
use think\facade\Event;
|
|
|
|
|
+use think\facade\Log;
|
|
|
use function SixShop\Core\throw_logic_exception;
|
|
use function SixShop\Core\throw_logic_exception;
|
|
|
|
|
|
|
|
class PaymentProvider implements PaymentProviderInterface
|
|
class PaymentProvider implements PaymentProviderInterface
|
|
@@ -42,7 +42,8 @@ class PaymentProvider implements PaymentProviderInterface
|
|
|
|
|
|
|
|
public function __construct(
|
|
public function __construct(
|
|
|
private readonly ExtensionPaymentEntity $extensionPaymentEntity,
|
|
private readonly ExtensionPaymentEntity $extensionPaymentEntity,
|
|
|
- private readonly ExtensionRefundEntity $extensionRefundEntity
|
|
|
|
|
|
|
+ private readonly ExtensionRefundEntity $extensionRefundEntity,
|
|
|
|
|
+ private readonly NotifyService $notifyService,
|
|
|
)
|
|
)
|
|
|
{
|
|
{
|
|
|
}
|
|
}
|
|
@@ -95,9 +96,21 @@ class PaymentProvider implements PaymentProviderInterface
|
|
|
return new PaymentResponse(orderNo: $payment->out_trade_no, type: self::PAYMENT_TYPE, raw: $payment->toArray());
|
|
return new PaymentResponse(orderNo: $payment->out_trade_no, type: self::PAYMENT_TYPE, raw: $payment->toArray());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 支付成功通知
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param array{headers: array<string, string>, inBody: array<string, mixed>} $request
|
|
|
|
|
+ * @return PaymentNotifyResult
|
|
|
|
|
+ * @throws \Exception]
|
|
|
|
|
+ */
|
|
|
public function notify(array $request): PaymentNotifyResult
|
|
public function notify(array $request): PaymentNotifyResult
|
|
|
{
|
|
{
|
|
|
- throw new \Exception('Not implemented');
|
|
|
|
|
|
|
+ if ($request['event_type'] === 'TRANSACTION.SUCCESS') {
|
|
|
|
|
+ $data = $this->notifyService->transactionSuccess($request['headers'], $request['inBody']);
|
|
|
|
|
+ Log::info(__METHOD__ . json_encode($data));
|
|
|
|
|
+ // todo
|
|
|
|
|
+ }
|
|
|
|
|
+ throw new \Exception('Not implemented');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function query(int $recordID): PaymentQueryResult
|
|
public function query(int $recordID): PaymentQueryResult
|