Skip to content

GiftCardModule

Module in @evolve-framework/commercetools

Query.giftCardBalance: what is left on a card, from its number and PIN.

import { GiftCardModule } from "@evolve-framework/commercetools/gift-card";

Serves the Gift card part of the GraphQL API: giftCardBalance.

new GiftCardModule(options: GiftCardModuleOptions)
OptionTypeDescription
storeGiftCardStore

Where the cards live.

GiftCardStore4The fields of store.
FieldTypeDescription
checkBalance(card: GiftCardCredentials) => Promise<GiftCardBalance>

The balance available to spend. Throws InvalidGiftCardError.

reserve(card: GiftCardCredentials & { holdId: string; centAmount: number; currency: string; }) => Promise<void>

Hold centAmount of the card for holdId. Throws InvalidGiftCardError, or InsufficientBalanceError when less is available. Holding the same holdId again for the same amount changes nothing.

capture(args: { number: string; holdId: string; }) => Promise<void>

Take what holdId holds off the card. Nothing happens when it holds nothing.

release(args: { number: string; holdId: string; centAmount?: number | undefined; }) => Promise<void>

Give back centAmount of what holdId holds, or all of it. Nothing happens when it holds nothing.

Extends AbstractModule<unknown>.

The same module on medusa.