An open API service indexing awesome lists of open source software.

https://github.com/mongodb-developer/fsidemo-payments

Conceptual demo for MongoDB Enterprise capabilities used to build a payments demo.
https://github.com/mongodb-developer/fsidemo-payments

Last synced: 3 months ago
JSON representation

Conceptual demo for MongoDB Enterprise capabilities used to build a payments demo.

Awesome Lists containing this project

README

        

# MongoDB FSI Payments Demo

This project is built to facilitate a MongoDB payments solution: [Payments Modernization Accelerator](https://www.mongodb.com/solutions/solutions-library/payments-modernization) based on our MongoDB for [Payments](https://www.mongodb.com/use-cases/payments) vision:
![Overview](https://webimages.mongodb.com/_com_assets/cms/llcgrv7qgszjis2h7-image2.png?auto=format%252Ccompress)

The Stack is :
- Node JS microservices server/s
- MongoDB Atlas/Enterprise
- Kafka streams
- AWS KMS

### Features Covered

**Cross Microservices**
- Indexing and Scalability
- JSON Schema Validation
- Permission and Data Segregation
- Auditing

**User & Account Microservices***:
- Document Model : Flexible user and account structure for different accounts and user profiles
- Kafka Streaming Sink : Data being streamed from external sources
- Transactions (User to Account references) : Keeping account and user data ACID compliant
- In-Use Encryption
- Full text search : Account ids and usernames are searchable for users to pick via full text search.

**Transactions & Payments Microservices**
- Change Streams: Payments are event driven by transactions
- Time Series for transaction history :Transaction history is built in a time series collection
- In-Use Encryption

**Notification Microservices**
- Kafka source : Notifications are being downstreamed to external systems and users via kafka
- Change Streams: Notifications are being captured by change streams and pushed via Websockets

**Reports**
- Materialized Views : Materialized views are built to preprocess and clear sensitive data for reporting
- Charts

## Getting Started

- Setup Atlas Cluster 7.0+
- Setup users:
This code should be run with Atlas CLI : https://www.mongodb.com/docs/atlas/cli/stable/ after you auth against the relevant project
Create custom roles:
```
atlas customDbRoles create user_management_role --privilege [email protected],FIND@_encrypt,[email protected],INSERT@_encrypt,[email protected],REMOVE@_encrypt,[email protected],UPDATE@_encrypt,[email protected],[email protected],BYPASS_DOCUMENT_VALIDATION@_encrypt,[email protected],CREATE_COLLECTION@_encrypt,CREATE_COLLECTION@FSI,[email protected],CREATE_INDEX@_encrypt,CREATE_INDEX@FSI,[email protected],DROP_COLLECTION@_encrypt,DROP_COLLECTION@FSI,[email protected],CHANGE_STREAM@_encrypt,DROP_DATABASE@_encrypt,RENAME_COLLECTION_SAME_DB@_encrypt,LIST_COLLECTIONS@FSI

atlas customDbRoles create account_management_role --privilege [email protected],FIND@_encrypt,[email protected],INSERT@_encrypt,[email protected],REMOVE@_encrypt,[email protected],UPDATE@_encrypt,[email protected],[email protected],BYPASS_DOCUMENT_VALIDATION@_encrypt,[email protected],CREATE_COLLECTION@_encrypt,CREATE_COLLECTION@FSI,[email protected],CREATE_INDEX@_encrypt,CREATE_INDEX@FSI,[email protected],DROP_COLLECTION@_encrypt,[email protected],CHANGE_STREAM@_encrypt,[email protected],COLL_MOD@_encrypt,[email protected],COMPACT@_encrypt,[email protected],CONVERT_TO_CAPPED@_encrypt,[email protected],DROP_INDEX@_encrypt,[email protected],RE_INDEX@_encrypt,[email protected],COLL_STATS@_encrypt,[email protected],DB_HASH@_encrypt,[email protected],LIST_INDEXES@_encrypt,[email protected],VALIDATE@_encrypt,ENABLE_PROFILER@_encrypt,DROP_DATABASE@_encrypt,RENAME_COLLECTION_SAME_DB@_encrypt,DB_STATS@_encrypt,LIST_COLLECTIONS@_encrypt,LIST_COLLECTIONS@FSI --inheritedRole readWrite@FSI

atlas customDbRoles create transaction_management --privilege [email protected],FIND@_encrypt,[email protected],INSERT@_encrypt,[email protected],REMOVE@_encrypt,[email protected],UPDATE@_encrypt,[email protected],[email protected],BYPASS_DOCUMENT_VALIDATION@_encrypt,[email protected],CREATE_COLLECTION@_encrypt,CREATE_COLLECTION@FSI,CREATE_INDEX@_encrypt,CREATE_INDEX@FSI,ENABLE_PROFILER@_encrypt,DROP_DATABASE@_encrypt,RENAME_COLLECTION_SAME_DB@_encrypt,DB_STATS@_encrypt,LIST_COLLECTIONS@_encrypt,LIST_COLLECTIONS@FSI

atlas customDbRoles create payment_management_role --privilege [email protected],[email protected]

atlas customDbRoles create notification_management_role --privilege [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
```

create users and associate with the relevant custom role.

- user_management
- account_management
- transaction_management
- payment_management
- notification_management

- Setup KMS (Optional)
- Setup Kafka Confluent (Optional)

### Install

Clone the repo:
```
git clone https://github.com/mongodb-developer/FSIDemo-Payments.git
```

Download your OS shared crypt library for FLE : Download here https://www.mongodb.com/docs/manual/core/queryable-encryption/reference/shared-library/#std-label-qe-reference-shared-library-download

Unzip and place the library main file in an accessible route. (eg. for github codespace use version `mongo_crypt_shared_v1-linux-x86_64-enterprise-ubuntu2004-*.tgz`)

Verify permissions and that the OS does not block it. (In MAC OS the system will usually block the file and you will need to unblock via system settings)
```
chmod 755
```

Install the repo:
```
npm install
```

Setup the .env file:
```
## Encrytion

# Shared Library file path for queryable encryption
SHARED_LIB_PATH="" # Download here https://www.mongodb.com/docs/manual/core/queryable-encryption/reference/shared-library/#std-label-qe-reference-shared-library-download

# AWS Credentials - Optional

AWS_ACCESS_KEY_ID=""
AWS_SECRET_ACCESS_KEY=""
AWS_KEY_REGION=""
AWS_KEY_ARN=""

# Microservices
## !IMPORTANT: Fill in the created users

USER_MANAGEMENT_USR=
USER_MANAGEMENT_PWD=

ACCOUNT_MANAGEMENT_USR=
ACCOUNT_MANAGEMENT_PWD=

TRANSACTION_MANAGEMENT_USR=
TRANSACTION_MANAGEMENT_PWD=

PAYMENT_MANAGEMENT_USR=
PAYMENT_MANAGEMENT_PWD=

NOTIFICATION_MANAGEMENT_USR=
NOTIFICATION_MANAGEMENT_PWD=

```

Setup database configuration under `config/dev.js` (eg. `dbCluster : cluster0.abcd.mongodb.net`):
```
module.exports = {
dbCluster : '',
dbName : 'FSI'
}

```

### Start the application

Start the application
```
npm start
```

### Test using postman:

Load `Payments.postman_collection.json` and run the sequence.

### Web UI

Go to http://localhost:3030/app (or codespaces: `https://-3030.app.github.dev/app`)

## Desclaimer

**This product is not a MongoDB official product. Use at your own risk!**