fix(stripe): Wrong container type (#10223)

RESOLVES SUP-238

**What**

wrong container type withing payment providers
This commit is contained in:
Adrien de Peretti
2024-11-22 11:57:41 +01:00
committed by GitHub
parent 9d5b0412ec
commit b964b45fb2
4 changed files with 20 additions and 20 deletions
+2 -6
View File
@@ -1,8 +1,4 @@
import {
EventBusTypes,
InternalModuleDeclaration,
MedusaContainer,
} from "@medusajs/types"
import { EventBusTypes, InternalModuleDeclaration } from "@medusajs/types"
import { ulid } from "ulid"
export abstract class AbstractEventBusModuleService
@@ -23,7 +19,7 @@ export abstract class AbstractEventBusModuleService
}
protected constructor(
container: MedusaContainer,
cradle: Record<string, unknown>,
moduleOptions = {},
moduleDeclaration: InternalModuleDeclaration
) {
@@ -1,7 +1,6 @@
import {
CreatePaymentProviderSession,
IPaymentProvider,
MedusaContainer,
PaymentProviderError,
PaymentProviderSessionResponse,
PaymentSessionStatus,
@@ -13,14 +12,15 @@ import {
export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
implements IPaymentProvider
{
protected readonly container: Record<string, unknown>
/**
* This method validates the options of the provider set in `medusa-config.ts`.
* Implementing this method is optional. It's useful if your provider requires custom validation.
*
*
* If the options aren't valid, throw an error.
*
*
* @param options - The provider's options.
*
*
* @example
* class MyPaymentProviderService extends AbstractPaymentProvider<Options> {
* static validateOptions(options: Record<any, any>) {
@@ -43,7 +43,7 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
*
* The provider can also access the module's options as a second parameter.
*
* @param {MedusaContainer} container - The module's container used to resolve resources.
* @param {Record<string, unknown>} cradle - The module's container cradle used to resolve resources.
* @param {Record<string, unknown>} config - The options passed to the payment module provider.
*
* @example
@@ -92,9 +92,11 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
* ```
*/
protected constructor(
protected readonly container: MedusaContainer,
cradle: Record<string, unknown>,
protected readonly config: TConfig = {} as TConfig // eslint-disable-next-line @typescript-eslint/no-empty-function
) {}
) {
this.container = cradle
}
/**
* @ignore
@@ -110,7 +112,7 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
/**
* Each payment provider has a unique identifier defined in its class. The provider's ID
* will be stored as `pp_{identifier}_{id}`, where `{id}` is the provider's `id`
* will be stored as `pp_{identifier}_{id}`, where `{id}` is the provider's `id`
* property in the `medusa-config.ts`.
*
* @example
@@ -116,7 +116,7 @@ export abstract class AbstractSearchService
* Additionally, if youre creating your search service as an external plugin to be installed on any Medusa backend and you want to access the options added for the plugin,
* you can access them in the constructor. The default constructor already sets the value of the class proeprty `options_` to the passed options.
*
* @param {MedusaContainer} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} cradle - An container cradle that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} options - If this search service is created in a plugin, the plugin's options are passed in this parameter.
*
* @example
@@ -144,7 +144,7 @@ export abstract class AbstractSearchService
* // ...
* }
*/
protected constructor(container, options) {
protected constructor(cradle, options) {
this.options_ = options
}