GiftCardService
Provides layer to manipulate gift cards.
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>giftCardRepository_
Repository<GiftCard> & { listGiftCardsAndCount: Method listGiftCardsAndCount }Requiredmanager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredEvents
objectRequiredEvents.CREATED
stringRequiredAccessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
atomicPhase_
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
Parameters
work
(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Potential error handler
Returns
Promise
Promise<TResult>Requiredthe result of the transactional work
create
Creates a gift card with provided data given that the data is validated.
Parameters
the gift card data to create
Returns
the result of the create operation
createTransaction
Parameters
Returns
Promise
Promise<string>Requireddelete
Deletes a gift card idempotently
Parameters
giftCardId
stringRequiredid of gift card to delete
Returns
the result of the delete operation
list
Parameters
selector
QuerySelector<GiftCard>the query object for find
config
FindConfig<GiftCard>the configuration used to find the objects. contains relations, skip, and take.
Returns
the result of the find operation
listAndCount
Parameters
selector
QuerySelector<GiftCard>the query object for find
config
FindConfig<GiftCard>the configuration used to find the objects. contains relations, skip, and take.
Returns
the result of the find operation
retrieve
Gets a gift card by id.
Parameters
giftCardId
stringRequiredid of gift card to retrieve
config
FindConfig<GiftCard>optional values to include with gift card query
Returns
the gift card
retrieveByCode
Parameters
code
stringRequiredconfig
FindConfig<GiftCard>Returns
retrieve_
Parameters
config
FindConfig<GiftCard>Returns
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
booleanupdate
Updates a giftCard.
Parameters
giftCardId
stringRequiredgiftCard id of giftCard to update
the data to update the giftCard with
Returns
the result of the update operation
withTransaction
Parameters
transactionManager
EntityManagerReturns
generateCode
Generates a 16 character gift card code
Returns
string
stringthe generated gift card code
resolveTaxRate
The tax_rate of the giftcard can depend on whether regions tax gift cards, an input provided by the user or the tax rate. Based on these conditions, tax_rate changes.
Parameters
giftCardTaxRate
null | numberRequiredA region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries.
Returns
null \| number
null | numberthe tax rate for the gift card
Was this section helpful?