Methods
# async getDiscount(transactionId, couponCodeId) → {Object}
Get discounts for a transaction or transaction_item.
Parameters:
| Name | Type | Description |
|---|---|---|
transactionId |
Number
|
The transaction ID. |
couponCodeId |
Number
|
The coupon code ID. |
- If an error occurs.
Error
- The discounts object.
Object
# async getDiscountsForEntities(transactionItemId) → {Object}
Get discounts for a transaction item.
Parameters:
| Name | Type | Description |
|---|---|---|
transactionItemId |
Number
|
The transaction item ID. |
- If an error occurs.
Error
- The discounts object.
Object
# async getPaymentTypes() → {Array.<PaymentTypeEntity>}
Get all payment types.
- If an error occurs.
Error
- An array of payment type entities.
Array.<PaymentTypeEntity>
# async getTransactionByUserId(userId) → {Object}
Get a transaction by user ID.
Parameters:
| Name | Type | Description |
|---|---|---|
userId |
Number
|
The user ID. |
- If an error occurs.
Error
- The transaction object.
Object
# async getTransactionCategories() → {Array.<TransactionCategoryEntity>}
Get all transaction categories.
- If an error occurs.
Error
- An array of transaction category entities.
Array.<TransactionCategoryEntity>
# getTransactionDataByCartId(cartId) → {Object}
Get transaction data by cart ID.
Parameters:
| Name | Type | Description |
|---|---|---|
cartId |
Number
|
The cart ID. |
- If an error occurs.
Error
- The transaction data.
Object
# getTransactionDataByOrderId(orderId) → {Object}
Get transaction data by order ID.
Parameters:
| Name | Type | Description |
|---|---|---|
orderId |
Number
|
The order ID. |
- If an error occurs.
Error
- The transaction data.
Object
# getTransactionDataByTransactionId(transactionId) → {Object}
Get transaction data by transaction ID.
Parameters:
| Name | Type | Description |
|---|---|---|
transactionId |
Number
|
The transaction ID. |
- If an error occurs.
Error
- The transaction data.
Object
# async getTransactionTypes() → {Array.<TransactionTypeEntity>}
Get all transaction types.
- If an error occurs.
Error
- An array of transaction type entities.
Array.<TransactionTypeEntity>
# async getTransactionWithItems(transactionId) → {Object}
Get a transaction by ID and fetch related data.
Parameters:
| Name | Type | Description |
|---|---|---|
transactionId |
Number
|
The transaction ID. |
- If an error occurs.
Error
- The transaction object.
Object
# async insertDiscount(transactionItemId) → {Object}
Get discounts for a transaction item.
Parameters:
| Name | Type | Description |
|---|---|---|
transactionItemId |
Number
|
The transaction item ID. |
- If an error occurs.
Error
- The discounts object.
Object
# async updateTotals(transactionId) → {Number}
Update the totals of a transaction.
Parameters:
| Name | Type | Description |
|---|---|---|
transactionId |
Number
|
The transaction ID. |
- If an error occurs.
Error
- The transaction total.
Number
# async upsertDiscount(data) → {Object}
Upsert a discount for a transaction or transaction item.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Object
|
The discount data. |
entity_type |
string
|
The entity type (transaction or transaction_item). |
entity_id |
number
|
The entity ID. |
coupon_code_id |
number
|
The coupon code ID. |
- If an error occurs.
Error
- The upserted discount object.
Object