33 lines
908 B
JavaScript
33 lines
908 B
JavaScript
import { OakAttrNotNullException } from 'oak-domain/lib/types';
|
|
const checkers = [
|
|
{
|
|
entity: 'withdrawTransfer',
|
|
type: 'data',
|
|
action: 'succeed',
|
|
checker(operation, context) {
|
|
const { data } = operation;
|
|
if (data) {
|
|
const { externalId } = data;
|
|
if (!externalId) {
|
|
throw new OakAttrNotNullException('pay', ['externalId']);
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
entity: 'withdrawTransfer',
|
|
type: 'data',
|
|
action: 'fail',
|
|
checker(operation, context) {
|
|
const { data } = operation;
|
|
if (data) {
|
|
const { reason } = data;
|
|
if (!reason) {
|
|
throw new OakAttrNotNullException('withdrawTransfer', ['reason']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
];
|
|
export default checkers;
|