Skip to content

Commit 5bb1d64

Browse files
committed
chore: update TSDocs of account holder additions
1 parent f00e6bf commit 5bb1d64

File tree

2 files changed

+79
-12
lines changed

2 files changed

+79
-12
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export type CreateAccountHolderInput = PaymentProviderInput & {
195195

196196
export type UpdateAccountHolderInput = PaymentProviderInput & {
197197
/**
198-
* The context of creating the account holder.
198+
* The context of updating the account holder.
199199
*/
200200
context: PaymentProviderContext & {
201201
/**
@@ -335,10 +335,26 @@ export type CreateAccountHolderOutput = PaymentProviderOutput & {
335335
id: string
336336
}
337337

338+
/**
339+
* @interface
340+
*
341+
* The result of updating an account holder in the third-party payment provider. The `data`
342+
* property is stored as-is in Medusa's account holder's `data` property.
343+
*/
338344
export type UpdateAccountHolderOutput = PaymentProviderOutput
339345

346+
/**
347+
* @interface
348+
*
349+
* The result of deleting an account holder in the third-party payment provider.
350+
*/
340351
export type DeleteAccountHolderOutput = PaymentProviderOutput
341352

353+
/**
354+
* @interface
355+
*
356+
* The result of listing payment methods for an account holder in the third-party payment provider.
357+
*/
342358
export type ListPaymentMethodsOutput = (PaymentProviderOutput & {
343359
/**
344360
* The ID of the payment method in the payment provider.
@@ -490,7 +506,7 @@ export interface IPaymentProvider {
490506
* @param data - Input data including the details of the account holder to update.
491507
* @returns The result of updating the account holder. If an error occurs, throw it.
492508
*
493-
* @version 2.6.0
509+
* @version 2.5.1
494510
*
495511
* @example
496512
* import { MedusaError } from "@medusajs/framework/utils"

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

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export interface IPaymentModuleService extends IModuleService {
9999
* @returns {Promise<PaymentCollectionDTO>} The retrieved payment collection.
100100
*
101101
* @example
102-
* A simple example that retrieves a {type name} by its ID:
102+
* A simple example that retrieves a payment collection by its ID:
103103
*
104104
* ```ts
105105
* const paymentCollection =
@@ -195,7 +195,7 @@ export interface IPaymentModuleService extends IModuleService {
195195
* @returns {Promise<[PaymentCollectionDTO[], number]>} The list of payment collections along with their total count.
196196
*
197197
* @example
198-
* To retrieve a list of {type name} using their IDs:
198+
* To retrieve a list of payment collection using their IDs:
199199
*
200200
* ```ts
201201
* const paymentCollections =
@@ -204,7 +204,7 @@ export interface IPaymentModuleService extends IModuleService {
204204
* })
205205
* ```
206206
*
207-
* To specify relations that should be retrieved within the {type name}:
207+
* To specify relations that should be retrieved within the payment collection:
208208
*
209209
* ```ts
210210
* const paymentCollections =
@@ -218,7 +218,7 @@ export interface IPaymentModuleService extends IModuleService {
218218
* )
219219
* ```
220220
*
221-
* By default, only the first `{default limit}` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
221+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
222222
*
223223
* ```ts
224224
* const paymentCollections =
@@ -749,18 +749,69 @@ export interface IPaymentModuleService extends IModuleService {
749749
sharedContext?: Context
750750
): Promise<PaymentProviderDTO[]>
751751

752+
/**
753+
* This method retrieves a paginated list of payment providers along with the total count of available payment providers satisfying the provided filters.
754+
*
755+
* @param {FilterablePaymentProviderProps} filters - The filters to apply on the retrieved payment provider.
756+
* @param {FindConfig<PaymentProviderDTO>} config - The configurations determining how the payment provider is retrieved. Its properties, such as `select` or `relations`, accept the
757+
* attributes or relations associated with a payment provider.
758+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
759+
* @returns {Promise<[PaymentProviderDTO[], number]>} The list of payment providers along with their total count.
760+
*
761+
* @example
762+
* To retrieve a list of payment providers using their IDs:
763+
*
764+
* ```ts
765+
* const [paymentProviders, count] =
766+
* await paymentModuleService.listAndCountPaymentProviders({
767+
* id: ["pp_stripe_stripe"],
768+
* })
769+
* ```
770+
*
771+
* To specify relations that should be retrieved within the payment providers:
772+
*
773+
* ```ts
774+
* const [paymentProviders, count] =
775+
* await paymentModuleService.listAndCountPaymentProviders(
776+
* {
777+
* id: ["pp_stripe_stripe"],
778+
* },
779+
* {
780+
* relations: ["payment_collections"],
781+
* }
782+
* )
783+
* ```
784+
*
785+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
786+
*
787+
* ```ts
788+
* const [paymentProviders, count] =
789+
* await paymentModuleService.listAndCountPaymentProviders(
790+
* {
791+
* id: ["pp_stripe_stripe"],
792+
* },
793+
* {
794+
* relations: ["payment_collections"],
795+
* take: 20,
796+
* skip: 2,
797+
* }
798+
* )
799+
* ```
800+
*
801+
*
802+
*/
752803
listAndCountPaymentProviders(
753804
filters?: FilterablePaymentProviderProps,
754805
config?: FindConfig<PaymentProviderDTO>,
755806
sharedContext?: Context
756807
): Promise<[PaymentProviderDTO[], number]>
757808

758809
/**
759-
* This method creates(if supported by provider) the account holder in the payment provider.
810+
* This method creates an account holder in the payment provider, if the provider supports account holders.
760811
*
761-
* @param {CreateAccountHolderDTO} data - The details of the account holder.
812+
* @param {CreateAccountHolderDTO} input - The details of the account holder.
762813
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
763-
* @returns {Promise<Record<string, unknown>>} The account holder's details in the payment provider, typically just the ID.
814+
* @returns {Promise<AccountHolderDTO>} The created account holder's details.
764815
*
765816
* @example
766817
* const accountHolder =
@@ -790,11 +841,11 @@ export interface IPaymentModuleService extends IModuleService {
790841
): Promise<AccountHolderDTO>
791842

792843
/**
793-
* This method updates(if supported by provider) the account holder in the payment provider.
844+
* This method updates an account holder in the payment provider, if the provider supports account holders.
794845
*
795-
* @param {UpdateAccountHolderDTO} data - The details of the account holder.
846+
* @param {UpdateAccountHolderDTO} input - The details of the account holder to update.
796847
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
797-
* @returns {Promise<Record<string, unknown>>} The account holder's details in the payment provider, typically just the ID.
848+
* @returns {Promise<AccountHolderDTO>} The updated account holder's details.
798849
*
799850
* @example
800851
* const accountHolder =

0 commit comments

Comments
 (0)