Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.11 KB

Package.md

File metadata and controls

43 lines (33 loc) · 1.11 KB

Connects to a MySQL database and cache the blacklisted credit card accounts.

Overview

This package connects to a MySQL database and populates a table with the details of black listed card holders.

The database details can be configured through the configuration file Config.toml in the following format.

[CCTransactionApp.dbConnector]
username = "<USER_NAME>"
password = "<PASSWORD>"

[CCTransactionApp.dbConnector.database]
host = "<DATABASE_HOST>"
port = <DATABASE_PORT>
name = "<DATABASE_NAME>"

The database can be constructed with following script,

CREATE DATABASE `CREDIT_CARD`;
USE `CREDIT_CARD`;

CREATE TABLE `Accounts` (
  `Acc_no` int NOT NULL,
  `Card_ID` varchar(45) NOT NULL,
  `Name` varchar(45) NOT NULL,
  `PIN` int NOT NULL,
  `CVC` int DEFAULT NULL,
  PRIMARY KEY (`Acc_no`,`Card_ID`),
  UNIQUE KEY `Card_ID_UNIQUE` (`Card_ID`)
);

CREATE TABLE `BlackList` (
  `Card_ID` varchar(45) NOT NULL,
  PRIMARY KEY (`Card_ID`),
  UNIQUE KEY `Card_ID_UNIQUE` (`Card_ID`),
  CONSTRAINT `Card_ID` FOREIGN KEY (`Card_ID`) REFERENCES `Accounts` (`Card_ID`) ON DELETE CASCADE ON UPDATE CASCADE
);