From 413919ad2a2cca169c18c0e0632541a348b2751d Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Sat, 23 Mar 2024 14:51:00 +0100 Subject: [PATCH 1/2] fix: actually allow saturday and sunday cutoff times per carrier --- src/config/defaultConfiguration.js | 2 ++ src/data/carrierFeatures.js | 9 +++++++++ src/data/carriers/postNlCarrierConfiguration.js | 2 ++ src/data/keys/configKeys.js | 4 ++-- src/data/locales/nl/config.js | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/config/defaultConfiguration.js b/src/config/defaultConfiguration.js index 29542c15..c68af8c4 100644 --- a/src/config/defaultConfiguration.js +++ b/src/config/defaultConfiguration.js @@ -53,6 +53,8 @@ export const defaultConfiguration = (platform = DEFAULT_PLATFORM) => { [CONFIG.DELIVERY_DAYS_WINDOW]: DEFAULT_DELIVERY_DAYS_WINDOW, [CONFIG.DROP_OFF_DAYS]: [1, 2, 3, 4, 5], [CONFIG.DROP_OFF_DELAY]: 0, + [CONFIG.SATURDAY_CUTOFF_TIME]: '16:00', + [CONFIG.SUNDAY_CUTOFF_TIME]: '15:30', [CONFIG.PRICE_PACKAGE_TYPE_DIGITAL_STAMP]: DEFAULT_PRICE, [CONFIG.PRICE_PACKAGE_TYPE_MAILBOX]: DEFAULT_PRICE, diff --git a/src/data/carrierFeatures.js b/src/data/carrierFeatures.js index e68d2549..781b696c 100644 --- a/src/data/carrierFeatures.js +++ b/src/data/carrierFeatures.js @@ -28,6 +28,7 @@ export const FEATURES_EVENING_DELIVERY = [ export const FEATURES_MONDAY_DELIVERY = [ CONFIG.ALLOW_MONDAY_DELIVERY, CONFIG.SATURDAY_CUTOFF_TIME, + CONFIG.SUNDAY_CUTOFF_TIME, ]; /** @@ -152,6 +153,14 @@ export const FEATURES_CUTOFF_TIME = [ CONFIG.CUTOFF_TIME, ]; +export const FEATURES_SATURDAY_CUTOFF_TIME = [ + CONFIG.SATURDAY_CUTOFF_TIME, +]; + +export const FEATURES_SUNDAY_CUTOFF_TIME = [ + CONFIG.SUNDAY_CUTOFF_TIME, +]; + /** * Permission to have same day delivery. * diff --git a/src/data/carriers/postNlCarrierConfiguration.js b/src/data/carriers/postNlCarrierConfiguration.js index ea01a96e..403eb82c 100644 --- a/src/data/carriers/postNlCarrierConfiguration.js +++ b/src/data/carriers/postNlCarrierConfiguration.js @@ -47,6 +47,8 @@ export class PostNlCarrierConfiguration extends AbstractCarrierConfiguration { FEATURES.FEATURES_DROP_OFF_DAYS, FEATURES.FEATURES_DROP_OFF_DELAY, FEATURES.FEATURES_CUTOFF_TIME, + FEATURES.FEATURES_SUNDAY_CUTOFF_TIME, + FEATURES.FEATURES_SATURDAY_CUTOFF_TIME, ], [SENDMYPARCEL]: [ FEATURES.FEATURES_DELIVERY, diff --git a/src/data/keys/configKeys.js b/src/data/keys/configKeys.js index a3c8ca8d..1c9cdbca 100644 --- a/src/data/keys/configKeys.js +++ b/src/data/keys/configKeys.js @@ -109,8 +109,6 @@ export const settingsWithCarrierOverride = [ ALLOW_SIGNATURE, CUTOFF_TIME, CUTOFF_TIME_SAME_DAY, - SUNDAY_CUTOFF_TIME, - SATURDAY_CUTOFF_TIME, DELIVERY_DAYS_WINDOW, DROP_OFF_DAYS, DROP_OFF_DELAY, @@ -125,6 +123,8 @@ export const settingsWithCarrierOverride = [ PRICE_SAME_DAY_DELIVERY, PRICE_SIGNATURE, PRICE_STANDARD_DELIVERY, + SATURDAY_CUTOFF_TIME, + SUNDAY_CUTOFF_TIME, ]; /** diff --git a/src/data/locales/nl/config.js b/src/data/locales/nl/config.js index 2e2f163a..a8007a68 100644 --- a/src/data/locales/nl/config.js +++ b/src/data/locales/nl/config.js @@ -6,4 +6,5 @@ export const config = { [CONFIG.LOCALE]: DEFAULT_LOCALE, [CONFIG.ALLOW_MONDAY_DELIVERY]: true, [CONFIG.SATURDAY_CUTOFF_TIME]: '16:00', + [CONFIG.SUNDAY_CUTOFF_TIME]: '15:30', }; From 41d83939f19e99e698b7d77e4242aa8fa989a710 Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Mon, 18 Mar 2024 15:15:18 +0100 Subject: [PATCH 2/2] test: update snapshot --- .../carrierConfigurationFactory.spec.js.snap | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/unit/delivery-options/__snapshots__/carrierConfigurationFactory.spec.js.snap b/tests/unit/delivery-options/__snapshots__/carrierConfigurationFactory.spec.js.snap index e0dcb69e..abfd48de 100644 --- a/tests/unit/delivery-options/__snapshots__/carrierConfigurationFactory.spec.js.snap +++ b/tests/unit/delivery-options/__snapshots__/carrierConfigurationFactory.spec.js.snap @@ -536,6 +536,7 @@ Object { Array [ "allowMondayDelivery", "saturdayCutoffTime", + "sundayCutoffTime", ], Array [ "allowPickupLocations", @@ -560,6 +561,12 @@ Object { Array [ "cutoffTime", ], + Array [ + "sundayCutoffTime", + ], + Array [ + "saturdayCutoffTime", + ], ], }, "getDefaultRequestParameters": Array [ @@ -598,6 +605,7 @@ Object { Array [ "allowMondayDelivery", "saturdayCutoffTime", + "sundayCutoffTime", ], Array [ "allowPickupLocations", @@ -622,6 +630,12 @@ Object { Array [ "cutoffTime", ], + Array [ + "sundayCutoffTime", + ], + Array [ + "saturdayCutoffTime", + ], ], } `;