Merge pull request #10951 from turbo124/v5-develop

Return early if webhook payload is not appropriate
This commit is contained in:
David Bomba 2025-05-04 13:17:38 +10:00 committed by GitHub
commit dce8d798b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 13 deletions

View File

@ -224,29 +224,28 @@ class Nordigen
* isAccountActive
*
* @param string $account_id
* @return bool
* @return array
*/
public function isAccountActive(string $account_id): bool
public function isAccountActive(string $account_id): array
{
try {
$account = $this->client->account($account_id)->getAccountMetaData();
if ($account['status'] != 'READY') {
nlog("Nordigen account '{$account_id}' is not ready (status={$account['status']})");
return false;
}
return true;
return $account;
} catch (\Exception $e) {
nlog("Nordigen:: AccountActiveStatus:: {$e->getMessage()} {$e->getCode()}");
if (strpos($e->getMessage(), 'Invalid Account ID') !== false) {
return false;
['status' => 'Invalid Account ID'];
}
throw $e;
return ['status' => 'EXPIRED'];
}
}

View File

@ -291,7 +291,7 @@ class BankIntegrationController extends BaseController
$nordigen->disabledAccountEmail($bank_integration);
return;
} elseif (!$is_account_active || !$account || isset($account['requisition'])) {
} elseif ($is_account_active['status'] != 'READY' || !$account || isset($account['requisition'])) {
$bank_integration->disabled_upstream = true;
$bank_integration->save();

View File

@ -21,7 +21,7 @@ class OAuthConnectRequest extends FormRequest
{
public function authorize(): bool
{
return true;
return Cache::has($this->token);
}
/**

View File

@ -32,7 +32,7 @@ class YodleeAuthRequest extends Request
*/
public function authorize()
{
return true;
return Cache::has($this->state ?? $this->token);
}
/**

View File

@ -315,9 +315,8 @@ class PayPalWebhook implements ShouldQueue
{
// nlog($this->headers);
if(!isset($this->headers['paypal-auth-algo'][0])){
nlog(array_merge(["no paypal-auth-algo"], $this->webhook_request));
}
if(!isset($this->headers['paypal-auth-algo'][0]))
return false;
$request = [
'auth_algo' => $this->headers['paypal-auth-algo'][0],