oak-pay-business/lib/checkers/abstractChecker.js

32 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.accountEntities = exports.registerAccountEntity = void 0;
const uuid_1 = require("oak-domain/lib/utils/uuid");
// 当注入一个新的account entity时将withdrawChannel的删除与之相关联
function registerAccountEntity(entity) {
exports.accountEntities.push(entity);
}
exports.registerAccountEntity = registerAccountEntity;
exports.accountEntities = ['offlineAccount'];
const triggers = [
...exports.accountEntities.filter(ele => !!ele).map((entity) => [
{
entity,
action: 'remove',
type: 'logical',
checker: (operation, context) => {
const { filter } = operation;
return context.operate('withdrawChannel', {
id: (0, uuid_1.generateNewId)(),
action: 'remove',
data: {},
filter: {
[entity]: filter,
}
}, { dontCollect: true });
}
},
]).flat(),
];
exports.default = triggers;