Resolve the service
Resolve the service from the Medusa container with theMercurModules.SELLER key from @mercurjs/types.
Generated methods
The service extends Medusa’sMedusaService, which generates the same eight methods for every model. For Seller they are:
Each model gets the same set under its own name:
Custom methods
The service overrides some generated methods and adds a few of its own.createSellers and updateSellers
handle and throw INVALID_DATA when it isn’t URL safe. When handle is missing and name is present, both set the handle from the name.
upsertMembers
email and creates the missing ones. For existing members, it fills first_name and last_name only when they’re empty. It returns the members in input order.
createMemberInvites
INVALID_DATA if an email already belongs to the target store. For each invite, it signs a JWT with the module’s jwt_secret, stores it in token, and sets expires_at from invite_valid_duration.
validateMemberInviteToken
INVALID_DATA for a bad signature, and NOT_ALLOWED when the invite is accepted or expired.
getStatistics
{ total, premium, by_status }, where by_status has a key for every SellerStatus value.
Order group reads
listOrderGroups, listAndCountOrderGroups, and retrieveOrderGroup go through a custom repository that computes seller_count and total. See the order group service.
Module options
The service reads these options from its module registration, typed bySellerModuleOptions: