Commit Graph

809 Commits

Author SHA1 Message Date
Adrien de Peretti
0f1566c644 feat(): Add support for store locales end point (#14307)
**What**
Add support for `store/locales` which return the configured supported locales
2025-12-15 13:10:43 +00:00
Nicolas Gorga
8964a03fa1 chore(): Remove default_locale from StoreLocale (#14300)
## Summary

**What** — What changes are introduced in this PR?

Remove `default_locale` from Store <> Locale relation

**Why** — Why are these changes relevant or necessary?  

*Please provide answer here*

**How** — How have these changes been implemented?

*Please provide answer here*

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

*Please provide answer here*

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage
```

---

## Checklist

Please ensure the following before requesting a review:

- [ ] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [ ] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.


Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-12-15 09:05:46 +00:00
Nicolas Gorga
dd3eb10b1a fix(link-modules): export store locale link definition (#14293)
## Summary

**What** — What changes are introduced in this PR?

Export missing store locale link definition.

**Why** — Why are these changes relevant or necessary?  

*Please provide answer here*

**How** — How have these changes been implemented?

*Please provide answer here*

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

*Please provide answer here*

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage
```

---

## Checklist

Please ensure the following before requesting a review:

- [ ] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [ ] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.
2025-12-14 11:15:44 +00:00
Carlos R. L. Rodrigues
9366c6d468 feat: order export and upload stream (#14243)
* feat: order export

* Merge branch 'develop' of https://github.com/medusajs/medusa into feat/order-export

* normalize status

* rm util

* serialize totals

* test

* lock

* comments

* configurable order list
2025-12-14 12:02:53 +01:00
Carlos R. L. Rodrigues
e199f1eb01 fix(index): detect enum field (#14298)
## Summary

**What** — What changes are introduced in this PR?

Fixes Enum fields detection on Index module
2025-12-13 20:35:07 +00:00
Shahed Nasser
a4ca4ef170 fix(translation): add index file for models (#14272) 2025-12-12 10:10:16 +01:00
Adrien de Peretti
f13c23a4b7 feat(): Sync order translations (#14267)
* feat(): Sync order translations

* feat(): Sync order translations

* tests

* Create tender-melons-develop.md

* fix tests

* cleanup

* cleanup
2025-12-11 15:40:11 +01:00
olivermrbl
237b472e73 chore: Version packages 2025-12-11 14:10:54 +01:00
Adrien de Peretti
9852a7c74d fix(): Improve store currency readonly link (#14276)
* fix(): Improve store currency readonly link

* fix(): Improve store currency readonly link

* fix(): Improve store currency readonly link

* Create wicked-rabbits-sparkle.md
2025-12-11 10:47:44 +01:00
Adrien de Peretti
d7398736e8 fix(): Improve store supported locale -> locale readonly link (#14269)
* fix(): store supported locales read only link

* fix(): store supported locales read only link

* Create two-books-reply.md

* remove unnecessary links

* remove unnecessary links

* remove unnecessary links

* fix(): store supported locales read only link

* fix(): store supported locales read only link

* improve link
2025-12-11 10:00:12 +01:00
Nicolas Gorga
8bd1d22765 chore(order): Remove unique index on item_id:version for order_item (#14268)
* Remove unique index

* Add changeset

* Remove previous migration file

* Remove down method
2025-12-10 13:51:08 +01:00
Adrien de Peretti
e4877616c3 feat(): sync cart translation synced (#14226)
ref: https://github.com/medusajs/medusa/pull/14189

  **Summary**

  This PR extends the translation module to support automatic translation syncing for cart line items based on the cart's locale.

  Key changes:
  - Added locale field to the Cart model to store the cart's locale preference
  - Created new workflow steps:
    - getTranslatedLineItemsStep - Translates line items when adding to cart or creating a cart
    - updateCartItemsTranslationsStep - Re-translates all cart items when the cart's locale changes
  - Integrated translation logic into cart workflows:
    - createCartWorkflow - Applies translations to initial line items
    - addToCartWorkflow - Applies translations when adding new items
    - updateCartWorkflow - Re-translates all items when locale_code is updated
    - refreshCartItemsWorkflow - Maintains translations during cart refresh
  - Added applyTranslationsToItems utility to map variant/product/type/collection translations to line item fields (title, subtitle, description, etc.)
2025-12-10 08:37:30 +00:00
Adrien de Peretti
356283c359 chore(): Accept an extra agument 'all-or-nothing' on the migrate command (#14262)
* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* Create rich-camels-brush.md

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): fix broken down migrations

* chore(): update changeset
2025-12-10 09:23:41 +01:00
Adrien de Peretti
bff0142e7a chore(): Move event bus local logging (#14244)
**what**
Log only when actually processing events
2025-12-09 18:27:38 +00:00
Adrien de Peretti
6dc0b8bed8 feat(): Introduce translation module and preliminary application of them (#14189)
* feat(): Translation first steps

* feat(): locale middleware

* feat(): readonly links

* feat(): feature flag

* feat(): modules sdk

* feat(): translation module re export

* start adding workflows

* update typings

* update typings

* test(): Add integration tests

* test(): centralize filters preparation

* test(): centralize filters preparation

* remove unnecessary importy

* fix workflows

* Define StoreLocale inside Store Module

* Link definition to extend Store with supported_locales

* store_locale migration

* Add supported_locales handling in Store Module

* Tests

* Accept supported_locales in Store endpoints

* Add locales to js-sdk

* Include locale list and default locale in Store Detail section

* Initialize local namespace in js-sdk

* Add locales route

* Make code primary key of locale table to facilitate upserts

* Add locales routes

* Show locale code as is

* Add list translations api route

* Batch endpoint

* Types

* New batchTranslationsWorkflow and various updates to existent ones

* Edit default locale UI

* WIP

* Apply translation agnostically

* middleware

* Apply translation agnostically

* fix Apply translation agnostically

* apply translations to product list

* Add feature flag

* fetch translations by batches of 250 max

* fix apply

* improve and test util

* apply to product list

* dont manage translations if no locale

* normalize locale

* potential todo

* Protect translations routes with feature flag

* Extract normalize locale util to core/utils

* Normalize locale on write

* Normalize locale for read

* Use feature flag to guard translations UI across the board

* Avoid throwing incorrectly when locale_code not present in partial updates

* move applyTranslations util

* remove old tests

* fix util tests

* fix(): product end points

* cleanup

* update lock

* remove unused var

* cleanup

* fix apply locale

* missing new dep for test utils

* Change entity_type, entity_id to reference, reference_id

* Remove comment

* Avoid registering translations route if ff not enabled

* Prevent registering express handler for disabled route via defineFileConfig

* Add tests

* Add changeset

* Update test

* fix integration tests, module and internals

* Add locale id plus fixed

* Allow to pass array of reference_id

* fix unit tests

* fix link loading

* fix store route

* fix sales channel test

* fix tests

---------

Co-authored-by: Nicolas Gorga <nicogorga11@gmail.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-12-08 19:33:08 +01:00
Frane Polić
6176f93ac5 fix(dashboard,order): preview pending diff summary (#14221)
* wip: preview pending diff summary

* fix: return test

* fix: rm return calc from processAction_

* chore: cleanup

* chore: changeset

* feat: add estimated diff for return,claim,exchange forms

* chore: changeset
2025-12-08 09:57:13 +01:00
Adrien de Peretti
fe49b567d6 chore: Backend HMR (expriemental) (#14074)
**What**

 This PR introduces experimental Hot Module Replacement (HMR) for the Medusa backend, enabling developers to see code changes reflected immediately without restarting the server. This significantly improves the development experience by reducing iteration time.

### Key Features

  - Hot reload support for:
    - API Routes
    - Workflows & Steps
    - Scheduled Jobs
    - Event Subscribers
    - Modules
  - IPC-based architecture: The dev server runs in a child process, communicating with the parent watcher via IPC. When HMR fails, the child process is killed and restarted, ensuring
  clean resource cleanup.
  - Recovery mechanism: Automatically recovers from broken module states without manual intervention.
  - Graceful fallback: When HMR cannot handle a change (e.g., medusa-config.ts, .env), the server restarts completely.


### Architecture
```mermaid
  flowchart TB
      subgraph Parent["develop.ts (File Watcher)"]
          W[Watch Files]
      end

      subgraph Child["start.ts (HTTP Server)"]
          R[reloadResources]
          R --> MR[ModuleReloader]
          R --> WR[WorkflowReloader]
          R --> RR[RouteReloader]
          R --> SR[SubscriberReloader]
          R --> JR[JobReloader]
      end

      W -->|"hmr-reload"| R
      R -->|"hmr-result"| W
```

### How to enable it

Backend HMR is behind a feature flag. Enable it by setting:

```ts
  // medusa-config.ts
  module.exports = defineConfig({
    featureFlags: {
      backend_hmr: true
    }
  })
```

or

```bash
export MEDUSA_FF_BACKEND_HMR=true
```

or

```
// .env
MEDUSA_FF_BACKEND_HMR=true
```

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-12-08 08:48:36 +00:00
Adrien de Peretti
144f0f4e2e chore(event-bus, workflow-engine): Enable more granualar queues configuration (#14201)
Summary

  This PR adds BullMQ queue and worker configuration options to the workflow-engine-redis module, bringing feature parity with the event-bus-redis module. It also introduces per-queue
  configuration options for fine-grained control over the three internal queues (main, job, and cleaner).

  Key changes:
  - Added per-queue BullMQ configuration options (mainQueueOptions, jobQueueOptions, cleanerQueueOptions and their worker counterparts) with shared defaults
  - Unified Redis option naming across modules: deprecated url → redisUrl, options → redisOptions (with backward compatibility)
  - Moved configuration resolution to the loader and registered options in the DI container
  - Added comprehensive JSDoc documentation for all configuration options
  - Added unit tests for option merging and queue/worker configuration

  Configuration Example

```ts
  // Simple configuration - same options for all queues
  {
    redisUrl: "redis://localhost:6379",
    queueOptions: { defaultJobOptions: { removeOnComplete: 1000 } },
    workerOptions: { concurrency: 10 }
  }
```

```ts
  // Advanced configuration - per-queue overrides
  {
    redisUrl: "redis://localhost:6379",
    workerOptions: { concurrency: 10 },        // shared default
    jobWorkerOptions: { concurrency: 5 },      // override for scheduled workflows
    cleanerWorkerOptions: { concurrency: 1 }   // override for cleanup (low priority)
  }
```
2025-12-05 12:03:12 +00:00
Pedro Guzman
56ed9cf9f7 fix S3 URL escaping (#14220) 2025-12-04 22:03:17 +01:00
Pedro Guzman
b7adfb225b fix: escape non-ascii characters in filenames in s3 file provider (#14209)
* escape non-ascii characters in filenames in s3 file provider

* fix url encoding
2025-12-04 18:37:56 +01:00
Carlos R. L. Rodrigues
5b7e3c0e76 chore: configurable database migration in concurrency (#14004)
> [!NOTE]
> Adds a configurable concurrency for link migrations (CLI/commands), forces concurrency=1 when pgstream is detected, and ignores duplicate link-table inserts.
> 
> - **CLI**
>   - Add `--concurrency` option to `db:migrate` and `db:sync-links`.
> - **Medusa commands**
>   - `migrate` and `sync-links` accept `concurrency`; set `DB_MIGRATION_CONCURRENCY` and force `1` when `pgstream` schema exists via new `isPgstreamEnabled`.
> - **Link Modules (migrations)**
>   - Execute plan actions with `executeWithConcurrency` using `DB_MIGRATION_CONCURRENCY`.
>   - Make link-table tracking inserts idempotent with `ON CONFLICT DO NOTHING` (including bulk/upsert and per-create).
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 07432293c8fe8de30b07920fa47823b9081edacc. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2025-12-04 11:30:30 +00:00
olivermrbl
ba275a33bb chore: Version packages 2025-12-03 09:20:02 +01:00
Nicolas Gorga
ef162f8b5f fix(order): Add composite unique index on order_item version:item_id (#14164)
* Unique index on order_item version:item_id

* Add changeset
2025-12-02 08:55:25 -03:00
Shahed Nasser
92769b2b1c chore: fixes to TSDocs (#14186)
* chore: fixes to TSDocs

* update comments for auth provider
2025-12-02 11:57:04 +02:00
olivermrbl
1d4af32749 chore: Version packages 2025-12-01 18:54:07 +01:00
Frane Polić
8ddf8b4d76 fix: skip promotion usage limit checks on edit flows (#14176)
* fix: skip promotion usage limit checks on edit flows

* feat: add test check
2025-12-01 18:29:15 +01:00
Adrien de Peretti
0f835381e9 fix(product): Update performance issue (#14150)
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-12-01 16:45:18 +01:00
Shahed Nasser
3cf1e5e9de chore: change 2.11.4 to 2.12.0 in TSDocs (#14174) 2025-12-01 17:33:28 +02:00
Frane Polić
b74ef4a784 fix(fulfillment): make relationship between SO and SO type M:1 (#14061)
* fix(fulfillment): make relationship between SO and SO type M:1

* fix: test and types, remap type id to existing column

* Fix typo

* Fix typo

* chore: update changeset

* fix: typo

---------

Co-authored-by: Nicolas Gorga <62995075+NicolasGorga@users.noreply.github.com>
2025-12-01 16:16:29 +01:00
Pepijn
6bc5bf4fc9 Fix not in promotion rule empty value validation (#14172) 2025-12-01 15:04:57 +01:00
Shahed Nasser
73ae136965 chore: improve and add TSDocs for next release (#14170) 2025-12-01 13:41:31 +02:00
Frane Polić
536a3f802c feat: promotion usage limit (#13760)
* feat: promotion usage limit

* fix: update, refactor tests, parallel case

* fix: batch update, cleanup unused map

* feat: paralel campaign and promotion tests

* chore: changesets, fix i18 schema

* fix: ui tweaks

* chore: refactor

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-11-30 19:43:36 +01:00
Frane Polić
5da51064d7 feat: carry over promotions toggle on exchanges (#14128)
* feat: carry over promotions toggle on exchanges

* fix: inital flag value, return the flag on preview

* fix: validation of allocation type

* fix: revert client changes

* fix: invert condition

* feat: recompute adjustments when outbound item is updated

* fix: condition again

* fix: display more accurate inbound/outbound totals for exchanges

* fix: make exchanges specs green

* feat: more testing cases

* wip: pr feedback

* fix: use plural for the flag on Admin

* fix: schema test, route refactor

* feat: tooltip

* feat: refactor to use update workflow

* feat: display applied promotion per item on order details, show copy sku on hover

* feat: refactor edits and exchanges to have common flag toggle flow

* fix: delete empty file

* fix: exchange_id param query
2025-11-30 19:31:31 +01:00
Adrien de Peretti
91499081f4 chore(): Promotion auto managed joiner config (#14115)
* chore(): Promotion auto managed joiner config

* Create light-trainers-tie.md

* chore(): align tests expectactions
2025-11-27 12:45:17 +01:00
Oli Juhl
78842af1c3 fix: Compute "virtual" adjustments for order previews (#13306)
* wip

* add wip

* wip

* reuse action

* finish first draft

* fix tests

* cleanup

* Only compute adjustments when necessary

* Create hot-carrots-look.md

* address comments

* minor tweaks

* fix pay col

* fix test

* wip

* Dwip

* wip

* fix: adjustment typo

* fix: import

* fix: workflow imports

* wip: update test

* feat: upsert versioned  adjustments when previewing order

* fix: revert unique codes change

* fix: order spec test with versioning

* wip: save

* feat: make adjustments work for preview and confirm flow, wip base repo filtering of older version adjustments

* fix: missing populate where

* wip: populate where loading versioned adjustments

* fix: filter out older adjustment versions

* temp: comment adjustments in repo

* test: add adjustment if no version

* wip: configure populate where in order base repository

* fix: rm manual filtering

* fix: revert base repo changes

* fix: revert

* fix: use order item version instead of order version

* fix: rm only in test

* fix: update case spec

* fix: remove sceanrio, wip test with draft promotion

* feat: test correct adjustments when disabling promotion

* feat: complex test case

* feat: test consecutive order edits

* feat: 2 promotions test case with a fixed promo

* feat: migrate existing order line item adjustments to order items latest version

* feat: update dep after merge

* wip: load adjustments separatley

* feat: adjustments collections

* fix: spread result, handle related entity case

* fix: update lock

* feat: make sure version is loaded, refactor, handle related entity case

* fix: check fields

* feat: loading adjustments for list and count

* fix: correct items version field

* fix: rm empty array

* fix: wip order modules spec

* fix: order module specs

* feat: preinit items adjustments

* fix: rm only

* fix: rm only

* chore: cleanup

* fix: migration files

* fix: dont change formatting

* fix: core package build

* chore: more cleanup

* fix: item update util

* fix: duplicate import

* fix: refresh adjustments for exchanges (#13992)

* wip: exchange adjustments

* feat: test - receive items

* feat: finish test case

* fix: casing

* fix(draft-orders, core-flows, orders) refresh adjustments for draft orders (#14025)

* wip: draft orders adjustments refresh

* feat: rewrite to use REPLACE action + test

* fix: rm only

* feat: cleanup old REPLACE actions

* feat: cleanup adjustemnts when 0 promotions

* wip: canceling draft order

* fix: make version arg optional

* fix: restore promotion links

* feat: test reverting on cancelation

* fix: address comments in tests

* wip: fix summary on preview

* fix: get pending diff on preview summary from total

* fix: revert pending diff change

---------

Co-authored-by: fPolic <mainacc.polic@gmail.com>
Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com>
2025-11-25 10:41:14 +01:00
Shahed Nasser
0ddd9e36b5 fix(product): add missing decorators to updateProductOptionValues method (#14060) 2025-11-25 11:02:21 +02:00
Pedro Guzman
b81f958d41 Add provider data to notifications (#14104)
## Summary

**What** —
Add a providerData field to notifications

**Why** —
We need the ability to pass dynamic fields to specific providers. E.g. CC and BCC for emails

**How** —
Just adding the field to the model

**Testing** —
Added the field to existing tests

## Checklist

Please ensure the following before requesting a review:

- [x] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [x] The changes are covered by relevant **tests**
- [x] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable



---

> [!NOTE]
> Adds `provider_data` to notifications (types, workflow input, DB model/migration) and forwards it in the Medusa Cloud Email provider, with tests updated accordingly.
> 
> - **Data/Schema**:
>   - Add `provider_data` (`jsonb`) to `notification` model and DB via migration `Migration20251121150408` and snapshot update.
> - **Types/DTOs**:
>   - Add optional `provider_data` to `CreateNotificationDTO`, `NotificationDTO`, and `ProviderSendNotificationDTO`.
> - **Workflows**:
>   - Extend `send-notifications` step input with `provider_data`.
> - **Providers**:
>   - Medusa Cloud Email: include `provider_data` in outgoing request payload.
> - **Tests**:
>   - Update integration tests to pass and assert `provider_data` propagation.
> - **Changeset**:
>   - Patch bumps for `@medusajs/notification`, `@medusajs/core-flows`, `@medusajs/types`.
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 6f114c75c974a145ef60213637d7c41bc605a0bf. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2025-11-24 09:18:47 +00:00
Adrien de Peretti
113f200a99 chore(event-bus-*): Do not emit if no subscribers: (#14084)
* chore(event-vus-*): Do not emit if no subscribers:

* Create curly-apricots-double.md

* add tests

* align tests
2025-11-24 09:36:52 +01:00
Adrien de Peretti
6c3ec528f1 fix(): Workflow engine redis worker instance in worker mode (#14099)
* fix(): Workflow engine redis worker instance in worker mode

* Create wicked-tips-buy.md
2025-11-24 09:31:36 +01:00
Pedro Guzman
f67bfb9f92 add from to notification model (#14102) 2025-11-24 09:24:38 +01:00
Angel Leonardo Banderas Larios
3a1ed74839 feat(payment-stripe): OXXO payment provider support with configurable expiration (#13805)
## Summary

**What** — What changes are introduced in this PR?

This pull request adds support for OXXO payments to the Stripe payment provider module. The main changes include the addition of a new `OxxoProviderService`, updates to type definitions to support OXXO-specific options, and integration of the new service into the provider's exports and registration.

**Why** — Why are these changes relevant or necessary?  
I was testing the MedusaJs server, I live in México and here oxxo as a Payment method is very used.


**How** — How have these changes been implemented?

* Introduced `OxxoProviderService` in `stripe-oxxo.ts`, which extends `StripeBase` and configures Stripe payment intents for OXXO, including expiration settings.
* Updated `StripeOptions` and `PaymentIntentOptions` types to include `oxxoExpiresDays` and OXXO-specific payment method options for intent configuration.
* Added `OXXO` to the `PaymentProviderKeys` enum for provider identification.

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

You need to launch the medusa server, add Stripe OXXO as Payment Provider in your Store Region (OXXO only works in México and with mxn currency) and set payment_method_data type to oxxo.

Also you need to allow oxxo payment as payment method in stripe and configure your stripe webhook to your medusa server

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage using nextjs starter

const confirmParams: any = {
      return_url: returnUrl,
    }

    if (isOxxo(providerId)) {
      confirmParams.payment_method_data = {
        type: "oxxo",
        billing_details: {
          name:
            cart.billing_address?.first_name +
            " " +
            cart.billing_address?.last_name,
          address: {
            city: cart.billing_address?.city ?? undefined,
            country: cart.billing_address?.country_code ?? undefined,
            line1: cart.billing_address?.address_1 ?? undefined,
            line2: cart.billing_address?.address_2 ?? undefined,
            postal_code: cart.billing_address?.postal_code ?? undefined,
            state: cart.billing_address?.province ?? undefined,
          },
          email: cart.email,
          phone: cart.billing_address?.phone ?? undefined,
        },
      }

      await stripe
        .confirmPayment({
          clientSecret,
          confirmParams,
          redirect: "if_required",
        })
        .then(({ error, paymentIntent }) => {
          console.log({ error, paymentIntent })
          const validateIntent = async (paymentIntent: any) => {
            const link =
              paymentIntent.next_action?.oxxo_display_details
                ?.hosted_voucher_url
            if (link) {
              setSubmitting(false)
              setMessage(
                "Se ha generado un cupón de pago de OXXO. Por favor, revisa la nueva pestaña abierta."
              )
              await onPaymentCompleted() // Here I call the function because I have custom logic for creating a pending order
            }
          }

          if (error) {
            const pi = error.payment_intent

            if (
              (pi && pi.status === "requires_capture") ||
              (pi && pi.status === "succeeded")
            ) {
              onPaymentCompleted()
            }

            if (pi && pi.status === "requires_action") {
              validateIntent(pi)
              return
            }

            setErrorMessage(error.message || null)
            setSubmitting(false)
            return
          }

          if (
            (paymentIntent && paymentIntent.status === "requires_capture") ||
            (paymentIntent && paymentIntent.status === "succeeded")
          ) {
            return onPaymentCompleted()
          }

          if (paymentIntent && paymentIntent.status === "requires_action") {
            validateIntent(paymentIntent) // This is the action that you normally get
          }
        })
    }
}


// Configuration on the server  (medusa-config.ts)
modules: [
    {
      resolve: "@medusajs/medusa/payment",
      options: {
        providers: [
          {
            resolve: "@medusa/payment-stripe",
            id: "stripe",
            options: {
              apiKey: process.env.STRIPE_API_KEY,
              webhookSecret: process.env.STRIPE_WEBHOOK_SECRET,
              capture: true,
              oxxoExpiresDays: 7, // default to 3
            },
          },
        ],
      },
    },
  ],

// And not necessary buy you can extend even more creating a pending-orders module (for showing the vouchers created that costumer need to pay in the frontend, because if not the order only creates after the user have payed the voucher, for testing is 3 minutes), this is an example model:

import { model } from "@medusajs/framework/utils";

export const PendingOrder = model.define("pending_order", {
  id: model.id().primaryKey(),
  cart_id: model.text().unique(),
  user_id: model.text(),
  total: model.number(),
  payment_type: model.text(),
  voucher_url: model.text().nullable(),
  payment_session_id: model.text(), // this are the ones that works to identify the payment
  payment_collection_id: model.text(), // this are the ones that works to identify the payment
});
export default PendingOrder;

```

---

## Checklist

Please ensure the following before requesting a review:

- [x] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [x] The changes are covered by relevant **tests**
- [x] I have verified the code works as intended locally
- [x ] I have linked the related issue(s) if applicable

---

## Additional Context

#13804 


---

> [!NOTE]
> Adds OXXO payment support to the Stripe provider with configurable expiration days and updates intent option handling and typings.
> 
> - **Payment Providers**:
>   - **New `OxxoProviderService`** (`services/stripe-oxxo.ts`): configures `payment_intent` for OXXO with `expires_after_days` (defaults to `3`, configurable via `options.oxxoExpiresDays`).
>   - Registered in `src/index.ts` and exported from `services/index.ts`.
> - **Types**:
>   - `StripeOptions` adds `oxxoExpiresDays`.
>   - `PaymentIntentOptions` adds `payment_method_options.oxxo.expires_after_days`.
>   - `PaymentProviderKeys` adds `OXXO`.
> - **Core**:
>   - `core/stripe-base.ts`: `normalizePaymentIntentParameters` now falls back to `this.paymentIntentOptions.payment_method_options` when not provided in `extra`.
> - **Changeset**:
>   - Patch release for `@medusajs/payment-stripe`.
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4d7fe0658b91e6948f011a73d77a6281c85cdd26. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>


Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com>
2025-11-18 16:21:44 +00:00
Adrien de Peretti
62d103b44f fix(payment): Double idempotent capture called with auto capture beha… (#14073)
* fix(payment): Double idempotent capture called with auto capture behaviour

* Create sweet-peaches-dress.md

* naming

* feedback

* naming
2025-11-18 10:50:50 +01:00
Adrien de Peretti
6746fecd72 chore(order): custom display id (#14024)
* chore(order): Accept a custom display generator option

* chore(order): Accept a custom display generator option

* wip

* wip

* finalize

* Create tricky-olives-battle.md

* fields

* changeset

* update integration tests

* update migrations

* fix changeset
2025-11-18 10:17:46 +01:00
juanzgc
ef15868ca8 feat(promotion): Add metadata column to promotion (#13999)
* feat(promotion): Add metadata column to promotion

Add metadata column to the promotion model.

Closes CORE-1276

* Add changeset

---------

Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com>
2025-11-17 19:50:57 +01:00
Adrien de Peretti
1ea932a56f fix(): Identify step that should require a save on checkpoint (#14037)
* fix(): Identify step that force save checkpoint

* Create sour-peas-provide.md
2025-11-17 12:47:57 +01:00
Adrien de Peretti
e59cdae336 fix(): Proper schema usage when running migrations (#14036)
* fix(): Proper schema usage when running migrations

* Create thick-pugs-dance.md
2025-11-12 15:56:50 +01:00
Shahed Nasser
a85778679e fix(product, types): add missing types for variant images and thumbnails (#14026)
## Summary

**What** — What changes are introduced in this PR?

- Add missing `images` field of variants to the HTTP types
- Add missing `thumbnail` field to product variant schema, which leads to the thumbnail missing from auto generated types

**Why** — Why are these changes relevant or necessary?  

*Please provide answer here*

**How** — How have these changes been implemented?

*Please provide answer here*

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

*Please provide answer here*

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage
```

---

## Checklist

Please ensure the following before requesting a review:

- [ ] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [ ] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.
2025-11-11 15:25:39 +00:00
github-actions[bot]
645266c200 chore: Version Packages (#13923)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-05 12:52:44 +01:00
Adrien de Peretti
9d9d0397a8 fix(): Index integration tests flackyness (#13953)
* fix(): Index integration tests flackyness

* fix

* Create twenty-eels-remain.md

* fix

* fix

* fix

* fix

* finalize

* finalize

* finalize

* finalize

* finalize

* finalize

* chore: empty commit

* finalize

* finalize

* chore: empty commit

* finalize

* finalize
2025-11-05 10:40:12 +01:00
Adrien de Peretti
afb40d437b chore(): Cleanup and organize deps (#13940)
* chore(): Cleanup and organize deps

* chore(): Cleanup and organize deps

* chore(): Cleanup and organize deps

* chore(): Cleanup and organize deps

* chore(): Cleanup and organize deps

* chore(): Cleanup and organize deps

* Create lucky-poets-scream.md

* chore(): Cleanup and organize deps

* chore(): Cleanup and organize deps

* chore(): Cleanup and organize deps

* chore(): Cleanup and organize deps

* dedupe snapshot this build

* split into 4 shard

* re configure packages integration tests

* re configure packages integration tests

* re configure packages integration tests

* re configure packages integration tests

* update scripts

* update scripts

* update scripts

* update scripts

* update scripts

* update scripts

* update scripts

* update scripts

* reduce shard for packages
2025-11-03 19:06:37 +01:00