UNPKG

@eagleeye-solutions/integration-events-common

Version:
32 lines 1.49 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPosConnectWalletSpendEventData = getPosConnectWalletSpendEventData; const atomic_operations_1 = require("./atomic-operations"); const atomic_operations_2 = __importDefault(require("./atomic-operations")); /** * Returns an array of events derived from a POSCONNECT.WALLET.SETTLE event. * * @param event * @param configuration * @returns */ function getPosConnectWalletSpendEventData(event) { const posConnectWalletSpendEventData = {}; for (const op of event.atomicOperations) { if ((0, atomic_operations_1.isWalletAccountTransactionEntityUpdatePoints)(op)) { posConnectWalletSpendEventData.points = atomic_operations_2.default.WalletAccountTransactionEntity.UpdateEarnPoints.getPointsAttributes(op); } else if ((0, atomic_operations_1.isWalletTransactionEntityUpdateSpend)(op)) { posConnectWalletSpendEventData.transaction = atomic_operations_2.default.WalletTransactionEntity.UpdateSpend.getTransactionAttributes(op, event); posConnectWalletSpendEventData.tier = op.objectValue.basket?.summary?.results?.tiers?.points ?? 0; } } return posConnectWalletSpendEventData; } //# sourceMappingURL=posconnect-wallet-spend.js.map