---
displayed_sidebar: servicesSidebar
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# GiftCardService
Provides layer to manipulate gift cards.
## constructor
### Parameters
___
## Properties
`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__container__",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__moduleDeclaration__",
"type": "`Record`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "eventBus_",
"type": "[EventBusService](services.EventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "giftCardRepository_",
"type": "Repository<[GiftCard](../../entities/classes/entities.GiftCard.mdx)> & `object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "giftCardTransactionRepo_",
"type": "Repository<[GiftCardTransaction](../../entities/classes/entities.GiftCardTransaction.mdx)>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager_",
"type": "`EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "regionService_",
"type": "[RegionService](services.RegionService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager_",
"type": "`undefined` \\| `EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "Events",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "Events.CREATED",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"gift_card.created\"",
"expandable": false,
"children": []
}
]} />
___
## Accessors
### activeManager\_
#### Returns
___
## Methods
### 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.
#### Type Parameters
#### Parameters
Promise<TResult>",
"description": "the transactional work to be done",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationOrErrorHandler",
"type": "`IsolationLevel` \\| (`error`: `TError`) => Promise<void \\| TResult>",
"description": "the isolation level to be used for the work.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "maybeErrorHandlerOrDontFail",
"type": "(`error`: `TError`) => Promise<void \\| TResult>",
"description": "Potential error handler",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
___
### create
Creates a gift card with provided data given that the data is validated.
#### Parameters
#### Returns
___
### createTransaction
#### Parameters
#### Returns
___
### delete
Deletes a gift card idempotently
#### Parameters
#### Returns
___
### list
#### Parameters
#### Returns
___
### listAndCount
#### Parameters
#### Returns
___
### retrieve
Gets a gift card by id.
#### Parameters
#### Returns
___
### retrieveByCode
#### Parameters
#### Returns
___
### retrieve\_
#### Parameters
#### Returns
___
### shouldRetryTransaction\_
#### Parameters
` \\| `object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
___
### update
Updates a giftCard.
#### Parameters
#### Returns
___
### withTransaction
#### Parameters
#### Returns
___
### generateCode
Generates a 16 character gift card code
#### Returns
___
### 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
#### Returns