Commit Graph

33 Commits

Author SHA1 Message Date
Adrien de Peretti
74381addc3 chore(): Emit events in batch and index process event ids in batch (#12097)
**What**
First iteration to prevent events from overwhelming the systems.
- Group emitted event ids when possible instead of creating a message per id which leads to reduced amount of events to process massively in cases of import for example
- Update the index engine to process event data in batches of 100
- Update event handling by the index engine to be able to upsert by batch as well
- Fix index engine build config for intermediate listeners inferrence
2025-04-08 16:57:08 +00:00
Riqwan Thamir
cb6249320e fix(types,order,medusa): Create credit lines + hooks (#11569)
what:

- api/workflows to create credit lines
- hooks to enable extending credit lines
2025-03-17 15:20:59 +00:00
Carlos R. L. Rodrigues
16d7294de8 fix(pricing): events (#11742) 2025-03-05 15:35:23 -03:00
Riqwan Thamir
3fec01ab49 fix(pricing): add null conditions for deleted at during price calculations (#10896) 2025-01-09 15:32:57 +01:00
Kasper Fabricius Kristensen
a625bce7b0 fix(pricing): PriceLists of type Sale should not override lower prices (#10882)
Resolves CMRC-840
2025-01-09 10:07:15 +00:00
Harminder Virk
913cf15e2b refactor: migrate pricing entities to DML models (#10335)
Fixes: FRMW-2810

## Breaking changes
There is only one breaking change

- The `min_quantity` and `max_quantity` properties are now consistently typed as numbers. Earlier, it was [typed as numbers](https://github.com/medusajs/medusa/blob/develop/integration-tests/http/__tests__/price-list/admin/price-list.spec.ts#L68-L69) in some API responses and as [string in others](https://github.com/medusajs/medusa/blob/develop/integration-tests/http/__tests__/price-list/admin/price-list.spec.ts#L186-L187). I did not go to the bottom of this inconsistency, but the tests reveals them.

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-12-02 09:44:41 +00:00
Riqwan Thamir
11bd556133 feat(core-flows,framework,medusa): list shipping options pass in cart as pricing context (#10374)
* feat(core-flows,framework,medusa): list shipping options pass in cart as pricing context

* chore: add test for shipping options returning free shipping
2024-12-01 20:59:26 +01:00
Riqwan Thamir
324b4ab438 feat(pricing, types): add price rule operators to price calculations (#10350)
what:

- adds price rule operators when doing price calculations
- rules now accepts a key where the value can be an array of objects `({ operator: string, value: number })`
  - validation for available types of operator and value to be a number
```
await service.createPriceSets({
  prices: [
    {
      amount: 50,
      currency_code: "usd",
      rules: {
        region_id: "de",
        cart_total: [
          { operator: "gte", value: 400 },
          { operator: "lte", value: 500 },
        ]
      },
    },
  ]
})
```
- price calculations will now account for the operators - lte, gte, lt, gt when the price context is a number

RESOLVES CMRC-747
2024-11-28 20:48:00 +00:00
Harminder Virk
68560787e5 breaking: rename package names to be consistent and under @medusajs scope (#9580) 2024-10-16 22:28:09 +05:30
Adrien de Peretti
1d8939df3a chore(): Allow to register modules through array (#9522) 2024-10-11 15:17:00 +02:00
Frane Polić
c726ed54f5 fix(pricing): price set update deletes price list prices (#9308)
**Why**
- price set update uses `upsertWithReplace` so price list prices are removed since we "ignore" them in regular price set operations and use price list methods to manage them

**What**
- preserve price list prices when updating price sets

---

FIXES CC-516
2024-10-01 08:37:56 +00:00
Adrien de Peretti
e096feb7d5 chore: Update modules deps (#9286) 2024-09-26 11:14:35 +05:30
Carlos R. L. Rodrigues
950cf9af79 chore: remove container registration name (#9137) 2024-09-16 06:22:24 -03:00
Carlos R. L. Rodrigues
fdd0543011 chore: joiner config entity property (#9084) 2024-09-11 06:25:25 -03:00
Oli Juhl
2f62b47bff fix(pricing): Calculate price sets with amount 0 (#8622) 2024-08-16 12:49:11 +02:00
Carlos R. L. Rodrigues
3d7d629e75 chore(pricing): big number support (#8113) 2024-07-12 19:27:28 +00:00
Stevche Radevski
1c3ef13371 feat: Add necessary middlewares for tax inclusive pricing (#7827)
We are adding tax inclusive pricing calculation when listing products.

Two things to keep in mind:
- `region_id` will be required if you request calculated prices.
- We won't accept `currency_code` anymore, as that will come from the region info (since ultimately a cart and its currency are tied to a region)

REF CORE-2376
DEPENDS ON #8003
2024-07-09 09:37:13 +00:00
Adrien de Peretti
b368251ca3 chore: Migrate modules to use the Module util (#7964)
**What**
Apply the `Module` util to each module to handle the export and provide the linkable configuration object.

- Most joiner config that does not have any special config are removed/cleaned up in favor of the autogenerated one or simpler one
- linkable are now available in all modules
- cleaned up the dependencies of the modules

FIXES CORE-2410
2024-07-05 13:00:40 +00:00
Stevche Radevski
5544303b91 feat: Add support for managing tax inclusivity (#7943)
UI / HTTP / Workflows will come in separate PRs

REF CORE-2376
2024-07-04 14:50:09 +00:00
Stevche Radevski
b4aa7fb9a7 fix: Disallow creating duplicate prices (#7866)
* fix: Disallow creating duplicate prices

* fix: Don't pass id to manager create in upsertWithReplace
2024-07-02 17:06:58 +02:00
Stevche Radevski
5c7c28709f fix: Only list price set prices when calling the price set methods (#7889)
FIXES CORE-2417
2024-07-01 14:24:14 +00:00
Stevche Radevski
63e64e738a fix: Return null for calculated price if no prices are defined (#7886) 2024-07-01 15:09:21 +02: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
Riqwan Thamir
8ac74c1357 feat(core-flows,types,pricing,medusa): Products API can create prices with rules (#7796)
* chore: Products API can create prices with rules

* chore: fix tests

* chore: cleanup

* chore: address comments
2024-06-21 15:30:36 +02:00
Stevche Radevski
ee35379e21 chore: Rename all event keys to uppercase (#7787)
* chore: Rename all event keys to uppercase

* fix: Remove main entity from event builder
2024-06-21 10:41:35 +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
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
Carlos R. L. Rodrigues
12a57836a7 fix(pricing): Only get prices from active price list (#7753) 2024-06-17 20:18:08 +02:00
Adrien de Peretti
2e77a076b8 feat: Add emitEvent step + cleanup (#7643)
* feat: Add emitEvent step + cleanup

* fix typo

* fix typo
2024-06-07 11:52:19 +02:00
Harminder Virk
2b62686ec6 implement events to the pricing module (#7584) 2024-06-05 17:33:49 +05:30
Harminder Virk
8d9d78029b Remove redundant methods from pricing module (#7597) 2024-06-04 16:33:06 +05:30
Carlos R. L. Rodrigues
122186a78d chore(order): cancel order (#7586) 2024-06-03 12:31:33 -03:00
Adrien de Peretti
4eae25e1ef chore(): Reorganize modules (#7210)
**What**
Move all modules to the modules directory
2024-05-02 15:33:34 +00:00