Commit Graph

159 Commits

Author SHA1 Message Date
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
olivermrbl
237b472e73 chore: Version packages 2025-12-11 14:10:54 +01: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
olivermrbl
ba275a33bb chore: Version packages 2025-12-03 09:20:02 +01:00
olivermrbl
1d4af32749 chore: Version packages 2025-12-01 18:54:07 +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
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
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
Adrien de Peretti
37563987b8 chore(): Fix dependencies (#13932) 2025-11-02 17:46:46 +01:00
Adrien de Peretti
224ab39a81 chore(): Update dependencies usage (#13910)
* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* fix for wxios 1.6

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* push scripts

* update build concurrency

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* chore(): Update dependencies usage

* fixes

* update yarn

* fixes

* fix script

* Create heavy-suns-tickle.md

* update changeset

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-10-31 16:44:14 +01:00
github-actions[bot]
31b9ae3d28 chore: Version Packages (#13853)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-31 10:11:18 +01:00
Stevche Radevski
ef7b9b9375 feat: Implement medusa payments provider (#13772)
* feat: Implement medusa payments provider

* chore: Improvements after testing

* chore: Add typings to medusa payments

* fix: Final changes to complete medusa payment provider

* update package

* fix: Final changes to complete medusa payment provider

---------

Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-10-29 15:07:33 +01:00
github-actions[bot]
6e73f8b376 chore: Version Packages (#13800)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-25 21:52:10 +02:00
Nathan John
17fb3e2e10 feat(payment-stripe): merge custom metadata along with session_id on payment initiation (#13801)
* Merge custom metadata along with session_id on payment initiation

* update changeset
2025-10-21 13:35:13 -04:00
github-actions[bot]
e47f0d0271 chore: Version Packages (#13545)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-21 09:24:59 +02:00
Adrien de Peretti
51859c38a7 chore(): Default caching configuration and gracefull redis error handling (#13663)
* chore(): Default caching configuration and gracefull redis error handling

* Create odd-moons-crash.md

* chore(): Default caching configuration and gracefull redis error handling

* fixes

* address feedback

* revert(): Test utils imit module fix

* reconnect

* reconnect

* reconnect
2025-10-06 17:57:11 +02:00
William Bouchard
bb08edd41f fix(medusa,file-local,file-s3,core-flows): fix csv parsing special characters (#13649)
* fix(): fix csv parsing special characters

* remove other tries

* tweak

* remove comments

* Create rude-mirrors-hang.md
2025-10-02 08:24:18 -04:00
Adrien de Peretti
b9d6f73320 Feat(): distributed caching (#13435)
RESOLVES CORE-1153

**What**
- This pr mainly lay the foundation the caching layer. It comes with a modules (built in memory cache) and a redis provider.
- Apply caching to few touch point to test

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-09-30 16:19:06 +00:00
Shahed Nasser
0c7cbfb2e7 feat(payment-stripe): Allow passing shared payment token in Stripe (#13632)
* feat(@medusajs/payment-stripe): Allow passing shared payment token in Stripe

* fix changeset
2025-09-30 18:40:36 +03:00
William Bouchard
5346079d47 chore(): create default refund reasons (#13591)
* chore(): create default refund reasons

* Create great-donuts-swim.md

* woops

* woopsie

* woopsie

* tests

* tests

* woopsie

* fml

* fix: comment
2025-09-28 10:07:48 +02:00
kusonsaelee
9fc32ba7c7 fix(stripe): add StripePromptPayService to Stripe module provider (#13572)
* fix(stripe): add StripePromptPayService to Stripe module provider

* Add changeset for StripePromptPayService fix
2025-09-22 15:46:56 -04:00
Adrien de Peretti
12a96a7c70 chore(): Move peer deps into a single package and re export from framework (#13439)
* chore(): Move peer deps into a single package and re export from framework

* WIP

* update core packages

* update cli and deps

* update medusa

* update exports path

* remove analyze

* update modules deps

* finalise changes

* fix yarn

* fix import

* Refactor peer dependencies into a single package

Consolidate peer dependencies into one package and re-export from the framework.

* update changeset

* Update .changeset/brown-cows-sleep.md

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

* rm deps

* fix deps

* increase timeout

* upgrade version

* update versions

* update versions

* fixes

* update lock

* fix missing import

* fix missing import

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-09-22 18:36:22 +02:00
Adrien de Peretti
8ece06d8ed chore(): upgrade mikro orm (#13450) 2025-09-19 21:39:18 +02:00
William Bouchard
0695c5844f fix(auth-emailpass): better handle identity with same email error (#13537)
* fix(auth-emailpass): better handle identity with same email error

* add test

* Create blue-laws-argue.md

* check for empty object

* trueeee

* nit

* flip condition
2025-09-18 13:05:54 -04:00
github-actions[bot]
174b5b1cb7 chore: Version Packages (#13494)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-18 18:38:07 +02:00
github-actions[bot]
6525ac5c1c chore: Version Packages (#13354)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-12 15:42:43 +02:00
Adrien de Peretti
0b55295fc7 Revert "chore(): Upgrade mikro orm (#13390)" (#13449)
This reverts commit a095245d71.
2025-09-09 20:06:31 +02:00
Adrien de Peretti
a095245d71 chore(): Upgrade mikro orm (#13390)
* chore(): Upgrade mikro orm

* handle 'null' value for big number props

* 6.5.2

* remove only

* fix pricing module rule value

* switch select in strategy for balances

* revert to select in strategy for order module

* fix defining DML ManyToOne

* fix define relationship

* test fix

* more fixes

* change order strategy to balanced

* change order strategy to balanced

* prevent unnecessary manager fork

* revert generated www changes

* remove unnecessary changes

* Create real-cobras-deny.md

* address feedback

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-09-08 21:10:44 +02:00
github-actions[bot]
6dca59d0a5 chore: Version Packages (#13338)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-28 22:58:13 +02:00
github-actions[bot]
08ec3ed9f2 chore: Version Packages (#13209)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-28 17:25:32 +02:00
Carlos R. L. Rodrigues
83d2ce762c chore(locking-redis): default ttl to acquire lock (#13221)
* chore(locking-redis): default ttl to acquire lock

* ttl only for the method execute
2025-08-15 11:44:24 -03:00
github-actions[bot]
01fa17d2ad chore: Version Packages (#13045)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-14 13:23:45 +02:00
github-actions[bot]
137ea0883d chore: Version Packages (#12924)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-24 09:41:35 +02:00
github-actions[bot]
b7aa719540 chore: Version Packages (#12883)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-08 19:49:15 +02:00
Adrien de Peretti
2f70f13351 fix(): Order constraint and receive return (#12889)
**What**
- Fix missing `ON DELETE CASCADE` constraint on order credit lines
- Fix `receiveReturn` miss usage
- Make all order integration tests to run and rename them all to `*.spec.ts`
- Fix package.json typo
2025-07-04 12:59:50 +00:00
github-actions[bot]
22396134b3 chore: Version Packages (#12832)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-30 16:16:24 +02:00
Harminder Virk
10dff3e266 fix: do not apply prefix when getting file contents as buffer or stream (#12831)
* fix: do not apply prefix when getting file contents as buffer or stream

* Create spotty-mayflies-bathe.md
2025-06-26 13:58:17 +05:30
github-actions[bot]
628e8d22ee chore: Version Packages (#12691)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-25 11:41:13 +02:00
Adrien de Peretti
d517dbd66a feat(): Add support for jwt asymetric keys (#12813)
* feat(): Add support for jwt asymetric keys

* Create early-chefs-chew.md

* fix unit tests

* Add verify options support

* feedback

* fix unit tests
2025-06-25 10:29:32 +02:00
Stevche Radevski
c0807f5496 fix: Allow setting the status of a payment session when updating (#12809) 2025-06-24 13:15:10 +02:00
Stevche Radevski
b116f75fbf fix(payment): Return and set the correct status when a session is created with stripe (#12769) 2025-06-21 20:36:58 +02:00
Stevche Radevski
a7a264b13c fix: Add missing partially funded event handler for Stripe (#12763) 2025-06-18 16:23:13 +02:00
Stevche Radevski
5856963e0b feat: Normalize payment method data and options when passed to Stripe (#12757) 2025-06-18 09:23:42 +02:00
Harminder Virk
f2cb528a56 feat: wire up direct uploads with local file provider (#12643) 2025-06-10 15:07:54 +05:30
github-actions[bot]
68a796d300 chore: Version Packages (#12583)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-05 20:33:53 +02:00
Harminder Virk
791276e80f feat: introduce bulkDelete method for IFileProvider (#12614)
Fixes: FRMW-2974

Currently during the product imports, we create multiple chunks that must be deleted after the import has finished (either successfully or with an error). Deleting files one by one leads to multiple network calls and slows down everything.

The `bulkDelete` method deletes multiple files (with their fileKey) in one go
2025-05-27 06:52:11 +00:00
github-actions[bot]
5ad3615830 chore: Version Packages (#12576)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-05-22 14:04:27 +02:00
Harminder Virk
d9fdabe96d fix: mark posthog-node as a peer dependency (#12539)
Since the runtime of the `@medusajs/analytics-posthog` relies on `posthog-node` package. It should be either installed as a dependency or a peerDependency that will be satisfied by the user project.

In this PR, I have added it as a peer dependency
2025-05-20 14:51:51 +00:00
Stevche Radevski
b9a51e217d feat: Add an analytics module and local and posthog providers (#12505)
* feat: Add an analytics module and local and posthog providers

* fix: Add tests and wire up in missing places

* fix: Address feedback and add missing module typing

* fix: Address feedback and add missing module typing

---------

Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-05-19 19:57:13 +02:00