/
Copy of Data Modeling for Wallet & Passbook

wallet

Field

Type

Comment

id

int(11) NOT NULL

Primary Key

account_id

bigint(20) NOT NULL

Foreign Key to Account

balance

double

Total available balance

cod_balance

double

COD balance, if applicable

created_at

TIMESTAMP


updated_at

TIMESTAMP


wallet_transactions

Field

Type

Comment

id

bigint(20) NOT NULL

Primary Key

wallet_id

int(11) NOT NULL

Foreign Key to Wallet

transaction_type

ENUM('DEPOSIT', ‘WITHDRAWAL', 'REFUND')

Type of transaction

amount

double

Transaction amount

amount_breakup

TEXT

JSON structure for all kinds of fees/charges

payment_method

ENUM('ONLINE_PAYMENT', 'BANK_TRANSFER', 'COD_BALANCE')


shipment_id

bigint(20)

Foreign Key to shipments table primary key

transactionReferenceId

varchar(100) NOT NULL

BANK transaction id

created_at

TIMESTAMP


updated_at

TIMESTAMP


wallet_transaction_logs

Field

Type

Comment

id

bigint(20) NOT NULL

Primary Key

wallet_transaction_id

bigint(20) NOT NULL

Foreign Key to Transaction table primary key

transaction_status

ENUM('ACCEPTED',”REJECTED','HOLD',UNHOLD')

transaction status

remarks

varchar(100)


additional_details

TEXT

JSON to store image_url

created_at

TIMESTAMP


updated_at

TIMESTAMP