This is the server-side application FinPay Server. The server is connected to Autonomous Database (ADB) available on Oracle Cloud Infrastructure (OCI). Once the server is running, it checks the status of ADB and if that is currently not available, then restarts the provisioned ADB. For additional security, there is multi-factor authentication (MFA) available using Google Authenticator. Google Authenticator provides offline TOTP service which is better and safer then traditional sms-based MFA.
- Creation of User account
- Fetch User details
- Updating of User details
- Delete User account
- Deposit money
- Withdraw money
- Peer-to-Peer (P2P) transfer
- Register for MFA
To run this application on your location system, the following installations are needed:
- Node.Js
- NPM Module
- Oracle Cloud Infrastructure (Free Tier)
- Oracle ADB (Free Tier) or MongoDB
- Oracle Home (Instant Client or Oracle XE) (Optional for NoSQL)
- OCI SDK (Optional for NoSQL)
- Authenticator App (Optional)
URL: http://(localhost):(port)/api
Note: If the Oracle ADB is not available for use, i.e. service is unavailable, kindly check the
Retry-After
header for the wait time.
{URL}/users/:id
Description: This request will fetch the user from the Database where :id
matches with unique auto-generated user id.
Authorization: Basic Auth (Username & Password) and MFA Token (Optional)
{URL}/users
Description: This request will fetch the user from the Database where query matches with the registered user.
Authorization: Basic Auth (Username & Password) and MFA Token (Optional)
Query Parameters:
Key | Value | Description |
---|---|---|
id | 15 | user's unique user id |
username | user52 | registered username |
dummy15@invalid.com | registered email id | |
mobile | 5255555555 | registered mobile no |
totalResults | True | total count of records |
Request Sample: (If MFA is enabled)
{ "enable2FA": "Y" }
Response Sample:
{ "status": 200, "totalResults": 1, "items": [ { "USER_ID": 15, "FIRST_NAME": "user15", "LAST_NAME": "52", "USERNAME": "user52", "EMAIL": "dummy15@invalid.com", "MOBILE": "5255555555", "VERIFIED": "N", "MOBILE_VERIFIED": "N", "EMAIL_VERIFIED": "N", "MEMBER_SINCE": "May-2022", "LAST_UPDATE": "09-May-2022" } ] }
{URL}/users/login
Description: The user can login to their account using the request.
Authorization: Basic Auth (Username & Password) and MFA Token (Optional)
Request Sample: (MFA Enabled)
{ "token": 719625 }
Request Sample: (MFA Not-Enabled)
{}
Response Sample:
{ "status": 200, "message": "Welcome back user52!!", "userId": 15 }
{URL}/users/register
Description: New users can register themselves by creating an account
Authorization: None
Request Sample:
{ "user": { "firstName": "user", "lastName": "11", "username": "user11", "password": "password", "email": "dummy11@invalid.com", "mobile": 4116543110 } }
Response Sample:
{ "status": 201, "message": "User Created!!" "userId": 15 }
{URL}/users/mfa
Description: Users who have verified their account (email verification or phone number verification is successful) can register themselves for MFA. This will help them to secure their account. For enabling MFA, the enable2FA
flag is mandatory.
Authorization: Basic Auth (Username & Password)
Request Sample:
{ "enable2FA": "Y" }
Response Sample:
QR Code will be sent as a file stream.
{URL}/users/verify
Description: Users who have enabled MFA, can verify their account using TOTP.
Authorization: Basic Auth (Username & Password)
Request Sample:
{ "token": 740875 }
Response Sample:
{ "status": 200, "message": "" "verified": true }
{URL}/txn/exchange
Description: This endpoint is used for transferring money between accounts. Default currency is INR. There are 3 Modes:
- Deposit: Deposit money from third-party account to this account. Minimum amount is INR 100.
- Withdraw: Withdraw money this account to third-party account.
- P2P: Peer-to-Peer money transfer. The sender has to pay 2% commission on each transaction.
Authorization: Basic Auth (Username & Password) and MFA Token (Optional)
Request Sample: Deposit/Withdraw
{ "sourceId": 15, "targetId": 15, "currency": "INR", "amount": 105, "mode": "deposit", "method": "card", "gateway": "default", "description": "sample txn" }
Request Sample: P2P
{ "sourceId": 15, "targetId": 25, "currency": "INR", "amount": 100, "mode": "p2p", "method": "default", "gateway": "default", "description": "sample txn 2" }
Response Sample:
{ "status": 200, "message": "Amount transfer successful!" }
{URL}/users/:id
Description: The user can update their account details except Username. Here, :id
matches with unique auto-generated user id to update the user details. Each user can only update their own details.
Authorization: Basic Auth (Username & Password) and MFA Token (Optional)
Request Sample:
{ "lastName": "52", "mobile": 5255555555 }
Response Sample:
{ "status": 200, "message": "User details updated!" }
{URL}/users/mfa
Description: The user can remove their MFA and shift back to single factor authentication. Once the MFA token is deleted, HTTP status code of 204
will be sent back.
Authorization: Basic Auth (Username & Password) and MFA Token
Request Sample:
{ "token": 740875 }
{URL}/users/:id
Description: The user can delete their user account. Here, :id
is the auto-generated unique id. The details of user account should match with their authorization details. Each user can delete only their own account. Once the account is deleted, HTTP status code of 204
means the deletion was successful.
Authorization: Basic Auth (Username & Password) and MFA Token (Optional)