From d698917d628eafade60fd9058d7daa14997a1ca2 Mon Sep 17 00:00:00 2001 From: Siarhey Uchukhlebau Date: Thu, 13 Apr 2023 13:35:52 +0300 Subject: [PATCH 1/5] Add extra fields: extra_charge_froamtted for time limit --- etc/schema.graphqls | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/schema.graphqls b/etc/schema.graphqls index 3ef7a34..f609604 100644 --- a/etc/schema.graphqls +++ b/etc/schema.graphqls @@ -50,6 +50,7 @@ type DeliveryTimeLimit { from: String @doc(description: "Time from in hh:mm format.") to: String @doc(description: "Time to in hh:mm format.") extra_charge: String @doc(description: "Extra charge for that time slot.") + extra_charge_formatted: String @doc(description: "Formatted Extra charge for that time slot.") } input DeliveryDateInput @doc(description: "Defines the delivery data.") { From 3fa126d3248efa6c150e07f3a2bbe7b53cbd4ac6 Mon Sep 17 00:00:00 2001 From: Siarhey Uchukhlebau Date: Wed, 3 May 2023 20:35:13 +0300 Subject: [PATCH 2/5] Add extra charge formatted field --- etc/schema.graphqls | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/schema.graphqls b/etc/schema.graphqls index f609604..5214c27 100644 --- a/etc/schema.graphqls +++ b/etc/schema.graphqls @@ -42,14 +42,15 @@ type DeliveryDayLimit { day_index: Int @doc(description: "Index of the day from today (0).") date_formatted: String @doc(description: "Date formatted using format selected in store configuration.") date: String @doc(description: "Date in regular format Y-m-d.") - extra_charge: Float @doc(description: "Extra charge for that day (may be overwritten by time extra charge).") + extra_charge: Float @doc(description: "Extra charge for that day in the currency of the cart (may be overwritten by time extra charge).") + extra_charge_formatted: String @doc(description: "Extra charge formatted according selected locale (with currency symbol).") extra_charge_message: String @doc(description: "Extra charge formatted message. May be set in the store configuration.") time_limits: [DeliveryTimeLimit] @doc(description: "Limits by time when available.") } type DeliveryTimeLimit { from: String @doc(description: "Time from in hh:mm format.") to: String @doc(description: "Time to in hh:mm format.") - extra_charge: String @doc(description: "Extra charge for that time slot.") + extra_charge: String @doc(description: "Extra charge for that time slot in the currency of the cart.") extra_charge_formatted: String @doc(description: "Formatted Extra charge for that time slot.") } From 3ab457e7f68ee846cf45ad4f1efcbda7391574ff Mon Sep 17 00:00:00 2001 From: Siarhey Uchukhlebau Date: Mon, 8 May 2023 02:13:09 +0300 Subject: [PATCH 3/5] Convert extra charge to the Object --- etc/schema.graphqls | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/etc/schema.graphqls b/etc/schema.graphqls index 5214c27..ef28977 100644 --- a/etc/schema.graphqls +++ b/etc/schema.graphqls @@ -42,18 +42,20 @@ type DeliveryDayLimit { day_index: Int @doc(description: "Index of the day from today (0).") date_formatted: String @doc(description: "Date formatted using format selected in store configuration.") date: String @doc(description: "Date in regular format Y-m-d.") - extra_charge: Float @doc(description: "Extra charge for that day in the currency of the cart (may be overwritten by time extra charge).") - extra_charge_formatted: String @doc(description: "Extra charge formatted according selected locale (with currency symbol).") - extra_charge_message: String @doc(description: "Extra charge formatted message. May be set in the store configuration.") + extra_charge: ExtraCharge @doc(description: "Extra charge description.") time_limits: [DeliveryTimeLimit] @doc(description: "Limits by time when available.") } type DeliveryTimeLimit { from: String @doc(description: "Time from in hh:mm format.") to: String @doc(description: "Time to in hh:mm format.") - extra_charge: String @doc(description: "Extra charge for that time slot in the currency of the cart.") - extra_charge_formatted: String @doc(description: "Formatted Extra charge for that time slot.") + extra_charge: ExtraCharge @doc(description: "Extra charge description.") +} +type ExtraCharge { + amount: Float @doc(description: "Extra charge amount in selected currency (cart currency).") + formatted: String @doc(description: "Extra charge formatted according selected locale (with currency symbol).") + currency_symbol: String @doc(description: "Extra charge currency symbol.") + currency_code: String @doc(description: "Extra charge currency code.") } - input DeliveryDateInput @doc(description: "Defines the delivery data.") { day: String! @doc(description: "A string that identifies a delivery day in standard format Y-m-d.") time: String @doc(description: "A string that identifies a delivery time diapason in \"12:00_23:59\" fromat. Must be a valid time.") From 907036aa35d063d8d30b0310ad1bb33e9461014d Mon Sep 17 00:00:00 2001 From: Siarhey Uchukhlebau Date: Fri, 9 Jun 2023 17:57:49 +0300 Subject: [PATCH 4/5] Update README: add actual request and response examples --- README.md | 181 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 109 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 0ebf22b..862d555 100644 --- a/README.md +++ b/README.md @@ -91,17 +91,25 @@ DeliveryDayLimit object: day_index: Int - Index of the day from today (from 0). date_formatted: String - Date formatted using format selected in store configuration. date: String - Date in standard Y-m-d format. -extra_charge: Float - Extra charge for that day (may be overwritten by time limits extra charge). -extra_charge_message: String - Extra charge formatted message. +extra_charge: ExtraCharge - Extra charge for that day. time_limits: [DeliveryTimeLimit] - Limits by time when available. ``` DeliveryTimeLimit object: ``` -from: String - Time from in hh:mm format. -to: String - Time to in hh:mm format. -extra_charge: String - Extra charge for that time slot. +from: String - Time from in hh:mm format. +to: String - Time to in hh:mm format. +extra_charge: ExtraCharge - Extra charge for that time slot. Summed up with a surcharge from the delivery day settings. +``` + +ExtraCharge object: + +``` +amount: Float - Amount in selected currency (in cart currency). +formatted: String - Formatted according selected locale (with currency symbol). +currency_symbol: String - Currency symbol. +currency_code: String - Currency code. ``` **Request:** @@ -119,12 +127,21 @@ query ($magentoCartId: String!) { day_index date_formatted date - extra_charge - extra_charge_message + extra_charge { + amount + formatted + currency_code + currency_symbol + } time_limits { from to - extra_charge + extra_charge { + amount + formatted + currency_code + currency_symbol + } } } } @@ -135,71 +152,91 @@ query ($magentoCartId: String!) { ```json { - "data": { - "availableDeliveryDates": [ - { - "method": "flatrate_flatrate", - "day_limits": [ - { - "day_index": 3, - "date_formatted": "2022-05-11", - "date": "2022-05-11", - "extra_charge": 0, - "extra_charge_message": "", - "time_limits": [ - { - "from": "10:00", - "to": "12:00", - "extra_charge": "US$2.00" - }, - { - "from": "14:00", - "to": "16:00", - "extra_charge": "US$5.00" - }, - { - "from": "17:05", - "to": "23:30", - "extra_charge": "" - } - ] - }, - { - "day_index": 4, - "date_formatted": "2022-05-12", - "date": "2022-05-12", - "extra_charge": 0, - "extra_charge_message": "", - "time_limits": [] - }, - { - "day_index": 5, - "date_formatted": "2022-05-13", - "date": "2022-05-13", - "extra_charge": 0, - "extra_charge_message": "", - "time_limits": [] - }, - { - "day_index": 8, - "date_formatted": "2022-05-16 +US$15.00", - "date": "2022-05-16", - "extra_charge": 15, - "extra_charge_message": " +US$15.00", - "time_limits": [] - }, - { - "day_index": 9, - "date_formatted": "2022-05-17", - "date": "2022-05-17", - "extra_charge": 0, - "extra_charge_message": "", - "time_limits": [] - } - ] - } + "data": { + "availableDeliveryDates": [ + { + "method": "flatrate_flatrate", + "day_limits": [ + { + "day_index": 5, + "date_formatted": "14-June-2023", + "date": "2023-06-14", + "extra_charge": null, + "time_limits": [ + { + "from": "09:00", + "to": "12:00", + "extra_charge": { + "amount": 0, + "formatted": "", + "currency_code": "EUR", + "currency_symbol": "€" + } + }, + { + "from": "11:00", + "to": "16:00", + "extra_charge": { + "amount": 0, + "formatted": "", + "currency_code": "EUR", + "currency_symbol": "€" + } + }, + { + "from": "15:00", + "to": "20:00", + "extra_charge": { + "amount": 4.5409, + "formatted": "€4.54", + "currency_code": "EUR", + "currency_symbol": "€" + } + } + ] + }, + { + "day_index": 6, + "date_formatted": "15-June-2023", + "date": "2023-06-15", + "extra_charge": null, + "time_limits": [ + { + "from": "09:00", + "to": "12:00", + "extra_charge": { + "amount": 0, + "formatted": "", + "currency_code": "EUR", + "currency_symbol": "€" + } + }, + { + "from": "11:00", + "to": "16:00", + "extra_charge": { + "amount": 0, + "formatted": "", + "currency_code": "EUR", + "currency_symbol": "€" + } + }, + { + "from": "15:00", + "to": "20:00", + "extra_charge": { + "amount": 4.5409, + "formatted": "€4.54", + "currency_code": "EUR", + "currency_symbol": "€" + } + } + ] + } ] - } + } + ] + } } ``` From 8df8844fb7958a33c6a1492ff71c5d929e3be151 Mon Sep 17 00:00:00 2001 From: Siarhey Uchukhlebau Date: Mon, 12 Jun 2023 13:58:51 +0300 Subject: [PATCH 5/5] v1.2.0 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index baae7b3..20a4edc 100755 --- a/composer.json +++ b/composer.json @@ -2,12 +2,12 @@ "name": "mageworx/module-deliverydate-graph-ql", "description": "Graph QL Addon for MageWorx Delivery Date Extension", "require": { - "mageworx/module-deliverydate": ">=1.19", + "mageworx/module-deliverydate": ">=1.21", "magento/framework": ">=103", "magento/module-graph-ql": ">=100" }, "type": "magento2-module", - "version": "1.1.1", + "version": "1.2.0", "license": [ "OSL-3.0", "AFL-3.0"