Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove guzzle dependency #468

Draft
wants to merge 50 commits into
base: main
Choose a base branch
from

Conversation

hschoenenberger
Copy link
Contributor

@hschoenenberger hschoenenberger commented Jan 14, 2025

To go a step further reducing friction with the PrestaShop module's ecosystem, reducing module weight.

As a module we just need to do a few things, not to embed huge libraries so let's get straight to the point and isolate a much a possible from other modules to avoid collisions, also stay lighter.

Still a POC, but fully functional.

  • do we need PSR compat ?
  • remove guzzle
  • remove theleagueoauth via prestashop-oauth2

Benefits:

  • reduce the zip size
  • eventually avoid future deprecation issues with Guzzle
  • note: module cannibalism was already fixed with php-scoping, however this simplifies the whole module packaging.

// [rat] => 1736251522
// [sub] => 4rFN5bm2piPeYpsotUIwcyabcdeF
// ) [] []
class UserInfos
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without s if possible

@@ -56,7 +56,8 @@ public function execute(array $params = [])
$rsaKeysProvider = $this->module->getService(RsaKeysProvider::class);
try {
$rsaKeysProvider->cleanupKeys();
$rsaKeysProvider->generateKeys();
// FIXME: We MUST generate a new key here to avoid concurrent key re-generation at Presenter display time
//$rsaKeysProvider->generateKeys();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be fixed in this PR?

} catch (IdentityProviderException $e) {
$this->logger->error('error while executing middleware : ' . $e->getMessage());
// } catch (IdentityProviderException $e) {
// $this->logger->error('error while executing middleware : ' . $e->getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented code

@@ -87,7 +87,8 @@ public function formatShopData(array $shopData, $psxName = '', $refreshTokens =

// LinkAccount
'uuid' => $linkShop->getShopUuid() ?: null,
'publicKey' => $rsaKeyProvider->getOrGenerateAccountsRsaPublicKey() ?: null,
//'publicKey' => $rsaKeyProvider->getOrGenerateAccountsRsaPublicKey() ?: null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code

@@ -66,7 +66,7 @@ public function itShouldSucceed()
$this->assertResponseDeleted($response);

// FIXME: empty response
// $this->assertArraySubset(['success' => true], $json);
//$this->assertArraySubset(['success' => true], $json);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be removed then?

'objectResponse' => true,
'allowRedirects' => true,

// 'base_uri' => $baseUrl,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code

@@ -173,10 +181,13 @@ public function assertResponseError($response)
*/
public function getResponseJson($response)
{
$ary = json_decode($response->getBody()->getContents(), true);
$response->getBody()->rewind();
// FIXME
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants