@eagleeye-solutions/integration-events-common
Version:
Eagle Eye CDP connector common functionality
20 lines • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTransactionAttributesFromWalletTransactionEntityCreatRefund = getTransactionAttributesFromWalletTransactionEntityCreatRefund;
const common_1 = require("./common");
const create_common_1 = require("./create-common");
function getTotalPointsDeducted(entity) {
return ((entity.objectValue.basket.summary?.results?.points.totalPointsTaken ?? 0) -
(entity.objectValue.basket.summary?.results?.points.totalPointsGiven ?? 0));
}
function getTransactionAttributesFromWalletTransactionEntityCreatRefund(entity) {
const transactionAttributes = {
storeLocation: (0, common_1.getStoreLocationAttributes)(entity),
products: (0, create_common_1.getProductAttributes)(entity),
totalBasketValueAfterDiscount: (0, create_common_1.getTotalBasketValueAfterDiscount)(entity),
totalPointsDeducted: getTotalPointsDeducted(entity),
transactionReference: entity.objectValue.reference,
};
return transactionAttributes;
}
//# sourceMappingURL=create-refund.js.map