From 9212b71b8a954b78067284406402a7eb56dd699c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 6 Nov 2023 20:01:27 +1100 Subject: [PATCH] Fixes for PPCP --- .../PayPalPPCPPaymentDriver.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/PaymentDrivers/PayPalPPCPPaymentDriver.php b/app/PaymentDrivers/PayPalPPCPPaymentDriver.php index c5f3da4234..328ab699d3 100644 --- a/app/PaymentDrivers/PayPalPPCPPaymentDriver.php +++ b/app/PaymentDrivers/PayPalPPCPPaymentDriver.php @@ -195,12 +195,21 @@ class PayPalPPCPPaymentDriver extends BaseDriver private function checkPaymentsReceivable(): self { - - if($this->company_gateway->getConfigField('email_verified') != 'true' || - $this->company_gateway->getConfigField('payments_receivable') != 'Yes' || - $this->company_gateway->getConfigField('consent') != 'true' || - $this->company_gateway->getConfigField('permissions') != 'true' - ){ + + if($this->company_gateway->getConfigField('status') != 'active'){ + + if (class_exists(\Modules\Admin\Services\PayPal\PayPalService::class)) { + $pp = new \Modules\Admin\Services\PayPal\PayPalService($this->company_gateway->company, $this->company_gateway->user); + $pp->updateMerchantStatus($this->company_gateway); + + $this->company_gateway = $this->company_gateway->fresh(); + $config = $this->company_gateway->getConfig(); + + if($config->status == 'active') + return $this; + + } + throw new PaymentFailed('Unable to accept payments at this time, please contact PayPal for more information.', 401); }