Riqwan Thamir
34e405c492
Merge pull request #2729 from medusajs/fix/discount-regions-validation
...
fix(medusa): discounts service create validates against at-least 1 region
2022-12-08 11:34:51 +01:00
Riqwan Thamir
dbe25245b5
Merge branch 'develop' into fix/discount-regions-validation
2022-12-08 10:50:20 +01:00
Riqwan Thamir
5240972cef
chore: remove expectations in callbacks
2022-12-07 17:03:51 +01:00
Riqwan Thamir
c1cdb80436
chore: use splat instead of lodash to clone, remove unnecessary expectations
2022-12-07 16:42:32 +01:00
Riqwan Thamir
40694bd5d1
chore: add a validation in the service layer to conform to 1 region rule
2022-12-07 16:42:32 +01:00
Riqwan Thamir
7fcf2b86a9
chore: prevent adminSession variable from being mutated in the helpers
2022-12-07 16:42:32 +01:00
Riqwan Thamir
66bec2f54d
test: add a case when regions only contain invalid region Ids
2022-12-07 16:42:32 +01:00
Riqwan Thamir
bcc1edbf2b
chore: addressing review - move repeated strings and objects to constants
2022-12-07 16:42:32 +01:00
Riqwan Thamir
cb2a32a82b
chore: add changeset
2022-12-07 16:42:32 +01:00
Riqwan Thamir
f22e063ed8
test: fix existing integration tests and add a new test that validates regions inclusion and validity
2022-12-07 16:42:32 +01:00
Riqwan Thamir
d4e565b0b9
fix: regions are changed from an optional to required field
...
A discount should always be associated to atleast 1 region - we validate it against the region in the cart service.
Adding a request parameter validation to pass in atleast one regionID in an array of regions will ensure that regionID will be validated as a part of the discount service and fail if its not a valid region ID.
2022-12-07 16:42:32 +01:00