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: pseventbus v4 #341

Open
wants to merge 150 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
0843e8e
refactor: rework hooks with traits
fox-john Jul 26, 2024
0f258bb
refactor: synchronization service and connected services
fox-john Jul 26, 2024
30bed65
feature: add upgrade script
fox-john Jul 29, 2024
df955c4
fix: update service.yml
fox-john Jul 29, 2024
431f372
feat: add front service
fox-john Jul 29, 2024
bcc66e6
refactor: remove all old front controllers
fox-john Jul 29, 2024
56a8fbe
feat: rework orders for testing
fox-john Jul 29, 2024
5a2b675
fix: all hooks
fox-john Jul 29, 2024
342ac89
fix: common problems
fox-john Jul 29, 2024
3af9abf
fix: common problems
fox-john Jul 31, 2024
52565b1
fix: debug mode
fox-john Jul 31, 2024
094c264
fix: update services and error handler
fox-john Aug 1, 2024
9468ad9
fix: service
fox-john Aug 1, 2024
434a520
feat: add healthcheck mecanic
fox-john Aug 1, 2024
9f1aef1
chore: set healhcheck to shopcontent
fox-john Aug 1, 2024
cafb6f5
fix: problem with service declaration
fox-john Aug 1, 2024
df11e8d
fix: config
fox-john Aug 2, 2024
addcc45
e2e: change all endpoint and rename controller into shoContent
fox-john Aug 2, 2024
99d8fc0
fix: healtcheck
fox-john Aug 6, 2024
7a08f68
fix: phpcs-fixer
fox-john Aug 6, 2024
98b9c00
fix: phpcs-fixer and phpstan
fox-john Aug 7, 2024
36a8d76
fix: compat 5.6
fox-john Aug 8, 2024
1f657d6
fix: compat ps 1.6.1.11
fox-john Aug 8, 2024
7da1ef8
fix: php-cs-fixer
fox-john Aug 8, 2024
1c4bca0
fix: e2e env
fox-john Aug 8, 2024
9665258
fix: rename json dump
fox-john Aug 8, 2024
10e1367
fix: bug e2e
fox-john Aug 8, 2024
668ccf4
Merge branch 'main' into feature/pseventbus-v4-base
jokesterfr Aug 22, 2024
b962dde
fix: common problems
fox-john Aug 26, 2024
3934d01
Merge branch 'feature/pseventbus-v4-base' of https://github.com/Prest…
fox-john Aug 26, 2024
5d0580a
refactor: rework hooks with traits
fox-john Jul 26, 2024
4095f73
refactor: synchronization service and connected services
fox-john Jul 26, 2024
9cf2a68
feature: add upgrade script
fox-john Jul 29, 2024
009fa4d
fix: update service.yml
fox-john Jul 29, 2024
b2da088
feat: add front service
fox-john Jul 29, 2024
72d3cd0
refactor: remove all old front controllers
fox-john Jul 29, 2024
934fd04
feat: rework orders for testing
fox-john Jul 29, 2024
48c41ec
fix: all hooks
fox-john Jul 29, 2024
8c837c8
fix: common problems
fox-john Jul 29, 2024
79102f7
fix: common problems
fox-john Jul 31, 2024
b4d496e
fix: debug mode
fox-john Jul 31, 2024
6d1f3c0
fix: update services and error handler
fox-john Aug 1, 2024
ca572c8
fix: service
fox-john Aug 1, 2024
2bbdc94
feat: add healthcheck mecanic
fox-john Aug 1, 2024
511c54f
chore: set healhcheck to shopcontent
fox-john Aug 1, 2024
25c1e5f
fix: problem with service declaration
fox-john Aug 1, 2024
a5addbd
fix: config
fox-john Aug 2, 2024
3a77e40
e2e: change all endpoint and rename controller into shoContent
fox-john Aug 2, 2024
d96a90e
fix: healtcheck
fox-john Aug 6, 2024
51177f1
fix: phpcs-fixer
fox-john Aug 6, 2024
f5c182a
fix: phpcs-fixer and phpstan
fox-john Aug 7, 2024
8315918
fix: compat 5.6
fox-john Aug 8, 2024
41e5a2a
fix: compat ps 1.6.1.11
fox-john Aug 8, 2024
532327f
fix: php-cs-fixer
fox-john Aug 8, 2024
5ec0b28
fix: e2e env
fox-john Aug 8, 2024
44066b0
fix: rename json dump
fox-john Aug 8, 2024
2459168
fix: bug e2e
fox-john Aug 8, 2024
25aeca4
fix: common problems
fox-john Aug 26, 2024
d02301b
Merge branch 'feature/pseventbus-v4-base' of https://github.com/Prest…
fox-john Aug 27, 2024
5117b4b
fix: phpcs-fixer and phpstan
fox-john Aug 27, 2024
01fed97
fix: autoload
fox-john Aug 27, 2024
5366fcd
fix: rename ordersRepository to orderRepository
fox-john Aug 27, 2024
cd74111
chore: move old file for clearly visualisation of code
fox-john Aug 29, 2024
973b503
chore: change method for clearly view of code
fox-john Aug 29, 2024
e40f05e
feat: pseventbus v4 order cart rules (#347)
fox-john Aug 29, 2024
6355441
feat: pseventbus v4 order statuse histories (#349)
fox-john Aug 30, 2024
5026005
feat: pseventbus v4 order details (#350)
fox-john Sep 4, 2024
2b47db3
feat: pseventbus v4 carriers (#353)
fox-john Sep 9, 2024
e99ffb6
feat: pseventbus v4 carrier details and taxes (#354)
fox-john Sep 11, 2024
226d177
feat: pseventbus v4 carts (#355)
fox-john Sep 11, 2024
bf42d62
feat: pseventbus v4 cart products (#356)
fox-john Sep 12, 2024
51383db
fix: bug
fox-john Sep 12, 2024
a11a6ee
feat: pseventbus v4 cart rules (#358)
fox-john Sep 13, 2024
6d4ee3b
feat: pseventbus v4 products (#361)
fox-john Sep 17, 2024
54ea7aa
feat: pseventbus v4 product bundles (#363)
fox-john Sep 17, 2024
b37f373
fix: lint js
fox-john Sep 17, 2024
b330408
fix: lint js
fox-john Sep 17, 2024
d8e6928
fix: test latest
fox-john Sep 17, 2024
0073668
fix: disable type-cast for 1.7
fox-john Sep 18, 2024
ec50e4d
feat: add product suppliers (#364)
fox-john Sep 18, 2024
7a72c72
feat: pseventbus v4 product carriers (#365)
fox-john Sep 18, 2024
62c8e76
Merge branch 'main' into feature/pseventbus-v4-base
fox-john Sep 18, 2024
b00e719
feat: pseventbus v4 categories (#366)
fox-john Sep 20, 2024
ea3c827
feat: pseventbus v4 customers (#367)
fox-john Sep 20, 2024
4ac48de
feat: pseventbus v4 currencies (#368)
fox-john Sep 20, 2024
6884b2d
Feat: pseventbus v4 employees (#369)
fox-john Sep 20, 2024
7f9ea0b
feat: pseventbus v4 images and images types (#370)
fox-john Sep 20, 2024
e6f1259
feat: pseventbus v4 infos (#371)
fox-john Sep 24, 2024
780a980
feat: add modules
fox-john Sep 24, 2024
76111af
fix: shop_informations name
fox-john Sep 24, 2024
0495b5a
feat: fpseventbus v4 themes (#372)
fox-john Sep 26, 2024
749df28
feat: pseventbus v4 wishlists and wishlist products (#373)
fox-john Sep 26, 2024
cc021d8
feat: add languages (#374)
fox-john Sep 26, 2024
3603539
fix: add header stamps
fox-john Sep 26, 2024
c88470f
fix: add check for define version
fox-john Sep 26, 2024
113237a
fix: problem with header stamp
fox-john Sep 26, 2024
940538e
fix: last problems
fox-john Sep 26, 2024
7d285a1
feat: add manufacturers (#375)
fox-john Sep 27, 2024
d2f63f5
feat: pseventbus v4 translations (#376)
fox-john Sep 30, 2024
b5cf102
feat: add stock and stock mvmts (#377)
fox-john Sep 30, 2024
92db6fc
feat: pseventbus v4 specific prices (#378)
fox-john Sep 30, 2024
803dd32
feat: add taxonomies (#379)
fox-john Oct 1, 2024
a91dd2b
feat: add suppliers (#380)
fox-john Oct 1, 2024
42181ac
feat: last edits for v4 (#381)
fox-john Oct 2, 2024
06207f2
Merge branch 'main' into feature/pseventbus-v4-base
fox-john Oct 2, 2024
56dd4db
fix: error with merge
fox-john Oct 2, 2024
ff365e4
fix: phpcs-fixer and phpstan
fox-john Oct 2, 2024
8b689c6
fix: error
fox-john Oct 2, 2024
067931e
fix: useless code
fox-john Oct 2, 2024
03bc961
fix: last problems
fox-john Oct 3, 2024
ea344c7
fix: some errors
fox-john Oct 3, 2024
72619a1
fix: useless code in error handler
fox-john Oct 3, 2024
50e2832
fix: problem after merge main
fox-john Oct 3, 2024
1aaae1a
fix: phpcs-fixer and phpstan
fox-john Oct 3, 2024
f37c775
fix: e2e
fox-john Oct 3, 2024
6d48ad8
chore: add fixme
fox-john Oct 4, 2024
8e5a770
fix: debug mode and anothers query params
fox-john Oct 4, 2024
98f1c4a
chore: ordering services and repository and rename product carrier sh…
fox-john Oct 7, 2024
481a1aa
fix: last rename
fox-john Oct 7, 2024
5b9e8c3
fix: error handler
fox-john Oct 7, 2024
c76d3b4
chore: update some var to global constant
fox-john Oct 7, 2024
a71e60c
fix: phpstan
fox-john Oct 7, 2024
7f1ba67
fix: php-cs-fixer
fox-john Oct 7, 2024
2f4f6c9
fix: error php
fox-john Oct 7, 2024
77d1e5c
fix: after review
fox-john Oct 9, 2024
130b441
docs: update readme
fox-john Oct 9, 2024
f18b0b3
fix: update header-stamps
fox-john Oct 10, 2024
0ac7cfa
fix: cut api
fox-john Oct 10, 2024
021f95d
fix: cut api
fox-john Oct 10, 2024
750e4f8
fix: php-cs-fixer
fox-john Oct 10, 2024
3c77ab5
fix: some problems after rework
fox-john Oct 10, 2024
47bf9a6
fix: bug
fox-john Oct 10, 2024
891bad5
fix: php-cs-fixer
fox-john Oct 10, 2024
026b1e1
fix: readme
fox-john Oct 10, 2024
a7a9fc1
refactor: set mytuns to docker
fox-john Oct 11, 2024
b5677ea
fix: service not found in 1.6
fox-john Oct 11, 2024
5e47b57
fix: repair compat 1.6 with accounts
fox-john Oct 11, 2024
43f7317
fix: readme after review
fox-john Oct 11, 2024
7bf799f
fix: php-stan and php-cs-fixer
fox-john Oct 11, 2024
151606a
fix: e2e test in 1.6
fox-john Oct 11, 2024
34ff384
fix: e2e test
fox-john Oct 16, 2024
832cbb2
fix: e2e lint
fox-john Oct 16, 2024
f97a802
chore: add comment
fox-john Oct 16, 2024
6569b42
chore: update dockerfile and ci with profiles
fox-john Oct 16, 2024
a6d4d89
fix: carrier details tests
fox-john Oct 16, 2024
cfc26f4
fix: e2e timeout
fox-john Oct 16, 2024
ef2e557
fix: docker e2e
fox-john Oct 17, 2024
92d096c
fix: init-scripts executable
fox-john Oct 17, 2024
dbcdbab
fix: V4 | revert order histories and bundles naming (#384)
fox-john Oct 22, 2024
47e9406
fix: deleted object v4 (#387)
fox-john Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
| 1.7.3-1.7.8 | 7.1+ | From 2.x |
| 1.6.1.11 - 1.7.2.5 | 7.1 | From 3.1 |

## BREAKING CHANGES

### Front controllers and API endpoints
Depuis la version 4.0, tout les endpoints API sont regroupé sous un seul controller "apiFront.php". La route a appeller est donc maintenant unique, et le shopContent n'est plus un endpoint en particulier, mais un paramètre query de la requête (ex: "http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller=apiFront&shop_content=healtcheck")

PS Accounts compatibility matrix [can be viewed here](https://github.com/PrestaShopCorp/ps_accounts#compatibility-matrix).

### Product Images Issue in PHP 8.1
Expand Down Expand Up @@ -51,7 +56,7 @@ To check the module healthiness (authenticated route):

```sh
BASE_URL="http://localhost:8000"
curl -s -L "$BASE_URL/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=1&shop_content=healthcheck&job_id=valid-job-stuff" | jq .
curl -s -L "$BASE_URL/index.php?fc=module&module=ps_eventbus&controller=apiFront&shop_content=healthcheck&job_id=valid-job-stuff" | jq .
fox-john marked this conversation as resolved.
Show resolved Hide resolved
{
"prestashop_version": "1.6.1.24",
"ps_eventbus_version": "0.0.0",
Expand All @@ -72,7 +77,7 @@ To check the fallback route (unauthenticated):

```sh
BASE_URL="http://localhost:8000"
curl -s -L "$BASE_URL/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=1&shop_content=healthcheck" | jq .
curl -s -L "$BASE_URL/index.php?fc=module&module=ps_eventbus&controller=apiFront=1&shop_content=healthcheck" | jq .
{
"ps_account": true,
"is_valid_jwt": true,
Expand Down Expand Up @@ -119,3 +124,28 @@ Or an up-to-date [Docker engine](https://docs.docker.com/engine/install).

¹ Feature enabled only with PsWishlist module</br>
² Feature enabled only with PsFacebook module

## How to add new shop content
Prenons pour exemple l'ajout d'un shopContent nommé "plane".

- Ajoutez le shop content dans le fichier [Config.php](src/Config/Config.php) (créez une constante, et ajoutez là au tableau SHOP_CONTENTS).
```PHP
const COLLECTION_PLANES = 'planes';

const SHOP_CONTENTS = [
...
self::COLLECTION_PLANES
...
];
```
- Créez un service "monShopContentsService.php" dans le [dossier des service shop content](src/Service/ShopContent/) qui implémente l'interface [ShopContentServiceInterface.php](src/Service/ShopContent/ShopContentServiceInterface.php). Pour la structure des méthodes, reprenez la base existante sur tout les autres service de shop content pour garder une cohérence.
fox-john marked this conversation as resolved.
Show resolved Hide resolved
- Créez un repository pour votre shop content (ex: monShopContentRepository.php) dans le dossier [Repository](src/Repository/) qui etends la classe [AbstractRepository.php](src/Repository/AbstractRepository.php) et implemente l'interface [RepositoryInterface.php](src/Repository/RepositoryInterface.php). De la même manière, gardez une cohérence avec les autres repository de shop content.
- Ajoutez dans le fichier de [config e2e](e2e/src/helpers/shop-contents.ts) votre shop content, puis lancez les tests une fois pour générer les dumps nécessaire (seront présent dans le dossier [dump](e2e/dumps/)). Une fois le test réalisé (et échoué), copier le fichier json correspondant à votre shop content, et collez le dans le dossier fixture, pour votre version donné. Faites la même chose pour chaque version (si les versions retournent des résultats différent).

## Debugging
There are 3 variables that are passed "magically" from the apiFront file to the end of the chain (repositories and errorHandler):
- PS_EVENTBUS_EXPLAIN_SQL_ENABLED
- PS_EVENTBUS_VERBOSE_ENABLED
- PS_EVENTBUS_LOGS_ENABLED

These variables are defined via the PHP function define() and reused in the files mentioned above. The reason for this usage is to avoid having to pass these variables through the entire execution chain to retrieve them at the end of the chain (e.g., apiFront => frontService => shopContentService => shopContentRepository).
4 changes: 2 additions & 2 deletions e2e-env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ Simple!
Is the module healthy?

```sh
curl -s "http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller=apiHealthCheck&job_id=valid-job-1" | jq .
curl -s "http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller=apiFront&shop_content=healthcheck&job_id=valid-job-1" | jq .
```

Capture orders:

```sh
curl -s "http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller=apiOrders&job_id=valid-job-1" | jq .
curl -s "http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller=apiFront&shop_content=orders&job_id=valid-job-1" | jq .
```

## Make changes to the mock
Expand Down
2 changes: 1 addition & 1 deletion e2e-env/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
"-sI",
"-H",
"Host: localhost:8000",
"http://localhost:80/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=1&shop_content=healthcheck",
"http://localhost:80/index.php?fc=module&module=ps_eventbus&controller=apiFront=1&shop_content=healthcheck",
]
interval: 30s
volumes:
Expand Down
4 changes: 2 additions & 2 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import testConfig from './helpers/test.config';
import request from 'supertest';

const controller = 'categories';
const endpoint = `/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=1&shop_content=${shopContent}&limit=5`;
const endpoint = `/index.php?fc=module&module=ps_eventbus&controller=apiFront=1&shop_content=${shopContent}&limit=5`;

describe('CategoriesShopContent', () => {
it(`${shopContent} should upload to collector`, async () => {
// arrange
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=1&shop_content=${shopContent}&limit=5&full=1&job_id=${jobId}`;
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront=1&shop_content=${shopContent}&limit=5&full=1&job_id=${jobId}`;
fox-john marked this conversation as resolved.
Show resolved Hide resolved
// jobId starting with "valid-job-" will be considered valid by the mock sync-api and will always return 201;
// other values will be rejected by the mock
const jobId = 'valid-job-1'
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/full-sync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe("Full Sync", () => {
describe.each(shopContentList)("%s", (shopContent) => {
it(`${shopContent} should accept full sync`, async () => {
// arrange
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=0&shop_content=${shopContent}&limit=5&full=1&job_id=${jobId}`;
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront=0&shop_content=${shopContent}&limit=5&full=1&job_id=${jobId}`;

const callId = { call_id: Math.random().toString(36).substring(2, 11) };

Expand Down
2 changes: 1 addition & 1 deletion e2e/src/helpers/data-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export async function getShopHealthCheck(options?: {
healthCheck = cachedHealthCheck;
} else {
const res = await axios.get<HealthCheck>(
`${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=0&shop_content=healthcheck&job_id=valid-job-healthcheck`,
`${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront=0&shop_content=healthcheck&job_id=valid-job-healthcheck`,
);
healthCheck = res.data;
cachedHealthCheck = healthCheck;
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/helpers/mock-probe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function doFullSync(

const requestNext = (full: number) => {
return axios.post<PsEventbusSyncResponse>(
`${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=0&shop_content=${shopContent}&limit=5&full=${full}&job_id=${jobId}`,
`${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront=0&shop_content=${shopContent}&limit=5&full=${full}&job_id=${jobId}`,
callId,
{
headers: {
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/job-id-validation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("Reject invalid job-id", () => {
async (shopContent) => {
expect.assertions(6);
// arrange
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=0&shop_content=${shopContent}&limit=5&job_id=${jobId}`;
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront=0&shop_content=${shopContent}&limit=5&job_id=${jobId}`;
const message$ = probe({ params: { id: jobId } });

//act
Expand Down
4 changes: 2 additions & 2 deletions src/Api/LiveSyncApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public function liveSync($shopContent, $action)
'Authorization' => 'Bearer ' . $this->jwt,
'User-Agent' => 'ps-eventbus/' . $this->module->version,
'Content-Type' => 'application/json',
], // FIXME: Pass real array of shop contents. at the moment, only one shop content is sent for match CS rate limiter
'{"shopContents": ["' . $kebabCasedShopContent . '"], "shopContentId": ' . $uselessParameter . ', "action": "' . $action . '"}'
], // FIXME: Pass real array of shop contents. at the moment, only one shop content is sent to match CS rate limiter
'{"shopContents": ["' . $kebabCasedShopContent . '"], "action": "' . $action . '"}'
)
);

Expand Down
2 changes: 1 addition & 1 deletion src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Config
const MYSQL_DATE_FORMAT = 'Y-m-d H:i:s';

const RANDOM_SYNC_CHECK_MAX = 20;
fox-john marked this conversation as resolved.
Show resolved Hide resolved
const INCREMENTAL_SYNC_MAX_ITEMS_PER_SHOP_CONTENT = 100000;
const INCREMENTAL_SYNC_MAX_PAGE_SIZE = 10000;

const SYNC_API_MAX_TIMEOUT = 5;
const COLLECTOR_MAX_TIMEOUT = 30;
Expand Down
21 changes: 13 additions & 8 deletions src/Service/CommonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,19 @@ public static function exitWithExceptionMessage(\Exception $exception)
{
$code = $exception->getCode() == 0 ? 500 : $exception->getCode();

if ($exception instanceof \PrestaShopDatabaseException) {
$code = Config::DATABASE_QUERY_ERROR_CODE;
} elseif ($exception instanceof EnvVarException) {
$code = Config::ENV_MISCONFIGURED_ERROR_CODE;
} elseif ($exception instanceof FirebaseException) {
$code = Config::REFRESH_TOKEN_ERROR_CODE;
} elseif ($exception instanceof QueryParamsException) {
$code = Config::INVALID_URL_QUERY;
switch ($exception) {
case $exception instanceof \PrestaShopDatabaseException:
$code = Config::DATABASE_QUERY_ERROR_CODE;
break;
case $exception instanceof EnvVarException:
$code = Config::ENV_MISCONFIGURED_ERROR_CODE;
break;
case $exception instanceof FirebaseException:
$code = Config::REFRESH_TOKEN_ERROR_CODE;
break;
case $exception instanceof QueryParamsException:
$code = Config::INVALID_URL_QUERY;
break;
}

$response = [
Expand Down
12 changes: 6 additions & 6 deletions src/Service/FrontApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ private function authorize($jobId, $isHealthCheck)
return false;
}

if ($exception instanceof \PrestaShopDatabaseException) {
$this->errorHandler->handle($exception);
} elseif ($exception instanceof EnvVarException) {
$this->errorHandler->handle($exception);
} elseif ($exception instanceof FirebaseException) {
$this->errorHandler->handle($exception);
switch ($exception) {
case $exception instanceof \PrestaShopDatabaseException:
case $exception instanceof EnvVarException:
case $exception instanceof FirebaseException:
$this->errorHandler->handle($exception);
break;
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Service/SynchronizationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public function insertContentIntoIncremental($contentTypesWithIds, $actionType,
foreach ($contentTypesWithIds as $contentType => $contentIds) {
$count = $this->incrementalSyncRepository->getIncrementalSyncObjectCountByType($contentType);

if ($count > Config::INCREMENTAL_SYNC_MAX_ITEMS_PER_SHOP_CONTENT) {
if ($count > Config::INCREMENTAL_SYNC_MAX_PAGE_SIZE) {
$hasDeleted = $this->incrementalSyncRepository->removeIncrementaSyncObjectByType($contentType);

if ($hasDeleted) {
Expand Down
Loading