Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: email plugins support #2611

Merged
merged 60 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
c5b9088
feat: email plugins support
liorzblrn Aug 4, 2024
47b0bf5
chore: remove todo
liorzblrn Aug 4, 2024
99d478f
fix: fetch customer secret from external provider
liorzblrn Aug 5, 2024
bdad181
fix: improve check using includes
liorzblrn Aug 5, 2024
d002693
fix: improve readability
liorzblrn Aug 5, 2024
af7e237
fix: improve secret replace
liorzblrn Aug 6, 2024
3cc3767
fix: remove error stacktrace
liorzblrn Aug 6, 2024
35d4fff
fix: remove error stacktrace
liorzblrn Aug 6, 2024
8fcd3bf
fix: replace INVITATION typo
liorzblrn Aug 6, 2024
b0a9820
fix: reset data migration
liorzblrn Aug 6, 2024
d71cdfd
Merge branch 'bal-2513-email-plugin-fixes' of github.com:ballerine-io…
liorzblrn Aug 6, 2024
752607c
fix: fix plugins secrets
liorzblrn Aug 6, 2024
1e1355e
chore: fix plugin registry info issues
liorzblrn Aug 8, 2024
c57c8b9
fix: additional plugins
liorzblrn Aug 12, 2024
1cf619b
feat: fix data mapping
liorzblrn Sep 22, 2024
b99febb
fix: webhook
liorzblrn Sep 24, 2024
e40137e
chore: merge dev
liorzblrn Sep 25, 2024
07f2aa4
fix: circular dependency
liorzblrn Sep 25, 2024
00c6a78
fix: circular dependency 2
liorzblrn Sep 25, 2024
c9ee508
fix: plugin on client side
liorzblrn Sep 25, 2024
ec83773
fix: changes for plugins
liorzblrn Sep 29, 2024
af79dcb
feat: added stepper customization & updated pallete classes
chesterkmr Sep 5, 2024
15a3d6d
feat: reworked document field design
chesterkmr Sep 5, 2024
0627531
feat: added clear field functionality
chesterkmr Sep 5, 2024
da21a97
feat: implemented dynamic powered by logo & added white poweredby
chesterkmr Sep 5, 2024
5f42f5b
fix: fixed & clean
chesterkmr Sep 5, 2024
2ea4724
feat: refactor
chesterkmr Sep 5, 2024
64ed794
feat: added logo to theme definition
chesterkmr Sep 16, 2024
06737df
feat: implemented visibleOn for nested inputs
chesterkmr Sep 28, 2024
aea77f3
fix: fixed typos
chesterkmr Oct 1, 2024
e1bc5f1
fix: deleted theme
chesterkmr Oct 1, 2024
7ab309a
feat: added theme to ui def
chesterkmr Oct 1, 2024
7a98b7c
fix: fixed types & theme provider & added migration for theme
chesterkmr Oct 1, 2024
1ef0964
chore(nuvei): merge
alonp99 Oct 2, 2024
e726c98
fix(social): link extraction prompt fix
alonp99 Oct 2, 2024
71f2fe1
chore(nuvei): some fixes
alonp99 Oct 5, 2024
6928ac4
fix: changes for plugins 2
liorzblrn Oct 5, 2024
2e04b91
fix: rename kyb to businessInformation
liorzblrn Oct 5, 2024
d5eb09b
chore: fix data migration ref
liorzblrn Oct 6, 2024
90f066d
chore: pull from remote
liorzblrn Oct 6, 2024
109217b
chore: pull from dev
liorzblrn Oct 6, 2024
6a6f74e
chore: fix file after merge 1
liorzblrn Oct 6, 2024
b8085ff
fix: remove get url without variables
liorzblrn Oct 6, 2024
933ed5f
fix: modify kyc session and email templates
liorzblrn Oct 6, 2024
9eaa524
fix: display names and plugin names
liorzblrn Oct 6, 2024
cd950b7
chore(ubo-asiaverify): change realtime flag per production
alonp99 Oct 7, 2024
69a4009
fix(kyc-session): fix kyc session, added mastercard
alonp99 Oct 7, 2024
d03f0c9
fix(vscode): submodule search issue
alonp99 Oct 8, 2024
7da3a9d
fix: support individual-sanctions new options
liorzblrn Oct 8, 2024
22871ec
Merge branch 'bal-2513-email-plugin-fixes' of github.com:ballerine-io…
liorzblrn Oct 8, 2024
baad4cf
feat: support url options
liorzblrn Oct 8, 2024
59d7d2a
chore(merge): dev
alonp99 Oct 8, 2024
59e0b85
feat: add default country for registry information and sanctions and …
liorzblrn Oct 9, 2024
b9eac99
feat: add default country for plugins
liorzblrn Oct 9, 2024
88091e6
fix: default value for plugins
liorzblrn Oct 9, 2024
f7f61d7
Merge branch 'dev' into bal-2513-email-plugin-fixes
alonp99 Oct 9, 2024
035fd7b
chore: merge with dev
liorzblrn Oct 10, 2024
e89c31b
Merge branch 'dev' into bal-2513-email-plugin-fixes
alonp99 Oct 12, 2024
93ad5df
chore(merge): dev
alonp99 Oct 12, 2024
461e1bd
chore(merge): dev
alonp99 Oct 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@
"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 = 'merchant-monitoring';
PROCESS_NAME = 'merchantMonitoring';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Incomplete Refactoring Detected

