Skip to content

Commit

Permalink
Revert "feat: email plugins support (#2611)"
Browse files Browse the repository at this point in the history
This reverts commit d8b55d3.
  • Loading branch information
tomer-shvadron committed Oct 13, 2024
1 parent 224283c commit e49806f
Show file tree
Hide file tree
Showing 35 changed files with 1,085 additions and 1,367 deletions.
9 changes: 1 addition & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,5 @@
"packages/workflow-core",
"services/workflows-service",
"packages/common"
],
"search.exclude": {
"**/node_modules": true,
"**/dist": true,
"**/data-migrations": false
},
"search.followSymlinks": true,
"search.useIgnoreFiles": false
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { TWorkflowById } from '@/domains/workflows/fetchers';
import { StateTag } from '@ballerine/common';

export class MerchantMonitoringProcessTracker implements IProcessTracker {
PROCESS_NAME = 'merchantMonitoring';
PROCESS_NAME = 'merchant-monitoring';

constructor(public readonly workflow: TWorkflowById) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ export const workflow = {
approve: { tags: [StateTag.APPROVED], type: 'final' },
email_sent: {
tags: [StateTag.REVISION],
on: { KYC_RESPONSE_RECEIVED: [{ target: 'kyc_manual_review' }] },
on: { KYC_HOOK_RESPONDED: [{ target: 'kyc_manual_review' }] },
},
get_kyc_session: {
tags: [StateTag.PENDING_PROCESS],
Expand Down Expand Up @@ -805,7 +805,7 @@ export const workflow = {
approve: { tags: [StateTag.APPROVED], type: 'final' },
email_sent: {
tags: [StateTag.REVISION],
on: { KYC_RESPONSE_RECEIVED: [{ target: 'kyc_manual_review' }] },
on: { KYC_HOOK_RESPONDED: [{ target: 'kyc_manual_review' }] },
},
get_kyc_session: {
tags: [StateTag.PENDING_PROCESS],
Expand Down
1 change: 0 additions & 1 deletion apps/kyb-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"type": "module",
"scripts": {
"dev": "vite",
"start": "vite",
"build": "tsc && vite build",
"lint": "eslint . --fix",
"format": "prettier --write .",
Expand Down
1 change: 0 additions & 1 deletion apps/workflows-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"spellcheck": "cspell \"*\"",
"dev": "vite --host",
"start": "vite",
"build": "tsc && vite build",
"lint": "eslint . --fix",
"format": "prettier --write .",
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"spellcheck": "nx run-many --target=spellcheck",
"monorepo:init": "node ./scripts/init.js",
"kyc-manual-review-example": "nx run @ballerine/common:build && nx run @ballerine/workflows-service:setup && cross-env VITE_POLLING_INTERVAL=3 VITE_EXAMPLE_TYPE=kyc VITE_API_KEY=secret concurrently \"nx run @ballerine/workflows-service:dev\" \"wait-on http://localhost:3000/api/v1/_health/ready && nx run-many --target=dev --projects=@ballerine/web-ui-sdk,@ballerine/backoffice-v2\"",
"run-kyb-web-apps": "cross-env VITE_POLLING_INTERVAL=3 VITE_EXAMPLE_TYPE=kyb VITE_API_KEY=secret concurrently \"nx run-many --target=dev --projects=@ballerine/kyb-app,@ballerine/backoffice-v2\"",
"kyb-manual-review-example": "nx run @ballerine/common:build && nx run @ballerine/workflows-service:setup && cross-env VITE_POLLING_INTERVAL=3 VITE_EXAMPLE_TYPE=kyb VITE_API_KEY=secret concurrently \"nx run @ballerine/workflows-service:dev\" \"wait-on http://localhost:3000/api/v1/_health/ready && nx run-many --target=dev --projects=@ballerine/kyb-app,@ballerine/backoffice-v2\"",
"api-flow-example": "nx run @ballerine/common:build && nx run @ballerine/workflows-service:setup && cross-env VITE_POLLING_INTERVAL=false VITE_EXAMPLE_TYPE=kyb VITE_API_KEY=secret concurrently \"nx run @ballerine/workflows-service:dev\" \"wait-on http://localhost:3000/api/v1/_health/ready && nx run-many --target=dev --projects=@ballerine/backoffice-v2,@ballerine/workflows-dashboard\"",
"branchlint": "branchlint -u -c",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const Default = {
subitems={[
{
leftIcon: <Clock4 size={18} className={`fill-purple-500 stroke-white`} />,
text: 'Registry Information',
text: 'Registry Verification',
},
{
leftIcon: <CheckCircle2 size={18} className={`fill-green-500 stroke-white`} />,
Expand Down
19 changes: 3 additions & 16 deletions packages/workflow-core/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import { ApiPlugin, WebhookPlugin } from './plugins';
import { EmailPlugin } from './plugins/external-plugin/email-plugin';
import { MastercardMerchantScreeningPlugin } from './plugins/external-plugin/mastercard-merchant-screening-plugin';
import { ObjectValues } from './types';
import { BALLERINE_API_PLUGINS } from './plugins/external-plugin/vendor-consts';
import { BallerineApiPlugin } from './plugins/external-plugin/ballerine-plugin';
import { BallerineEmailPlugin } from './plugins/external-plugin/ballerine-email-plugin';

export const PluginKind = {
KYC: 'kyc',
KYC_SESSION: 'kyc-session',
KYB: 'kyb',
WEBHOOK: 'webhook',
API: 'api',
Expand All @@ -20,21 +18,10 @@ export const PluginKind = {

export const pluginsRegistry = {
[PluginKind.KYC]: KycPlugin,
[PluginKind.KYC_SESSION]: KycSessionPlugin,
[PluginKind.KYB]: KybPlugin,
[PluginKind.WEBHOOK]: WebhookPlugin,
[PluginKind.API]: ApiPlugin,
[PluginKind.EMAIL]: EmailPlugin,
[PluginKind.MASTERCARD_MERCHANT_SCREENING]: MastercardMerchantScreeningPlugin,
[BALLERINE_API_PLUGINS['individual-sanctions']]: BallerineApiPlugin,
[BALLERINE_API_PLUGINS['company-sanctions']]: BallerineApiPlugin,
[BALLERINE_API_PLUGINS['ubo']]: BallerineApiPlugin,
[BALLERINE_API_PLUGINS['registry-information']]: BallerineApiPlugin,
[BALLERINE_API_PLUGINS['merchant-monitoring']]: BallerineApiPlugin,
[BALLERINE_API_PLUGINS['template-email']]: BallerineEmailPlugin,
[BALLERINE_API_PLUGINS['kyc-session']]: KycSessionPlugin,
} as const satisfies Readonly<
Record<
ObjectValues<typeof PluginKind & typeof BALLERINE_API_PLUGINS>,
new (...args: any[]) => any
>
>;
} as const satisfies Readonly<Record<ObjectValues<typeof PluginKind>, new (...args: any[]) => any>>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { WorkflowRunner } from '../../workflow-runner';
import { ApiPlugin, IApiPluginParams } from '../external-plugin';
import { ApiBallerinePlugins, BALLERINE_API_PLUGIN_FACTORY } from './vendor-consts';

export interface IBallerineApiPluginParams {
pluginKind: ApiBallerinePlugins;
vendor?: string;
displayName: string | undefined;
stateNames: string[];
}

export class BallerineApiPlugin extends ApiPlugin {
public static pluginType = 'http';

constructor(params: IBallerineApiPluginParams & IApiPluginParams) {
let optionsFactoryFn: any = BALLERINE_API_PLUGIN_FACTORY[params.pluginKind];

if (!optionsFactoryFn) {
throw new Error(`Unknown plugin kind: ${params.pluginKind}`);
}

if (
params.pluginKind === 'individual-sanctions' ||
params.pluginKind === 'company-sanctions' ||
params.pluginKind === 'ubo'
) {
if (!params.vendor) {
throw new Error(`Missed vendor for: ${params.pluginKind}`);
}

optionsFactoryFn = (optionsFactoryFn as any)[params.vendor];
}

const options = optionsFactoryFn(params as any);

let { requestTransformer, requestValidator, responseTransformer, responseValidator } =
WorkflowRunner.reqResTransformersObj({
params,
...options,
});

super({
persistResponseDestination: undefined,
...params,
...options,
request: { transformers: requestTransformer, schemaValidator: requestValidator } as any,
response: { transformers: responseTransformer, schemaValidator: responseValidator } as any,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('workflow-runner', () => {
server.close();
});

it.skip('transitions to successAction and persist response to context', async () => {
it('transitions to successAction and persist response to context', async () => {
const workflow = createWorkflowRunner(
definition,
// @ts-expect-error - see the comments on `webhookPluginsSchemas`
Expand Down
Loading

0 comments on commit e49806f

Please sign in to comment.