429 Commits

Author SHA1 Message Date
Riqwan Thamir
d1ce6d4321 Revert "feat(core-flows,medusa): Add customer validation on cart update" (#9724) 2024-10-22 18:26:01 +00:00
Adrien de Peretti
6b989353ac fix: API validation management issues (#9693)
**What**
Currently, the API validation layer is broken in both responsibilities and validation itself.
This pr introduce the following fixes and patterns:
- Always create a `*Fields` schema that only takes care of defining the schema validation without `effect`
- Use the previous point into the API schema validator including `$and` and `$or` capabilities plus the recursive effects
- remove `normalizeArray` which does not have to exists since array are already treated as they should
- Add recursive transformation to take into account `$and` and `$or` as well or any other similar operators
- New util `applyAndAndOrOperators` to wrap the management of those operators and to be merged to an existing schema

Tasks
- [x] store domain
- [ ] admin domain
2024-10-22 15:16:36 +00:00
Riqwan Thamir
0d803b3f2d feat(core-flows,medusa): Add customer validation on cart update (#9662) 2024-10-22 12:19:12 +02:00
Carlos R. L. Rodrigues
2a98be6b65 feat(medusa): ordem items endpoint (#9646) 2024-10-18 05:59:24 -03:00
Riqwan Thamir
3b50c6d019 feat(core-flows,types,medusa): Add tax region update API (#9634)
* feat(core-flows,types,medusa): Add tax region update API

* chore: added specs
2024-10-17 14:19:29 +02:00
Oli Juhl
0be50059f2 fix: Add free text search on reservations (#9621) 2024-10-17 10:21:24 +02:00
Harminder Virk
68560787e5 breaking: rename package names to be consistent and under @medusajs scope (#9580) 2024-10-16 22:28:09 +05:30
Riqwan Thamir
537567b679 chore: add compare_at_unit_price when price list price is retrieved (#9564)
* chore: add compare_at_unit_price when price list price is retrieved

* chore: add test for update item + more fixes along the way

* chore: fix tests

* chore: add refresh spec

* Apply suggestions from code review

Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>

* chore: use undefined checker

* chore: switch to map

---------

Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2024-10-15 13:05:14 +02:00
Frane Polić
48cc00e991 feat(core-flows, product): options checks on product create/update (#9171)
**What**
- validate that variants are unique with respect to options on product update/create and variant update/create
- validate that the product has options upon creation
- ensure variants have the same number of option values as the product has options
- admin error handling
- update tests

---

FIXES FRMW-2707 CC-556
2024-10-15 09:06:51 +00:00
Frane Polić
809c851865 fix(core-flows, link-module): product <> inventory delete cascades (#9528)
**What**
- remove cascade delete of inventory items on product delete
- implement inventory deletion in product/variant delete workflows with checks:
  - product/variant cannot be deleted if there are reservations associated with their inventory items
  - inventory item will be cascade deleted if it's not used by other variants (that are not being deleted in the current flow)

---

FIXES CC-581 CC-582
2024-10-14 16:22:31 +00:00
Sebastian Rindom
aeaedc8539 fix: add metadata to collection resp (#9514)
**What**
- Adds `metadata` to the default response for `/admin/collection` endpoints.
- Fixes tests to expect correct shape and not use objectContaining.

Fixes CC-551
2024-10-09 15:52:59 +00:00
Sebastian Rindom
7ec174309a fix: add metadata to product type resp (#9515) 2024-10-09 16:22:51 +02:00
Oli Juhl
853187410e fix(product): Always add q if defined (#9505) 2024-10-09 11:52:02 +02:00
Carlos R. L. Rodrigues
8fbef8a667 fix(order): searchable fields (#9493)
FIXES: TRI-353
2024-10-07 17:45:20 +00:00
Oli Juhl
67e08dc989 fix(payment): Capture payment (#9469)
What
- Add missing `captured_at` field to payment retrieval
- Properly delete Medusa captures in case 3rd party capture call fails
2024-10-04 15:15:10 +00:00
Adrien de Peretti
225d00cd09 chore: improve mikro orm serializer circular ref and link serialization (#9411) 2024-10-03 08:22:11 +02:00
Riqwan Thamir
fbbfb0cb62 feat(framework,medusa): Ensure publishable key middleware is set for all store endpoints (#9429)
* feat(framework,medusa): Ensure publishable key middleware is set for all store endpoints

* chore: fix tests
2024-10-02 18:01:50 +02:00
Oli Juhl
732f64177d fix: Validate identifier payload for reset password (#9302)
Closes CC-526
2024-10-01 13:30:23 +00:00
Sebastian Rindom
852df3f764 fix(medusa,dashboard): don't send price updates for deleted regions/currencies (#9361)
**What**
- Fixes an issue where the admin dashboard would send region prices for deleted regions.
- Also, includes the implementation for `GET /admin/shipping-options/:id` and its corresponding SDK function.

**Why**
- When a region price for a deleted region was sent to the backend it would result in the insert hitting a not null constraint on the currency_code for prices. To avoid this the dashboard should not send region prices for deleted regions. 

**Additional context**
- Prices for deleted regions should ideally not be returned when fetching shipping option prices. However, we don't yet have a mechanism for cleaning up region prices after a region is deleted.

Fixes CC-540
2024-09-30 11:51:55 +00:00
Adrien de Peretti
7e73fe4794 chore: Improve jest config and deps (#9318) 2024-09-30 10:50:59 +02:00
Oli Juhl
1b4372ae71 fix: Tax region + rates clean up (#9279)
What
- Require `code` on Tax Rates
- Update dashboard to account for non-nullable code on Tax Rates

- Include `automatic_taxes` in API Route response

Closes CC-524 CC-525
2024-09-29 10:25:33 +00:00
Carlos R. L. Rodrigues
19bc8d7f61 fix(core-flows): shipping options for cart (#9343)
FIXES: CC-536

Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com>
2024-09-27 12:32:32 +00:00
Adrien de Peretti
a8e19faf8d chore: use framework sub paths everywhere (#9253) 2024-09-26 16:38:38 +05:30
Adrien de Peretti
ae320ac73f fix: base tsconfig (#9309)
* fix: base tsconfig

* WIP

* wi[]

* update integration typescript version

* update lock file

* fix deps

* fix medusa tests runner
2024-09-25 16:31:57 +02:00
Stevche Radevski
7c4960a4d1 fix: Add actor type to password reset event (#9301) 2024-09-25 12:26:45 +02:00
Riqwan Thamir
69f6645716 feat(core-flows,dashboard,types,fulfillment,medusa): uses requires shipping throughout lifecycle (#9170)
what:

- uses requires shipping throughout lifecycle

https://github.com/user-attachments/assets/d5ba89d3-5ea0-49c4-b2d5-490c4764933e
2024-09-24 08:26:22 +00:00
Riqwan Thamir
987d007ba8 fix(core-flows): fixes case where inventory attempts delete when input is empty (#9156)
what:

- when an empty array is passed to the workflow, it attempts to delete all inventory locations. This PR adds a conditional to prevent it from happening.

RESOLVES CC-477

Fixes https://github.com/medusajs/medusa/issues/9154
2024-09-17 08:04:48 +00:00
Riqwan Thamir
3e97a64b21 feat(core-flows,medusa,utils,types): adds delivered_quantity to order (#9130)
what:

- adds delivered_quantity to order


https://github.com/user-attachments/assets/709b1727-08ed-4a88-ae29-38f13540e301
2024-09-16 09:59:01 +00:00
Carlos R. L. Rodrigues
950cf9af79 chore: remove container registration name (#9137) 2024-09-16 06:22:24 -03:00
Riqwan Thamir
64d5b74c12 feat(api-key,js-sdk,dashboard): allow deleting api keys only once its revoked (#9118)
what:

- module only deletes api keys once its revoked
- disables ui elements


https://github.com/user-attachments/assets/437821ae-497e-4b59-b02c-4a6ff36e6a30

RESOLVES CC-106
RESOLVES CC-105
RESOLVES CC-104
2024-09-12 10:16:15 +00:00
Riqwan Thamir
24704f420a feat(core-flows,dashboard,types,medusa): delete shipping methods when all inbound/outbound items are deleted (#9106)
* feat(core-flows,dashboard,types,medusa): delete shipping methods when all inbound/outbound items are deleted

* chore: fix specs
2024-09-11 21:24:01 +02:00
Riqwan Thamir
a729fb3fbb feat(utils,types,framework,medusa): store endpoints should require publishable key (#9068)
* feat(utils,types,framework,medusa): store endpoints should require publishable key

* chore: fix specs

* chore: fix more specs

* chore: update js-sdk

* chore: fix specs wrt to default SC

* chore: revert custom headers + change error message

* chore: fix specs

* chore: fix new store specs
2024-09-11 15:08:37 +02:00
Riqwan Thamir
c097931469 feat(core-flows,types,medusa): validate deleting location level when quantities exist (#9086)
what:

- adds validation in workflow to prevent deleting a location level when reserved or stocked quantity exists
- disabled delete button when quantities exist
- consolidate delete workflows

<img width="1079" alt="Screenshot 2024-09-10 at 16 39 02" src="https://github.com/user-attachments/assets/cf1f4b2e-75ea-4f7c-9b97-24622396c632">

RESOLVES CC-120
2024-09-10 17:59:03 +00:00
Oli Juhl
4bf42f7889 fix: Update auth app_metadata when deleting users + customers (#9041)
* wip

* more work

* working on stuff

* more

* fix test

* remove incorrect test

* fix test

* fix: Only allow deletion of yourself

* remove redundant tests
2024-09-10 19:58:16 +02:00
Stevche Radevski
62e0c593c8 feat: Add support for refreshing JWT tokens (#9013)
* feat: Add support for refreshing JWT tokens

* feat: Add refresh method to the auth SDK
2024-09-06 12:58:57 +02:00
Oli Juhl
e27056b3c3 feat: Reset password (#8962)
* wip

* more work

* wip

* more work

* wrap up first iteration

* work on new approach

* more work

* move middleware func to route

* cleanup

* more work

* wrap up

* more work

* fix workflow

* minor tweaks

* finalize

* Use JWT secret instead
2024-09-06 12:28:29 +02:00
Carlos R. L. Rodrigues
2a055b71ef feat(core-flows): custom price flag for order line items and shipping methods (#8969)
CLOSES: CC-402
2024-09-04 20:30:59 +00:00
Riqwan Thamir
de6f61b05f feat: added totals tests for end 2 end RMA flow (#8906)
what:

I've added some specs and comments in the specs for where I think totals are incorrect. 

Lets get this test merged in as the status quo and proceed to fix these issues one by one.

Additionally, this also removes the temporary_difference as its not something we use. 

RESOLVES CC-346

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2024-09-04 13:11:04 +00:00
Shahed Nasser
423583e06c fix(medusa): fix update promotion's request type (#8966)
Fix the validator of the update promotion API route to match the update workflow input's type.
2024-09-03 15:08:22 +00:00
Riqwan Thamir
e49d004fef chore: remove promotions in campaign validators + move tests to http (#8965) 2024-09-03 14:19:42 +02:00
Riqwan Thamir
230acb700b feat(core-flows,types): Refunds can only be performed when order is imbalanced (#8944)
* feat(core-flows,types): Refunds can only be performed when order is imbalanced

* Apply suggestions from code review

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>

* chore: fix tests

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-09-03 13:53:20 +02:00
Adrien de Peretti
479e712c17 fix(core-flows): Handle variant creation duplicate inventory item ids (#8937)
* fix(core-flows): Handle variant creation duplicate inventory item ids

* disabled already selected options

* address feedback

* fix tests
2024-09-02 18:36:42 +02:00
Oli Juhl
cbb0a6adc7 fix: Customer registration (#8896)
* fix: Customer registration

* update test

* one mroe test

* chore: add transformation
2024-09-01 11:41:39 +02:00
Carlos R. L. Rodrigues
891037081d chore(core-flows): apply taxes to items and shipping on RMA flows (#8858)
** What
Apply taxes to order line items and shipping methods
2024-08-29 17:33:39 +00:00
Carlos R. L. Rodrigues
b6521e4c1a feat(medusa): order changes endpoint (#8728)
What:
- `admin/orders/:id/changes` endpoint to get order changes related to the order
- added `*_by` attributes missing
2024-08-29 14:20:12 +00:00
Carlos R. L. Rodrigues
8dea3e44c6 fix(order): order change references (#8845) 2024-08-28 08:57:44 -03:00
Oli Juhl
c2e7940f61 fix: Validate boolean query params (#8834) 2024-08-28 13:14:15 +02:00
Alexander Nortung
ac18b5d35f fix(product): Add metadata to property to product category data model (#8766)
* fix: Add metadata to property to product category data model

* chore: Add migration for adding metadata column to product category

* chore: Added test for product category metadata
2024-08-27 16:21:41 +02:00
Carlos R. L. Rodrigues
ff6fcfb139 fix(core-flows,order): return damaged items (#8818) 2024-08-27 11:21:10 -03:00
Oli Juhl
c11ef01c15 feat: Separate registration from authentication in auth domain (#8683)
* wip

* feat: Introduce register

* fix: user command

* fix: Invite HTTP tests

* fix: Auth tests

* fix: Invite modules tests
2024-08-27 13:44:52 +02:00