An simple API for a banking system. localhost:3000/api-docs/
npm install
The project is connected to mongodb atlas.
Create a .env
file in the root of the project and assign the mongodb connection string to
DB_CONN
.
Inside seeders are scripts you can run to populate the database
npm start
[
{
"_id": "5c780481c0d06446b82f2352",
"FirstName": "Leifsi",
"LastName": "P-Ozio",
"SocialNumber": "240482-3399",
"Address": "Dúfnahólum 12",
"City": "Breiðholt",
"email": "[email protected]",
"__v": 0
},
{
"_id": "5c780481c0d06446b82f2351",
"FirstName": "Bjarki",
"LastName": "Hrafninn Flýgur",
"SocialNumber": "240380-3299",
"Address": "Dúfnahólum 10",
"City": "Breiðholt",
"email": "[email protected]",
"__v": 0
}
]
{
"_id": "5c780481c0d06446b82f2352",
"FirstName": "Leifsi",
"LastName": "P-Ozio",
"SocialNumber": "240482-3399",
"Address": "Dúfnahólum 12",
"City": "Breiðholt",
"email": "[email protected]",
"__v": 0
}
Get all accounts
[
{
"_id": "5cb226a2a989aa17c80c7218",
"CustomerID": "5c780481c0d06446b82f2351",
"CurrentBalance": 5000,
"AccountType": "Debet",
"AccountNumber": "kt-26-2022",
"__v": 0
},
{
"_id": "5cb226a2a989aa17c80c7219",
"CustomerID": "5c780481c0d06446b82f2352",
"CurrentBalance": 50000,
"AccountType": "Vaxtareikningur",
"AccountNumber": "kt-26-2023",
"__v": 0
}
]
get account by id
{
"_id": "5cb226a2a989aa17c80c7218",
"CustomerID": "5c780481c0d06446b82f2351",
"CurrentBalance": 5000,
"AccountType": "Debet",
"AccountNumber": "kt-26-2022",
"__v": 0
}
find all accounts of customer
find all account per customer and type of account
create new account. Request body:
{
"CustomerID": "5c780481c0d06446b82f2351",
"CurrentBalance": 5000,
"AccountType": "Debet",
"AccountNumber": "kt-26-2022",
}
update account by id
{
"CurrentBalance": 5000
}
get all bills.
[
{
"_id": "5c8f946697b548098cc6efd2",
"CustomerID": "5c780481c0d06446b82f2351",
"PayerName": "Bjarki",
"Creditor": "LÍN",
"CreditorAccountNumber": "1108443139-26-222",
"DueDate": "2019-03-18T12:51:50.769Z",
"Deadline": "2019-03-18T12:51:50.769Z",
"Amount": 1500000,
"__v": 0
},
{
"_id": "5c8f946697b548098cc6efd3",
"CustomerID": "5c780481c0d06446b82f2351",
"PayerName": "Bjarki",
"Creditor": "Mæðrastyrksnefnd",
"CreditorAccountNumber": "1108443139-26-222",
"DueDate": "2019-03-18T12:51:50.779Z",
"Deadline": "2019-03-18T12:51:50.779Z",
"Amount": 15000,
"__v": 0
}
]
get bill by id.
{
"_id": "5c8f946697b548098cc6efd2",
"CustomerID": "5c780481c0d06446b82f2351",
"PayerName": "Bjarki",
"Creditor": "LÍN",
"CreditorAccountNumber": "1108443139-26-222",
"DueDate": "2019-03-18T12:51:50.769Z",
"Deadline": "2019-03-18T12:51:50.769Z",
"Amount": 1500000,
"__v": 0
}
gett all bills by customer
get all bills by customer and creditor
pay bill with billid from account
get all recipients.
[
{
"_id": "5c8f93f7ce04a78ad06a0128",
"CustomerID": "5c780481c0d06446b82f2351",
"FirstName": "Trigger",
"LastName": "Happy",
"AccountNumber": "2039863199-26-3039",
"__v": 0
},
{
"_id": "5c8f93f7ce04a78ad06a0129",
"CustomerID": "5c780481c0d06446b82f2352",
"FirstName": "Mumbly",
"LastName": "Mahooney",
"AccountNumber": "1008783399-26-2029",
"__v": 0
}
]
get recipient by recipientid.
{
"_id": "5c8f93f7ce04a78ad06a0128",
"CustomerID": "5c780481c0d06446b82f2351",
"FirstName": "Trigger",
"LastName": "Happy",
"AccountNumber": "2039863199-26-3039",
"__v": 0
}
get all recipients by customerid
Get recipient by customerid and recipient name
create a new recipient
{
"CustomerID": "5c780481c0d06446b82f2351",
"FirstName": "Trigger",
"LastName": "Happy",
"AccountNumber": "2039863199-26-3039"
}
get all stocks.
[
{
"_id": "5cb07e55f171ae06b0e66106",
"CompanyName": "Arion Banki hf.",
"ExchangeRate": 76.5,
"PriceChangePercent": -1.16,
"StockBid": 75.5,
"StockAsk": 76.5,
"Volume": 6619001313,
"Highest": 77.5,
"Lowest": 76.5,
"Currency": "ISK",
"__v": 0
},
{
"_id": "5cb07e55f171ae06b0e66107",
"CompanyName": "Icelandair Group hf.",
"ExchangeRate": 9.6,
"PriceChangePercent": 0.42,
"StockBid": 9.57,
"StockAsk": 9.6,
"Volume": 9997994,
"Highest": 9.61,
"Lowest": 9.6,
"Currency": "ISK",
"__v": 0
}
]
get stock by id.
{
"_id": "5cb07e55f171ae06b0e66106",
"CompanyName": "Arion Banki hf.",
"ExchangeRate": 76.5,
"PriceChangePercent": -1.16,
"StockBid": 75.5,
"StockAsk": 76.5,
"Volume": 6619001313,
"Highest": 77.5,
"Lowest": 76.5,
"Currency": "ISK",
"__v": 0
}
get stock by company name
get all creditcards.
[
{
"_id": "5c7be23bd2ad3833040cf76b",
"CustomerID": "5c780481c0d06446b82f2351",
"CurrentBalance": 20,
"CardType": "VISA",
"__v": 0
},
{
"_id": "5c7be23bd2ad3833040cf76c",
"CustomerID": "5c780481c0d06446b82f2351",
"CurrentBalance": 150000,
"CardType": "Mastercard",
"__v": 0
}
]
get creditcard by id.
{
"_id": "5c7be23bd2ad3833040cf76b",
"CustomerID": "5c780481c0d06446b82f2351",
"CurrentBalance": 20,
"CardType": "VISA",
"__v": 0
}
get all creditcards by customer
get all cards by customer and type of card
update creditcard. Requestbody:
{
"CurrentBalance" : 5000
}
```