Commit Graph

1771 Commits

Author SHA1 Message Date
chemicalkosek
5bd2faa02b docs: fix import path in medusa-react README (#2731) 2022-12-06 17:26:13 +02:00
Harsh Mangalam
da7ea8c5d4 docs: fix customer last name type (#2641) 2022-11-28 12:50:03 +02:00
olivermrbl
105c689298 chore(release): Publish 2022-11-24 11:42:04 +01:00
olivermrbl
a4d75f4a40 fix: merge conflicts with develop 2022-11-22 13:39:27 +01:00
olivermrbl
ade898d434 chore(release): Publish 2022-11-22 13:35:50 +01:00
Philip Korsholm
e7c4cc3751 fix(medusa): Separate JWT auth strategies per domain (#2646)
**What**
Separate JWT auth strategies per domain

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2022-11-22 12:30:05 +00:00
Adrien de Peretti
5d977a8f57 perf(medusa): Shipping options + TransactionBaseService initialization (#2632) 2022-11-21 08:09:18 +01:00
Oliver Windall Juhl
d7997ef256 feat(medusa): Module Resolution API (#2597) 2022-11-20 22:01:46 +01:00
Adrien de Peretti
e09f6e8a1e fix(medusa-payment-stripe): handle webhook sirialization failure (#2607) 2022-11-20 20:47:15 +01:00
Carlos R. L. Rodrigues
01a879ac94 chore: markAsAuthorized and payment collection tests (#2620)
* chore: markAsAuthorized and payment collection tests
2022-11-18 11:23:35 -03:00
Adrien de Peretti
a77780671a fix(medusa): Transaction lock issues on create/update cart items (#2612)
* fix(medusa): Transaction lock issues on create/update cart items

* fix add missing trans

* cleanup

* cleanup

* Create perfect-bears-invent.md

* cleanup

* revert draft order to no take it in that pr

* cleanup handler

* cleanup steps

* fix reference issue

* cleanup + fix tests and mock

* cleanup type

* rename file

* cleanup

* fix missing transaction

* wip

* Address pr feedback

* cleanup and fix unit tests

* fix handler

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2022-11-18 12:15:53 +01:00
Philip Korsholm
5332081972 fix(medusa, medusa-plugin-discount-generator, medusa-plugin-restock-notification): Bump Medusa package versions (#2623) 2022-11-18 10:50:13 +01:00
Frane Polić
9eafde07fe feat(medusa-js): Register PublishableApiKey (#2616)
**What**
- register a publishable API key through `medusa-js` i.e. define the key that will be sent with each request

**How**
- introduce KeyManager class which is used to share keys between medusa-js objects.

**Usage**
1. Set the key through the `Medusa` config
2. Set the key through `KeyManager` dynamically:
```ts
import { KeyManager } from "medusa-js"

KeyManager.registerPublishableApiKey("pk_123")
```

---

RESOLVES CORE-794
2022-11-17 12:19:18 +00:00
Patrick
022a84691e fix(draft-order): create tax-inclusive with discount (#2579)
**What**
Fix system error (500) with DraftOrder create operation when payload includes discount in a tax-inclusive context.

**How**
* Ensure newly created cart contains all required relation in order to calculate line item tax-inclusive pricing with discounts.
* Add resilience to TotalsService.getLineDiscounts()
* Ensure newly generate line items have variant relation loaded.
* fix TotalsService.getLineItemTotals to use the passed lineItem instead of relying on cartOrOrder.items.

**Test**
* Unit:
  *  TotalsService.getLineDiscounts - coverage
* Integration:
  * Admin API draft-order - coverage
  * Admin API draft-order create w/ discount in tax-inclusive

Resolves: CORE-771

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2022-11-16 15:34:18 +00:00
Frane Polić
03fc9e18e9 feat(medusa, medusa-js, medusa-react): PublishableApiKey "update" endpoint & add "title" property (#2609)
**What**
- update PK endpoint
  - medusa-js/react implementation
- add a title property to the entity
  - update the migration file
  - pass a title on create
  - list PKs by title
  - update the client libs with new param signatures
- change id prefix to: "pk_"
2022-11-16 04:35:22 +00:00
Carlos R. L. Rodrigues
ccfc5f666d feat(medusa-js): Add payment and payment collections clients (#2608) 2022-11-15 21:27:00 +01:00
Frane Polić
3de553c27f feat(medusa-js, medusa-react): PublishableApiKeys clients (#2582)
**What**
- add `PublishableApiKeys` endpoints to the `medusa-js` and `medusa-react` clients

--- 

RESOLVES CORE-791
DEPENDS ON https://github.com/medusajs/medusa/pull/2567
2022-11-15 15:41:58 +00:00
Carlos R. L. Rodrigues
4baa2e0149 docs: payment and payment collection OAS (#2604) 2022-11-15 14:30:47 +00:00
Adrien de Peretti
9e91a50df1 fix(medusa-payment-stripe): Missing transactions in Stripe provider (#2603) 2022-11-14 20:03:06 +01:00
Frane Polić
d0809bdf25 feat(medusa): PublishableApiKeys CRUD (#2567) 2022-11-14 19:30:24 +01:00
Adrien de Peretti
d2b1848e52 feat(medusa): Cart and totals computational optimizations (#2475) 2022-11-14 15:45:47 +01:00
Carlos R. L. Rodrigues
755ba90c05 feat(medusa): Payment Collection endpoints (#2525) 2022-11-11 18:28:45 +01:00
olivermrbl
27184f3878 Merge branch 'master' into develop 2022-11-10 19:35:57 +01:00
olivermrbl
5dcbec3788 chore(release): Publish 2022-11-10 19:31:03 +01:00
Oliver Windall Juhl
04e894ec39 hotfix(medusa-payment-stripe): Support provider specific intent options (#2581) 2022-11-10 19:28:35 +01:00
Shahed Nasser
208809b635 docs: update readme (#2587)
* docs: added features list

* docs: update readme
2022-11-10 17:52:03 +02:00
Adrien de Peretti
699bb1d57b hotfix(medusa): Deleted region are missing on order retrieval (#2583) 2022-11-10 14:44:35 +01:00
Frane Polić
aa8eba38e9 feat(medusa): PublishableAPI keys model (#2543) 2022-11-10 10:14:06 +01:00
olivermrbl
7914f2a82a chore: Version medusa-payment-stripe 2022-11-09 20:36:31 +01:00
olivermrbl
a4dd26e137 chore(release): Publish 2022-11-09 19:34:59 +01:00
olivermrbl
41fc095a3d Merge branch 'master' into develop 2022-11-09 19:32:30 +01:00
Oliver Windall Juhl
cfb24d72fa fix(medusa-telemetry): Fix incorrect import (#2574)
Duplicate of #2126
2022-11-09 16:51:37 +00:00
Shahed Nasser
884322447e docs: fixes to the API reference (#2570) 2022-11-09 18:24:48 +02:00
Patrick
7b0ceeffb4 feat: /store api product types (#2552)
## What
Allow users to fetch ProductTypes from the storefront API.

## Why
This endpoint will allow developers to implement better faceted product search in Medusa without the need for search plugin. Developers will be able to use this to render refinement lists based on types, like this:
![image](https://user-images.githubusercontent.com/116003638/200417828-863065de-3607-49db-bd72-62a6815129fa.png)

## How
Endpoint `GET /store/products/types` and `GET /store/product-types` (use [product types listing in admin](https://github.com/medusajs/medusa/blob/master/packages/medusa/src/api/routes/admin/products/list-types.ts) as reference)

Support added in @medusajs/medusa-js
Support added in medusa-react

## Testing
Similar automated tests as `GET /admin/products/types` and `GET /admin/product-types`

---

Resolves CORE-699
2022-11-09 16:10:17 +00:00
Adrien de Peretti
2d095a0ce1 fix(medusa): fix missing throw in the store cart create-payment-sessions (#2568) 2022-11-09 16:47:17 +01:00
Sebastian Rindom
8069ed5e99 fix(medusa): add support for retrying failed event bus jobs (#2566)
Closes CORE-770
2022-11-09 12:24:26 +00:00
Adrien de Peretti
129ad4b687 fix(medusa): Order/Cart decorate totals should assign the items totals (#2546)
**What**

If `total` or `subtotal` are selected then get the line item totals and assign them to the items.

I also had to remove the totals from the cart update service since they are not used and that by having them the items get the tax lines attached and since the update is performed by passing the entire cart, it is trying to insert the tax lines with the cart update

**Tests**

Add an integration tests to validate that the items includes the totals in the order and draft order

FIXES CORE-687
2022-11-07 13:54:41 +00:00
Philip Korsholm
15d6f92964 Fix(medusa): Swaps in tax inclusive regions (#2557)
**What**
- Ensure that swaps can be created for orders with discounts in tax inclusive regions

**How**
- Retrieve cart with discounts and region before creating adjustments for line items in cart. 
  - In `discountService.calculateDiscountForLineItem` we used the method `totalsService.getLineItemTotals` if a line-item is tax inclusive. This method uses some fields from the cart that aren't populated on cart creation (such a `items` which caused the original error).

**Testing**
- add integration test `swaps > tax inclusive > "Complete swap flow with discount"` that creates a swap in the following environment
  - tax inclusive region 
  - tax inclusive line item to be swapped
  - fixed type discount with allocation: total

Fixes CORE-748
2022-11-07 10:47:26 +00:00
Philip Korsholm
434b11af46 Fix(medusa): make shipping option requirements tax inclusive if the shipping option is (#2544)
**What**
- validate shipping option requirements including tax if the shipping option is tax inclusive

**Testing**
- " given a cart with total above min-threshold and subtotal below min-threshold shipping option with tax inclusive pricing is available and can be applied"
- "given a cart with total above max-threshold and subtotal below max-threshold shipping option with tax inclusive pricing is not available"

Fixes CORE-752
2022-11-04 14:04:07 +00:00
olivermrbl
4542906619 chore(release): Publish 2022-11-04 11:37:56 +01:00
Oliver Windall Juhl
222423625d chore(medusa): Enable analytics ff by default (#2532) 2022-11-04 11:33:21 +01:00
Sebastian Rindom
61da5f3650 fix(medusa-plugin-brightpearl): account for shipping prices being tax inclusive (#2536)
**What**
BP plugin was recording total shipping price based on the shipping_method.price; however, this value may be with or without taxes depending on the tax inclusivity setting. This change ensures that the shipping price is calculated correctly.
2022-11-03 15:22:49 +00:00
olivermrbl
2e553ce42a chore(medusa-payment-stripe): Add /helpers to gitignore 2022-11-03 10:24:24 +01:00
Philip Korsholm
38d4a7db3d Feat(Medusa): Allow custom shipping price on draft orders (#2531)
* create custom shipping option for cart to have custom shipping price on draft orders

* Create moody-chefs-stare.md
2022-11-03 08:44:47 +01:00
Philip Korsholm
ea3d738823 Feat(medusa): config error handling in loaders (#2514)
**What**
- add error handling when loading project config

**How**
- Add error parameter to get-medusa-config result if an error was thrown (previously we returned an empty config)
- Discussion: 
A different, but equally valid approach could be just throwing the error rather than creating an error parameter. This causes a more ugly output without warnings and changes the api a bit but it would force error handling. wdyt?

**Why**
- cli would fail with database error `databaseMissingDriverError` if config was invalid, ex. missing a comma


### example (missing `,` in config)
**old output**
```
Successfully compiled 2 files with Babel (143ms).
[medusa-config] ⚠️ redis_url not found. A fake redis instance will be used.
[medusa-config] ⚠️ database_type not found. fallback to default sqlite.
info:    Using flag MEDUSA_FF_ORDER_EDITING from environment with value true
info:    Using flag MEDUSA_FF_SALES_CHANNELS from environment with value true
info:    Using flag MEDUSA_FF_TAX_INCLUSIVE_PRICING from environment with value true
info:    Using fake Redis
✔ Models initialized – 13ms
✔ Plugin models initialized – 0ms
✔ Repositories initialized – 17ms
⠋ Initializing databaseMissingDriverError: Wrong driver: "undefined" given. Supported drivers are: "aurora-data-api", "aurora-data-api-pg", "better-sqlite3", "capacitor", "cockroachdb", "cordova", "expo", "mariadb", "mongodb", "mssql", "mysql", "nativescript", "oracle", "postgres", "react-native", "sap", "sqlite", "sqljs".
```

**new output** 
```
Successfully compiled 2 files with Babel (185ms).
error:    Error in loading config: Unexpected identifier
error:    /Users/phko/projects/community/my-medusa-store/medusa-config.js:129
  plugins,
  ^^^^^^^

SyntaxError: Unexpected identifier
    at compileFunction (<anonymous>)
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1033:15)
    at Module._compile (node:internal/modules/cjs/loader:1069:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at getConfigFile (/Users/phko/projects/community/my-medusa-store/node_modules/medusa-core-utils/dist/get-config-file.js:26:20)
```
2022-11-02 18:58:02 +00:00
olivermrbl
0b0d50b476 Merge branch 'develop' of github.com:medusajs/medusa into develop 2022-11-02 18:20:54 +01:00
Carlos R. L. Rodrigues
c3f8297599 feat(medusa): manage payment sessions from payment collection (#2402)
* feat: manage payment sessions from payment collection
2022-11-02 13:34:29 -03:00
olivermrbl
ee8a71c692 chore(release): Publish 2022-11-02 16:44:54 +01:00
Oliver Windall Juhl
684f68ce12 fix(medusa): Sales Channel migration script (#2521) 2022-11-02 13:37:46 +01:00
Frane Polić
591668d332 fix(medusa): draft order set payment as captured (#2479)
**What**
- when an order is created from a draft order, set the payment of the order as captured

FIXES CORE-592
2022-10-31 12:24:59 +00:00