去除paypal构造函数访问远程, 提升route:list 性能

This commit is contained in:
Edward Yang 2023-02-03 17:10:51 +08:00
parent 02855c5fb3
commit db6614e7a3
1 changed files with 3 additions and 5 deletions

View File

@ -27,11 +27,7 @@ class PaypalController
{
private PayPal $paypalClient;
/**
* PaypalController constructor.
* @throws \Throwable
*/
public function __construct()
private function initPaypal()
{
$paypalSetting = plugin_setting('paypal');
$config = [
@ -65,6 +61,7 @@ class PaypalController
*/
public function create(Request $request): JsonResponse
{
$this->initPaypal();
$data = \json_decode($request->getContent(), true);
$orderNumber = $data['orderNumber'];
$customer = current_customer();
@ -96,6 +93,7 @@ class PaypalController
*/
public function capture(Request $request): JsonResponse
{
$this->initPaypal();
$data = \json_decode($request->getContent(), true);
$orderNumber = $data['orderNumber'];
$customer = current_customer();