Skip to main content

Class: GiftCardService

Provides layer to manipulate gift cards.

Hierarchy

  • "medusa-interfaces"

    GiftCardService

Constructors

constructor

new GiftCardService(__namedParameters)

Parameters

NameType
__namedParametersObject

Overrides

BaseService.constructor

Defined in

services/gift-card.js:15

Properties

Events

Static Events: Object

Type declaration

NameType
CREATEDstring

Defined in

services/gift-card.js:11

Methods

create

create(giftCard): Promise<GiftCard>

Creates a gift card with provided data given that the data is validated.

Parameters

NameTypeDescription
giftCardGiftCardthe gift card data to create

Returns

Promise<GiftCard>

the result of the create operation

Defined in

services/gift-card.js:134


createTransaction

createTransaction(data): Promise<any>

Parameters

NameType
dataany

Returns

Promise<any>

Defined in

services/gift-card.js:120


delete

delete(giftCardId): Promise<any>

Deletes a gift card idempotently

Parameters

NameTypeDescription
giftCardIdstringid of gift card to delete

Returns

Promise<any>

the result of the delete operation

Defined in

services/gift-card.js:288


generateCode_

generateCode_(): string

Generates a 16 character gift card code

Returns

string

the generated gift card code

Defined in

services/gift-card.js:62


list

list(selector?, config?): Promise<any>

Parameters

NameTypeDescription
selectoranythe query object for find
configanythe configuration used to find the objects. contains relations, skip, and take.

Returns

Promise<any>

the result of the find operation

Defined in

services/gift-card.js:78


retrieve

retrieve(giftCardId, config?): Promise<GiftCard>

Gets a gift card by id.

Parameters

NameTypeDescription
giftCardIdstringid of gift card to retrieve
configanyoptional values to include with gift card query

Returns

Promise<GiftCard>

the gift card

Defined in

services/gift-card.js:175


retrieveByCode

retrieveByCode(code, config?): Promise<any>

Parameters

NameType
codeany
configObject

Returns

Promise<any>

Defined in

services/gift-card.js:209


update

update(giftCardId, update): Promise<any>

Updates a giftCard.

Parameters

NameTypeDescription
giftCardIdstringgiftCard id of giftCard to update
updateGiftCardthe data to update the giftCard with

Returns

Promise<any>

the result of the update operation

Defined in

services/gift-card.js:247


withTransaction

withTransaction(transactionManager): GiftCardService

Parameters

NameType
transactionManagerany

Returns

GiftCardService

Defined in

services/gift-card.js:40