Commit Graph

1106 Commits

Author SHA1 Message Date
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
Oli Juhl
f7472a6fa6 fix: Idempotent cart completion (#9231)
What
- Store result of cart-completion workflow for three days by default
  - This enables the built-in idempotency mechanism to kick-in, provided the same transaction ID is used on workflow executions
- Return order from cart-completion workflow if the cart has already been completed
  - In case transaction ID is not used on workflow executions, we still only want to complete a cart once
2024-10-04 12:01:09 +00:00
Oli Juhl
6055f4c9cf fix: If country on cart has no tax region, clear tax lines (#9447)
**What**

If the country on the shipping address changes to a country without an associated tax region, we clear the tax lines on shipping methods and line items.
2024-10-04 11:55:53 +00:00
Oli Juhl
a114f90358 fix: Handle region updates on cart (1/n) (#9369)
**What**

On cart creation:
- If region only has one country -> create cart with country code

On cart updates:
- If shipping address country code is provided in input ->
  - If cart region doesn't include that country -> throw
  - If cart includes the country -> update shipping address
- If region is provided in input and is different from the one currently on the cart -> 
  - If there is a shipping address on the cart -> clear the address
    - If the region only has one country -> set country code of address
  - If there is not a shipping address on the cart ->
    - If the region only has one country -> set country code of address


Closes CC-545
2024-10-04 11:33:36 +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
Oli Juhl
8851ae7b51 fix: Update tax lines on cart when region changes (#9367)
**What**
- Removes broken cart retrieval step `retrieveWithCartLinks` in favor of `useRemoteQueryStep` in `updateTaxLinesWorkflows`

**Why**
- Filters variables in the step were passed with an incorrect shape
  - I removed the step, since it's only used once and the behavior is identical to the generic remote query step

**Note**
- Because the filters were passed incorrectly, the, now-removed, step has always returned the first cart in the database. As a result all tax calculations so far have been based on whatever the shape of that cart has. It basically ignores all input to this workflow
2024-09-30 11:55:54 +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
Harminder Virk
a578313db9 feature: bundle all modules (#9324) 2024-09-30 09:04:03 +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
Sebastian Rindom
0efbcd2344 fix: validate regions exist for shipping option price update (#9364)
**What**
- Adds a step to `updateShippingOptionsWorkflow` and `createShippingOptionsWorkflow` that validates if the region prices being updated have corresponding regions configured.

**Why**
- Previously, if you tried to send a region price update for a region that had been deleted the backend would throw an error when attempting to insert the region price. The error comes from a not-null constraint in the db, but it is better to validate that the regions we are trying to create prices for exist. 

Fixes CC-542
2024-09-29 09:52:16 +00:00
Sebastian Rindom
17b2868a50 feat(medusa,fulfillment): pass stock location data to fulfillment provider (#9322)
**What**
- Fetches the stock location's details when creating a fulfillment and return fulfillment.
- Passes the data to the fulfillment module, which in turn passes it to the fulfillment provider.

**Why**
- When creating a fulfillment in a multi-location setup the fulfillment provider will need to know where the package is being sent from (so the shipping service can pick it up). 
- Previously, we didn't pass anything but the location id to the fulfillment provider. Because the fulfillment provider can't have a dependency on the stock location module this was not sufficient. 
- This change ensures there is enough data passed to the fulfillment provider to build integrations properly.
2024-09-28 14:01:48 +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
38778b37e2 fix: remove dist access for modules in integration tests (#9336) 2024-09-27 09:11:03 +02: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
Adrien de Peretti
802f204d31 fix(orchestration): Throw if not exists using filters (#9275) 2024-09-24 17:12:04 +02:00
Carlos R. L. Rodrigues
b4b1a48987 feat(utils): define read only link (#9254) 2024-09-24 12:00:38 -03: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
Adrien de Peretti
3084008fc9 feat(index): Provide a similar API to Query (#9193)
**What**
Align the index engine API to be similar to the Query API

## Example

```ts
        // Benefit from the same level of typing like the remote query

        const { data, metadata } = await indexEngine.query<'product'>({
          fields: [
            "product.*",
            "product.variants.*",
            "product.variants.prices.*",
          ],
          filters: {
            product: {
              variants: {
                prices: {
                  amount: { $gt: 50 },
                },
              },
            },
          },
          pagination: {
            order: {
              product: {
                variants: {
                  prices: {
                    amount: "DESC",
                  },
                },
              },
            },
          },
        })
```
2024-09-20 10:02:42 +00:00
Carlos R. L. Rodrigues
1215a7c094 chore(orchestrator): remote joiner using entitymap (#9205) 2024-09-20 05:30:08 -03:00
Adrien de Peretti
58167b5dfa feat(index): Index module foundation (#9095)
**What**
Index module foundation

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2024-09-18 19:04:04 +00:00
Adrien de Peretti
c6795dfc47 feat(modules-sdk): Parse filters based on loaded modules graph (#9158) 2024-09-17 14:20:04 -03: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
Carlos R. L. Rodrigues
ef8dc4087e feat: run nested async workflows (#9119) 2024-09-16 13:06:45 +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
Frane Polić
9db334554f fix(core-flows): item id in reservations (#9097)
**What**
- on cart completion, when creating reservations, use line item id instead of cart item id
- NOTE: inventory reservation is now done after we create the order

---

FIXES CC-448
2024-09-16 07:33:12 +00: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
Carlos R. L. Rodrigues
fdd0543011 chore: joiner config entity property (#9084) 2024-09-11 06:25:25 -03:00
Riqwan Thamir
d398009d3f feat(payment): Payment providers are upserted upon loading (#9090) 2024-09-11 09:01:24 +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
Riqwan Thamir
afd0921326 fix(utils,medusa,order,cart): fix totals when promotions are included (#9014)
* fix(utils): fix totals when promotions are included

* chore: update totals calc

* chore: ignore taxes when taxable amount is 0

* chore: use subtotals everywhere

* chore: fix shipping totals + tests
2024-09-10 10:59:22 +02:00
Shahed Nasser
c962283281 fix(types, medusa): request / response types clean-up (#9043)
More clean-up of request / response types
2024-09-09 06:59:43 +00: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
Adrien de Peretti
2c5e72d141 feat: Application types generation from project GQL schema's (#8995) 2024-09-06 15:15:32 +05:30
Riqwan Thamir
0573bb924a chore: Remove typeORM (#9005)
* chore: rename js files to txt

* chore: rename ts files to txt

* chore: delete environment helpers

* chore: convert global setup & teardown to txt

* chore: rename helper js/ts files to txt

* chore: rename seeder js/ts files to txt

* chore: remove typeorm

* chore: reintroduce used helpers
2024-09-05 15:45:30 +02:00
Riqwan Thamir
5d7179b7d0 feat(core-flows,types,promotion): register promotion campaign usage upon cart completion (#8970)
* feat(core-flows,types,promotion): register promotion campaign usage upon cart completion

* Apply suggestions from code review

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

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-09-05 10:43: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