chore(utils): update tsdocs for provider identifiers (#9656)
This commit is contained in:
@@ -14,8 +14,24 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
|
||||
implements IPaymentProvider
|
||||
{
|
||||
/**
|
||||
* Override this static method in order for the loader to validate the options provided to the module provider.
|
||||
* @param options
|
||||
* 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>) {
|
||||
* if (!options.apiKey) {
|
||||
* throw new MedusaError(
|
||||
* MedusaError.Types.INVALID_DATA,
|
||||
* "API key is required in the provider's options."
|
||||
* )
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
static validateOptions(options: Record<any, any>): void | never {}
|
||||
|
||||
@@ -48,6 +64,7 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
|
||||
* class MyPaymentProviderService extends AbstractPaymentProvider<
|
||||
* Options
|
||||
* > {
|
||||
* static identifier = "my-payment"
|
||||
* protected logger_: Logger
|
||||
* protected options_: Options
|
||||
* // Assuming you're using a client to integrate
|
||||
@@ -92,7 +109,9 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
|
||||
}
|
||||
|
||||
/**
|
||||
* Each payment provider has a unique identifier defined in its class.
|
||||
* 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`
|
||||
* property in the `medusa-config.ts`.
|
||||
*
|
||||
* @example
|
||||
* class MyPaymentProviderService extends AbstractPaymentProvider<
|
||||
|
||||
Reference in New Issue
Block a user