Commit Graph

195 Commits

Author SHA1 Message Date
Riqwan Thamir
b6fd82e31e feat(order,core-flows): added order change create workflow (#8033)
what:

- adds anorder change create workflow
- remove order change service, brings validation to entry point service
2024-07-09 12:12:05 +00:00
Stevche Radevski
db6969578f feat: Plug tax inclusivity in cart and order workflows (#8013) 2024-07-09 11:10:42 +02:00
Adrien de Peretti
10848c8bf2 chore: rename source to linkable in defineLink options (#8016)
* chore: rename source to linkable in defineLink options

* rm unused const
2024-07-08 16:44:03 +02:00
Adrien de Peretti
7b84d854f0 Feat/mikro orm based linkable (#7944)
**What**
- Generate simple linkable for mikro orm based modules 
- fix module util
- fix joiner config builder
- fix define link relationship extension
- fix migrations not loading custom links
2024-07-04 13:30:47 +00:00
Carlos R. L. Rodrigues
d036130604 fix(cart): add shipping method to cart (#7945) 2024-07-04 12:47:39 +00:00
Adrien de Peretti
41c4307fc7 feat: define link util (#7931)
* feat: define link util

* handle pluralized fieldAlias for isList

* serviceName ar reference

* finalize

* todo

* WIP

* finalize

* fix tests

* update typings

* fix Module

* linkable

* update errors
2024-07-04 10:37:30 +02:00
Stevche Radevski
012a624ee4 feat: Flatten the provider config for all modules (#7930) 2024-07-03 16:57:12 +02:00
Carlos R. L. Rodrigues
a7844efd09 chore: move ModuleRegistrationName to utils (#7911) 2024-07-03 06:30:56 -03:00
Stevche Radevski
9daec5d7ac chore: Migrate notification module to DML (#7835) 2024-07-01 09:17:32 +00:00
Stevche Radevski
c661180c44 feat: Completely revamp the pricing module (#7852)
* feat: Completely revamp the pricing module

* chore: Update all places to the new pricing interfaces

* fix: Remove unnecessary join to itself

* chore: Add data migration for existing users

* fix: Apply the correct index to price rule
2024-07-01 09:47:03 +02:00
Carlos R. L. Rodrigues
9f3998393b fix(totals): order item totals (#7867) 2024-06-28 09:34:25 -03:00
Carlos R. L. Rodrigues
61758f374b chore(medusa): return endpoints (#7823) 2024-06-25 13:53:18 +00:00
Riqwan Thamir
96fb7a962e feat(utils,currency): Migrate currency to use DML (#7807) 2024-06-24 19:07:26 +02:00
Stevche Radevski
e8d6025374 Add support for tax inclusivity to region and store (#7808)
This also includes rework of the currency model for the Store module.

This change is breaking as existing stores won't have any supported currencies set, so users would need to go to the store settings again and choose the supported currencies there.
2024-06-24 15:25:44 +00:00
Adrien de Peretti
ae6dbc06be chore: Update module test runner to support DmlEntities when needed (#7799)
* chore: Update module test runner to support DmlEntities when needed

* update es version for core test utils

* fix test

* update swc config
2024-06-24 09:44:01 +02:00
Adrien de Peretti
937a632eb6 chore: make module loaders DML aware and auto generate joiner config (#7781)
* chore: make module loaders DML aware and auto generate joiner config

* fixes and cleanup

* improve dml entity check

* add unit tests on load resources

* cleanup deps

* cleanup deps

* cleanup Modules

* finalise

* fix modules-sdk jest

* fix modules-sdk jest

* fix import

* fix import
2024-06-20 18:18:07 +02:00
Riqwan Thamir
33c4cd34cc chore: export DML builders + fix default undefined values in SQL (#7776)
* chore: export dml builders through utils

* chore: fix undefined sql error

* chore: upgrade to ts 5

* chore: use isDefined
2024-06-20 10:45:49 +02:00
Adrien de Peretti
48963f55ef Chore/rm main entity concept (#7709)
**What**
Update the `MedusaService` class, factory and types to remove the concept of main modules. The idea being that all method will be explicitly named and suffixes to represent the object you are trying to manipulate.
This pr also includes various fixes in different modules

Co-authored-by: Stevche Radevski <4820812+sradevski@users.noreply.github.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-06-19 13:02:16 +00:00
Riqwan Thamir
288e41856b fix(core-flows): delete existing payment session before creating new (#7751)
what:

Multiple active sessions are used for split payments. We don't currently support split payments. Until we have that implemented, this change is to ensure that whenever we create a new payment session, we delete an existing session if present. 

RESOLVES CORE-2284
2024-06-18 11:51:20 +00:00
Riqwan Thamir
3d33f06e77 chore: upgrade jest everywhere (#7703) 2024-06-14 07:35:30 +02:00
Riqwan Thamir
129fb447d0 chore: allow calculating prices without explicit fields (#7691) 2024-06-12 20:04:53 +02:00
Carlos R. L. Rodrigues
37426939da Feat(order): post purchase support (#7666) 2024-06-10 18:44:51 -03:00
Riqwan Thamir
39ddba2491 chore: ability to group events on redis event bus (#7655)
* chore: ability to group events on redis event bus

* chore: fix tests

* Update packages/modules/event-bus-redis/src/services/event-bus-redis.ts

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

* chore: change shape of input and body data

* chore: fix builds

* chore: address comments

* chore: fix unit test

---------

Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2024-06-10 22:15:43 +02:00
Riqwan Thamir
0507dbe027 chore(core-flows,inventory,types,medusa): add fixes to inventory module + location levels api (#7629)
what:

- santizes inputs to prevent reserved_quantity from being updated directly
- inventory items create api can create location levels
- add validation to update quantity of reservation items
- general cleanup

RESOLVES CORE-2254
2024-06-06 12:58:17 +00:00
Stevche Radevski
d2e1e9f8c7 fix: Apply strict schema for all body and query parameters (#7624) 2024-06-05 15:40:54 +00:00
Stevche Radevski
1e3c8747e5 chore: Move inventory tests to HTTP layer (#7613) 2024-06-05 09:36:58 +00:00
Stevche Radevski
fafc92b875 Revamp auth module to support multiple providers linked to a single auth identity (#7521) 2024-06-05 07:47:16 +00:00
Oli Juhl
dc087bf310 feat: Move shipping option + profile test and more (#7609) 2024-06-05 08:36:41 +02:00
Stevche Radevski
e44fe78b96 fix: Several fixes to store product endpoints, moved several test suites to HTTP (#7601)
* chore: Move publishable api key tests to HTTP

* chore: Move store tests to HTTP folder

* fix: Add tests for store products, fix several bugs around publishable keys
2024-06-04 21:00:07 +02:00
Riqwan Thamir
e7005a0aac feat(core-flows,medusa): adds inventory kit creation to variants endpoint (#7599)
what:

When creating a variant, we can now create inventory as a part of the product and variants create endpoint.

This applies only to variants where `manage_inventory=true`. 2 cases present itself:

1. When inventory_items are present
  - Link an inventory item with required_quantity to the variant
  - the inventory item already needs to be present
2. When inventory_items are not present
  - A default inventory item will be created
  - links the created item to the variant with a default required_quantity
  
  
RESOLVES CORE-2220
2024-06-04 13:49:31 +00:00
Carlos R. L. Rodrigues
68fb04b849 fix(order): ignore reservation when manage_inventory is false (#7594) 2024-06-04 07:08:54 -03:00
Riqwan Thamir
ecfbfcc707 feat(core-flows,modules-sdk,types,medusa,link-modules): adds variant <> inventory item link endpoints (#7576)
what:

- adds variant inventory link management endpoints:
```
Link inventory item to variant
POST /products/:id/variants/:vid/inventory-items

Update variant's inventory item link
POST /products/:id/variants/:vid/inventory-items/:iid

Unlink variant's inventory item
DELETE /products/:id/variants/:vid/inventory-items/:iid
```

- a batch endpoint that does the above 3 across variants
```
POST /products/:id/variants/inventory-items
```
2024-06-03 18:23:29 +00:00
Carlos R. L. Rodrigues
122186a78d chore(order): cancel order (#7586) 2024-06-03 12:31:33 -03:00
Carlos R. L. Rodrigues
af0140d317 feat(order): cancel fulfillment (#7573) 2024-06-02 09:33:24 -03:00
Stevche Radevski
4117beed58 chore: Refactor batch product workflows and add tests (#7540) 2024-05-30 15:53:03 +02:00
Riqwan Thamir
15e9787465 feat(types,medusa): add inventory quantity to products endpoint (#7541)
what:

- when inventory_quantity is requested through the API, we calculate the inventory based on sales channels + stock locations and return the total available inventory.

A variant can have multiple inventory items. As an example:

Table: (variant)
  - 4 (required_quantity via link) x legs (inventory item)
  - 2 x table top

Only if all individual inventory items of a variant are available, do we mark the variant as available as a single unit. 

RESOLVES CORE-2187
2024-05-30 13:20:06 +00:00
Stevche Radevski
eeb8225b5e chore: Remove redundant product tests, add missing to http layer (#7543) 2024-05-30 11:26:50 +00:00
Stevche Radevski
5ad6864b82 feat: Improve zod error messages (#7535) 2024-05-30 09:52:47 +02:00
Riqwan Thamir
f0b9d5534e chore: query inventory items by location id (#7524)
what:

- allows querying inventory items by the correct location_id
2024-05-29 14:14:10 +00:00
Carlos R. L. Rodrigues
f1ced57d5f chore: payment auto capture + remove enum from utils (#7513)
What:

- handles payments session that are auto captured
- removes all the enums from `@medusajs/types`
- move all `@medusajs/types` to devDependencies
2024-05-29 11:12:59 +00:00
Carlos R. L. Rodrigues
bbca54efa7 chore(order): aggregate statuses (#7497) 2024-05-29 07:05:42 -03:00
Harminder Virk
82be054a1a chore: Rename config properties to camelCase (#7498)
* refactor: rename config types to camelCase

* refactor: update config references to use renamed options

* refactor: update more references

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-05-28 14:49:29 +02:00
Oli Juhl
c9de1d28a4 feat: Assign store default sales channel in cart creation (#7495) 2024-05-28 12:12:01 +02:00
Oli Juhl
ad21bd30b1 fix: errors thrown in transformer (#7480)
* chore: wup

* throw on error

* add back test

---------

Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com>
2024-05-28 08:44:33 +02:00
Riqwan Thamir
7baedf73d5 feat(core-flows,types,utils,medusa): Update existing line items when adding the same variant to cart (#7470)
* feat(core-flows,types,utils,medusa): Update existing line items when adding the same variant to cart

* chore: split steps into 2 for add-to-cart

* chore: split steps into 2 for add-to-cart

* chore: iterate safely

* chore: parallelize upsert
2024-05-27 17:54:11 +02:00
Stevche Radevski
10ef32c5a3 feat: Apply authentication middleware globally (#7396)
* feat: Apply auth middleware globally

* feat: Remove local auth middleware where it makes sense
2024-05-27 15:24:53 +02:00
Carlos R. L. Rodrigues
62ef82f497 feat(order): fulfillment workflow (#7385)
FIXES: CORE-2162 CORE-2167 CORE-2041
2024-05-27 12:49:33 +00:00
Adrien de Peretti
e275e01d85 chore: Cleanup medusa test utils (#7464)
* chore: Cleanup medusa test utils

* update yarn

* cleanup

* fix key

* cleanup

* fixes

* fixes

* fixes

* fixes

* fix runners

* fix bootstrap

* naming

* Improve runners options

* Improve runners options

* Improve runners options

* cleanup

* fix tests
2024-05-27 14:14:32 +02:00
Stevche Radevski
28a3f9a3df feat: Add list cart option typings, make region optional on update cart (#7455) 2024-05-27 09:37:10 +02:00
Adrien de Peretti
f585b13c96 chore: remove babel usage (#7452) 2024-05-24 20:51:12 +02:00