Skip to content

Commit e91aa24

Browse files
authored
chore(types, utils): TSDoc improvements for providers (medusajs#12498)
* chore(types, utils): TSDoc improvements for providers * small iteration
1 parent 22cdced commit e91aa24

File tree

4 files changed

+173
-41
lines changed

4 files changed

+173
-41
lines changed

packages/core/types/src/file/provider.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,27 @@ export interface IFileProvider {
140140
getPresignedDownloadUrl(fileData: ProviderGetFileDTO): Promise<string>
141141

142142
/**
143-
* This method is used to get a presigned upload URL for a file.
144-
* If the file provider does not support direct upload, an exception will be thrown when calling this method.
143+
* This method is used to get a presigned upload URL for a file. For some providers,
144+
* such as S3, a presigned URL indicates a temporary URL to get upload a file.
145+
*
146+
* If your provider doesn’t perform or offer a similar functionality, you don't have to
147+
* implement this method. Instead, an error is thrown when the method is called.
145148
*
146149
* @param {ProviderGetPresignedUploadUrlDTO} fileData - The details of the file to get a presigned upload URL for.
147150
* @returns {Promise<ProviderFileResultDTO>} The presigned URL and file key to upload the file to
148151
*
152+
* @example
153+
* class MyFileProviderService extends AbstractFileProviderService {
154+
* // ...
155+
* async getPresignedUploadUrl(
156+
* fileData: ProviderGetPresignedUploadUrlDTO
157+
* ): Promise<ProviderFileResultDTO> {
158+
* // TODO logic to get the presigned upload URL
159+
* // for example:
160+
* return this.client.getPresignedUploadUrl(fileData.filename, fileData.mimeType)
161+
* }
162+
* }
163+
*
149164
*/
150165
getPresignedUploadUrl?(
151166
fileData: ProviderGetPresignedUploadUrlDTO

packages/core/types/src/fulfillment/provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export interface IFulfillmentProvider {
8080
/**
8181
*
8282
* Return a unique identifier to retrieve the fulfillment plugin provider
83+
* @ignore
8384
*/
8485
getIdentifier(): string
8586
/**

packages/core/types/src/payment/provider.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,9 @@ export interface GetPaymentStatusOutput extends PaymentProviderOutput {
339339
*/
340340
export type WebhookActionData = {
341341
/**
342-
* The associated payment session's ID.
342+
* The ID of the payment session in Medusa.
343+
* Make sure to store this ID in the third-party payment provider
344+
* to be able to retrieve the payment session later.
343345
*/
344346
session_id: string
345347

@@ -356,7 +358,7 @@ export type WebhookActionData = {
356358
*/
357359
export type WebhookActionResult = {
358360
/**
359-
* Normalized events from payment provider to internal payment module events.
361+
* The action that was performed so that Medusa can handle it internally.
360362
*/
361363
action: PaymentActions
362364

@@ -392,7 +394,7 @@ export interface IPaymentProvider {
392394

393395
/**
394396
* This method is used when creating an account holder in Medusa, allowing you to create
395-
* the equivalent account in the third-party service. An account holder is useful to
397+
* the equivalent account in the third-party payment provider. An account holder is useful to
396398
* later save payment methods, such as credit cards, for a customer in the
397399
* third-party payment provider using the {@link savePaymentMethod} method.
398400
*
@@ -444,7 +446,7 @@ export interface IPaymentProvider {
444446

445447
/**
446448
* This method is used when updating an account holder in Medusa, allowing you to update
447-
* the equivalent account in the third-party service.
449+
* the equivalent account in the third-party payment provider.
448450
*
449451
* The returned data will be stored in the account holder created in Medusa. For example,
450452
* the returned `id` property will be stored in the account holder's `external_id` property.
@@ -488,7 +490,7 @@ export interface IPaymentProvider {
488490

489491
/**
490492
* This method is used when an account holder is deleted in Medusa, allowing you
491-
* to also delete the equivalent account holder in the third-party service.
493+
* to also delete the equivalent account holder in the third-party payment provider.
492494
*
493495
* @param data - Input data including the details of the account holder to delete.
494496
* @returns The result of deleting the account holder. If an error occurs, throw it.

0 commit comments

Comments
 (0)