Skip to content

Commit

Permalink
feat: pseventbus v4 carriers (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
fox-john authored Sep 9, 2024
1 parent 5026005 commit 2b47db3
Show file tree
Hide file tree
Showing 16 changed files with 389 additions and 485 deletions.
137 changes: 0 additions & 137 deletions OLD/Provider/CarrierDataProvider.php

This file was deleted.

2 changes: 1 addition & 1 deletion config/common/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ services:
class: PrestaShop\Module\PsEventbus\Builder\CarrierBuilder
public: true
arguments:
- '@PrestaShop\Module\PsEventbus\Repository\CarrierRepository'
- '@PrestaShop\Module\PsEventbus\Repository\CountryRepository'
- '@PrestaShop\Module\PsEventbus\Repository\StateRepository'
- '@PrestaShop\Module\PsEventbus\Repository\TaxRepository'
- '@PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository'
- '@PrestaShop\Module\PsEventbus\Repository\LanguageRepository'
4 changes: 4 additions & 0 deletions config/common/new-repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ services:
PrestaShop\Module\PsEventbus\Repository\NewRepository\OrderDetailRepository:
class: PrestaShop\Module\PsEventbus\Repository\NewRepository\OrderDetailRepository
public: true

PrestaShop\Module\PsEventbus\Repository\NewRepository\CarrierRepository:
class: PrestaShop\Module\PsEventbus\Repository\NewRepository\CarrierRepository
public: true
6 changes: 0 additions & 6 deletions config/common/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,6 @@ services:
arguments:
- '@=service("prestashop.adapter.legacy.context").getContext()'

PrestaShop\Module\PsEventbus\Repository\CarrierRepository:
class: PrestaShop\Module\PsEventbus\Repository\CarrierRepository
public: true
arguments:
- '@=service("prestashop.adapter.legacy.context").getContext()'

PrestaShop\Module\PsEventbus\Repository\CustomPriceRepository:
class: PrestaShop\Module\PsEventbus\Repository\CustomPriceRepository
public: true
Expand Down
8 changes: 8 additions & 0 deletions config/front/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,11 @@ services:
public: true
arguments:
- '@PrestaShop\Module\PsEventbus\Repository\NewRepository\OrderDetailRepository'

PrestaShop\Module\PsEventbus\Service\ShopContent\CarriersService:
class: PrestaShop\Module\PsEventbus\Service\ShopContent\CarriersService
public: true
arguments:
- '@PrestaShop\Module\PsEventbus\Repository\NewRepository\CarrierRepository'
- '@PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository'
- '@PrestaShop\Module\PsEventbus\Builder\CarrierBuilder'
5 changes: 3 additions & 2 deletions e2e/src/full-sync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const specialFieldAssert: { [index: string]: (val) => void } = {
}

describe('Full Sync', () => {
let testIndex = 0;
let testTimestamp = 0;

// gérer les cas ou un shopContent n'existe pas (pas de fixture du coup)
const shopContents: ShopContent[] = shopContentList.filter(
Expand All @@ -60,7 +60,8 @@ describe('Full Sync', () => {
let jobId: string;

beforeEach(() => {
jobId = `valid-job-full-${testIndex++}`;
testTimestamp = Date.now();
jobId = `valid-job-full-${testTimestamp}`;
});

// TODO : some versions of prestashop include ps_facebook out of the box, this test can't reliably be run for all versions
Expand Down
6 changes: 3 additions & 3 deletions e2e/src/helpers/shop-contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import R from "ramda";
// TEMPORARY DISABLED, WAIT ADD ALL SHOP CONTENT
// AFTER UNCOMMENT THIS, CHANGE ALL "as ShopContent"CAST IN FULLSYNC TEST
/* export const shopContentMapping = {
'carriers': 'carriers',
'carrier_details': 'carrier-details',
'carts' : 'carts',
'cart_products': 'carts',
Expand Down Expand Up @@ -35,10 +34,11 @@ import R from "ramda";
} as const; */

export const shopContentMapping = {
'carriers': 'carriers',
'orders': 'orders',
'order_histories': 'order-histories',
'order_cart_rules': 'order-cart-rules',
'order_details': 'order-details'
'order_details': 'order-details',
'order_histories': 'order-histories'
} as const;

type ShopContentMapping = typeof shopContentMapping;
Expand Down
5 changes: 3 additions & 2 deletions e2e/src/reject-invalid-job-id.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import {probe} from "./helpers/mock-probe";
import { ShopContent, shopContentList } from "./helpers/shop-contents";

describe('Reject invalid job-id', () => {
let testIndex = 0;
let testTimestamp = 0;

const shopContents: ShopContent[] = shopContentList

let jobId: string;

beforeEach(() => {
jobId = `invalid-job-id-${testIndex++}`
testTimestamp = Date.now();
jobId = `invalid-job-id-${testTimestamp}`
});

it.each(shopContents)(`%s should return 454 with an invalid job id (sync-api status 454)`, async (shopContent) => {
Expand Down
Loading

0 comments on commit 2b47db3

Please sign in to comment.