-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
3,161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# App Configuration | ||
APP_API_KEY="" | ||
APP_WEBHOOK_KEY="" | ||
APP_AUTHORIZED_IPS=["::ffff:127.0.0.1","::1"] | ||
APP_PORT=8080 | ||
|
||
# Database Configuration | ||
DB_LINK="mongodb://localhost:27017/notifications" | ||
DB_PORT=27017 | ||
DB_TRANSACTIONS_COLLECTION=notifications | ||
DB_MESSAGES_COLLECTION=messages | ||
|
||
# Redis Configuration | ||
REDIS_HOST="127.0.0.1" | ||
REDIS_PORT=6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Docusaurus cache and generated files | ||
.docusaurus | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
.DS_Store | ||
|
||
__MACOSX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"tabWidth": 4, | ||
"printWidth": 80, | ||
"endOfLine": "auto", | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"options": { | ||
"parser": "typescript" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"service_providers": { | ||
"sms": { | ||
"auth_url": "https://auth.sms.to/oauth/token", | ||
"balance_url": "https://auth.sms.to/api/balance", | ||
"validate_url": "https://sms.to/v1/verify/number", | ||
"type": "Vendor", | ||
"name": "SMS", | ||
"code": "sms", | ||
"client_id": "", | ||
"secret_key": "" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"service_providers": { | ||
"sms": { | ||
"auth_url": "https://auth.sms.to/oauth/token", | ||
"balance_url": "https://auth.sms.to/api/balance", | ||
"validate_url": "https://sms.to/v1/verify/number", | ||
"type": "Vendor", | ||
"name": "SMS", | ||
"code": "sms", | ||
"client_id": "YCmEstHEjmSB7gEy", | ||
"secret_key": "9ZPe1aiixZ6xn0qINVhh81LtTG2vCrVq" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Payie Notification Service | ||
|
||
This project provides a Notification Service for Payie built with Node.js, allowing for sending email and SMS notifications. It leverages Nodemailer for email sending and Twilio for SMS sending. | ||
|
||
## Features | ||
|
||
- Send email notifications using SMTP settings. | ||
- Send SMS notifications using Twilio API. | ||
- Easy integration with the Payie payment applications. | ||
|
||
## Prerequisites | ||
|
||
Before you begin, ensure you have met the following requirements: | ||
|
||
- NodeJS version 18.17.0 or higher | ||
- Yarn 1.22.9 or higher OR NPM version 10.3.0 or higher | ||
- SMTP credentials for sending emails. | ||
- Twilio account with SID, Auth Token, and a Twilio phone number for sending SMS. | ||
- Testing: Jest for NodeJS | ||
- Version Control: Git | ||
|
||
## Installation | ||
|
||
Clone this repository to your local machine: | ||
|
||
```bash | ||
git clone https://github.com/Cank256/payie_node.git | ||
cd notification-service | ||
``` | ||
|
||
Install the required dependencies: | ||
```bash | ||
npm install | ||
``` | ||
|
||
## Configuration | ||
|
||
Create a .env file in the root directory and add your APP details and Database credentials: | ||
|
||
```makefile | ||
# App Configuration | ||
APP_API_KEY="" | ||
APP_WEBHOOK_KEY="" | ||
APP_AUTHORIZED_IPS=["::ffff:127.0.0.1","::1"] | ||
APP_PORT=8080 | ||
|
||
# Database Configuration | ||
DB_LINK="mongodb://localhost:27017/notifications" | ||
DB_PORT=27017 | ||
DB_TRANSACTIONS_COLLECTION=notifications | ||
DB_MESSAGES_COLLECTION=messages | ||
|
||
``` | ||
|
||
Note: Add provider details to the provider.json file as well. | ||
|
||
## Usage | ||
To use the notification service in your project, you can import the sendEmail and sendSMS functions: | ||
|
||
```javascript | ||
const { sendEmail } = require('./emailService'); | ||
const { sendSMS } = require('./smsService'); | ||
|
||
// Send an email | ||
sendEmail('[email protected]', 'Test Email', 'Hello, this is a test email from our notification service.'); | ||
|
||
// Send an SMS | ||
sendSMS('+1234567890', 'Hello, this is a test message from our notification service.'); | ||
``` | ||
|
||
## Contributing | ||
|
||
See [Project README](../README.md) for contribution instructions | ||
|
||
## License | ||
|
||
See the [LICENSE](../LICENSE) file in the root folder for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "payie_notification_service", | ||
"version": "1.0.0", | ||
"description": "Payie Payment Project Gateway using Node.js.", | ||
"main": "./dist/bin/www.js", | ||
"keywords": [], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Cank256/payie_node" | ||
}, | ||
"author": "Caleb Nkunze", | ||
"license": "MIT", | ||
"scripts": { | ||
"format": "prettier --write 'src/**/*.ts' --config .prettierrc", | ||
"build": "rimraf dist && tsc --build", | ||
"dev": "export NODE_ENV=development || set NODE_ENV=development&&rimraf dist && tsc --build && nodemon ./dist/bin/www.js", | ||
"start": "export NODE_ENV=development || set NODE_ENV=development&&pm2 start ./dist/bin/www.js --name payie_gateway", | ||
"stop": "pm2 stop payie_gateway", | ||
"restart": "export NODE_ENV=development || set NODE_ENV=development&&pm2 restart payie_gateway" | ||
}, | ||
"devDependencies": { | ||
"@types/body-parser": "^1.19.5", | ||
"@types/cookie-parser": "^1.4.6", | ||
"@types/errorhandler": "^1.5.3", | ||
"@types/morgan": "^1.9.9", | ||
"@types/node": "^20.10.4", | ||
"@typescript-eslint/eslint-plugin": "^6.14.0", | ||
"@typescript-eslint/parser": "^6.14.0", | ||
"nodemon": "^3.0.2", | ||
"prettier": "^3.1.1", | ||
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"body-parser": "^1.20.2", | ||
"cookie-parser": "^1.4.6", | ||
"cross-fetch": "^4.0.0", | ||
"dotenv": "^16.3.1", | ||
"express": "^4.18.2", | ||
"express-timeout-handler": "^2.2.2", | ||
"fs": "^0.0.1-security", | ||
"mongodb": "^6.3.0", | ||
"morgan": "^1.10.0", | ||
"nconf": "^0.12.1", | ||
"path": "^0.12.7", | ||
"pm2": "^5.3.0", | ||
"redis": "^4.6.11", | ||
"rimraf": "^5.0.5", | ||
"timers": "^0.1.1", | ||
"underscore.string": "^3.3.6", | ||
"uniqid": "^5.4.0" | ||
} | ||
} |
Oops, something went wrong.