The renaming from 'merchant-monitoring' to 'merchantMonitoring' is not fully applied across the codebase. Multiple occurrences of 'merchant-monitoring' still exist, which may lead to inconsistencies and potential bugs.

  • Files to address:
    • services/workflows-service/src/workflow/workflow-controller-examples.ts
    • packages/workflow-core/src/lib/constants.ts
    • packages/workflow-core/src/lib/plugins/external-plugin/ballerine-plugin.ts
    • apps/backoffice-v2/src/pages/MerchantMonitoringCreateCheck/hooks/useMerchantMonitoringCreateBusinessReportPageLogic/useMerchantMonitoringCreateBusinessReportPageLogic.tsx
    • (and others as listed in the shell script output)

Please ensure all instances are updated consistently to prevent any runtime issues.

🔗 Analysis chain

Approve the change to camelCase naming convention.

The change from 'merchant-monitoring' to 'merchantMonitoring' improves consistency with typical JavaScript/TypeScript naming conventions for variables and properties.

To ensure this change doesn't introduce bugs, please verify all usages of this constant across the codebase. Run the following script to check for any remaining occurrences of 'merchant-monitoring':

Additionally, consider updating the file name from 'merchant-monitoring.process-tracker.ts' to 'merchantMonitoring.process-tracker.ts' for consistency if this naming pattern is used for other files in the project.


To resolve the issue with the shell scripts, please run the following corrected scripts to verify the changes:


To address the issues with the previous shell scripts, please run the following corrected scripts to verify the changes:


To fix the shell script errors, please run the following corrected scripts that exclude specific image file extensions using the -g flag:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining occurrences of 'merchant-monitoring' in the codebase

# Test: Search for 'merchant-monitoring' in all files. Expect: No results if all occurrences have been updated.
rg --type-not binary --type-not svg --type-not image "merchant-monitoring"

# Test: Search for 'merchantMonitoring' to verify the new naming is used consistently. Expect: At least one result in this file.
rg --type-not binary --type-not svg --type-not image "merchantMonitoring"

Length of output: 210


Script:

#!/bin/bash
# Description: Search for any remaining occurrences of 'merchant-monitoring' in the codebase

# Test: Search for 'merchant-monitoring' in all files excluding SVG and image types. Expect: No results if all occurrences have been updated.
rg --type-not svg --type-not image "merchant-monitoring"

# Test: Search for 'merchantMonitoring' to verify the new naming is used consistently. Expect: At least one result in this file.
rg --type-not svg --type-not image "merchantMonitoring"

Length of output: 172


Script:

#!/bin/bash
# Description: Search for any remaining occurrences of 'merchant-monitoring' in the codebase excluding common image file types.

