This api can create Wallets as Bank account and generate VISA cards to those accounts.
This simple project is fully tested and can be deployed with few commands.
A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
This project has been built using NestJS Framework and following CQRS practices in order to segragate Buisness Logic layer as well as enable the project to use Event Driven Design practices.
$ npm install
# start required services
docker-compose up -d
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
the project will now be available in http:localhost:3000
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
This project was build using NestJS coupled with Postgres v12 and deployed on docker-compose for simplicity
We use an external service for the exchange rates https://api.exchangeratesapi.io
And finally we use SQLite for integration testing.
This is the front-end documentation in order to implement these services on a front-end application
Please note that amounts or balance are represented in cents, therefore
1000 EUR
equals10€
In order to identify each user, you need the following Headers to each request
X-User-Id : {userId}
X-Company-Id : {companyId}
Where userId
and companyId
are valid uuid V4
identifiers
This route creates a Wallet using the company Identifier within the Headers. Thus you can create as many wallets in any of the currencies available.
Expected Payload Example
{
"balance": 10000,
"currency": "GDP"
}
Expected Output
{
"id": "6050726e-fc5c-4778-90a1-9175af09b647"
}
This route retrieves all the wallets associated to the company Id used in the Create Wallet Method.
Expected output
[
{
"id": "6050726e-fc5c-4778-90a1-9175af09b647",
"currentBalance": 10500,
"currency": "GBP",
"companyId": "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0e"
},
{
"id": "f921308b-57cd-4ba5-aba6-6c9aa5bffad7",
"currentBalance": 8500,
"currency": "GBP",
"companyId": "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0e"
},
{
"id": "2c4e45ec-5e07-4152-b225-b0a29d6b6abf",
"currentBalance": 11070,
"currency": "EUR",
"companyId": "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0e"
}
]
Where {walletId} equals the Wallet Id from where the funds are dispatched
Expected Input
{
"destinationWalletId": "2c4e45ec-5e07-4152-b225-b0a29d6b6abf",
"amount": 50
}
destinationWalletId is the wallet where you would send the funds too.
Please Note that you are only able to send funds to your own wallets, you cannot send funds to another company's wallet Also, if you send funds to a wallet with a different currency, we will charge a fee of 2,9%
Expected Output
HTTP 201 Status
When creating a card, this one if associated to a single Wallet and can only be used with the wallet's currency.
Expected Input
{
"walletId": "2c4e45ec-5e07-4152-b225-b0a29d6b6abf"
}
Expected Output
{
"id": "6050726e-fc5c-4778-90a1-9175af09b647"
}
The id of your newly created Card associated to the walletId shown above.
HTTP STATUS 201
This method returns all the cards associated to your userId only, you will not be able to see all the cards of the company as you would for the wallets.
Expected Output
[
{
"expirationDate": "2020-11-04",
"status": false,
"id": "a45bd449-da60-4cf5-8313-ed0b4b293ebf",
"currency": "EUR",
"currentBalance": 10000,
"number": "4929854096154034",
"ccv": "223",
"userId": "3b8cbd4b-2365-4ab1-a907-8e28c75225fb",
"walletId": "2c4e45ec-5e07-4152-b225-b0a29d6b6abf"
}
]
HTTP STATUS 200
You can block a card that is associated to your userId only. When blocking a card, all the remaining funds are automatically unloaded and placed back into the Wallet account. You can undo this at a latter date by unblocking the card and loading funds back on the card manually.
Expected Input
No payload required
Expected Output
HTTP STATUS 201
This method enables you to reactivate a blocked card.
Expected Input
No payload required
Expected Output
HTTP STATUS 201
This method enables you to move funds only from the wallet associated to your card.
Expected Input
{
"amount": 1200
}
Expected Output
HTTP STATUS 201
This method lets you remove funds from your card back into your wallet
Expected Input
{
"amount": 1200
}
Expected Output
HTTP STATUS 201