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

28 lines
931 B
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.

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