# Test: Search for 'merchant-monitoring' in all files excluding SVG, PNG, JPG, JPEG, and GIF. Expect: No results if all occurrences have been updated.
rg --type-not svg --type-not png --type-not jpg --type-not jpeg --type-not gif "merchant-monitoring"

# Test: Search for 'merchantMonitoring' to verify the new naming is used consistently. Expect: At least one result in this file.
rg --type-not svg --type-not png --type-not jpg --type-not jpeg --type-not gif "merchantMonitoring"

Length of output: 256


Script:

#!/bin/bash
# Description: Search for any remaining occurrences of 'merchant-monitoring' in the codebase excluding common image file types.

# Test: Search for 'merchant-monitoring' in all files excluding SVG, PNG, JPG, JPEG, and GIF. Expect: No results if all occurrences have been updated.
rg "merchant-monitoring" -g "!.svg" -g "!.png" -g "!.jpg" -g "!.jpeg" -g "!.gif"

# Test: Search for 'merchantMonitoring' to verify the new naming is used consistently. Expect: At least one result in this file.
rg "merchantMonitoring" -g "!.svg" -g "!.png" -g "!.jpg" -g "!.jpeg" -g "!.gif"

Length of output: 9479


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_HOOK_RESPONDED: [{ target: 'kyc_manual_review' }] },
on: { KYC_RESPONSE_RECEIVED: [{ 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_HOOK_RESPONDED: [{ target: 'kyc_manual_review' }] },
on: { KYC_RESPONSE_RECEIVED: [{ target: 'kyc_manual_review' }] },
},
get_kyc_session: {
tags: [StateTag.PENDING_PROCESS],
Expand Down
1 change: 1 addition & 0 deletions apps/kyb-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"start": "vite",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider differentiating between start and dev scripts

The addition of the "start": "vite" script creates redundancy with the existing "dev": "vite" script. This might lead to confusion among developers about which command to use.

Typically, in Node.js projects:

  • The start script is used to run the application in a production environment.
  • The dev script is used for development purposes.

Consider the following suggestions:

  1. If the intention is to have a production start command, modify the start script to run a production build:
    "start": "vite build && vite preview"
  2. If both commands are intended for development, consider removing one to avoid confusion:
    "dev": "vite"
  3. If there's a specific reason for having both, add comments in the package.json to explain the difference between start and dev.

"build": "tsc && vite build",
"lint": "eslint . --fix",
"format": "prettier --write .",
Expand Down
1 change: 1 addition & 0 deletions apps/workflows-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"spellcheck": "cspell \"*\"",
"dev": "vite --host",
"start": "vite",
"build": "tsc && vite build",
"lint": "eslint . --fix",
"format": "prettier --write .",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"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 Verification',
text: 'Registry Information',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Inconsistent Terminology Found

The term "Registry Verification" is still present in packages/workflow-core/src/lib/plugins/external-plugin/vendor-consts.ts. Please update it to "Registry Information" to maintain consistency across the codebase.

🔗 Analysis chain

LGTM! Consider verifying terminology consistency.

The change from "Registry Verification" to "Registry Information" looks good. It may provide a more accurate description of the process step.

To ensure consistency across the codebase, please run the following script to check for any remaining instances of "Registry Verification" that might need updating:

If any results are found, consider updating them for consistency with this change.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for "Registry Verification" in all TypeScript and TypeScript React files

rg --type-add 'typescript:*.{ts,tsx}' -t typescript 'Registry Verification'

Length of output: 191


Script:

#!/bin/bash
# Description: Comprehensive search for "Registry Verification" in all TypeScript and TypeScript React files

rg --type-add 'typescript:*.{ts,tsx}' -t typescript 'Registry Verification'

Length of output: 191

},
{
leftIcon: <CheckCircle2 size={18} className={`fill-green-500 stroke-white`} />,
Expand Down
19 changes: 16 additions & 3 deletions packages/workflow-core/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ 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 @@ -18,10 +20,21 @@ 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,
} as const satisfies Readonly<Record<ObjectValues<typeof PluginKind>, new (...args: any[]) => any>>;
[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
>
>;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('workflow-runner', () => {
server.close();
});

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