Vault Workflow
📋 Overview​
Complete workflow for managing user vault accounts and vault transactions. The vault system allows users to create savings accounts, transfer money to/from vault, lock funds for specific periods, and manage vault maturity dates. This workflow covers all vault-related operations including account creation, balance display, money transfers, and fund locking.
🔄 Workflow Steps​
Step 1: Create Vault Account (Save User Wallet)​
- Purpose: Create a new vault account for the user by associating them with a saving wallet
- Prerequisites: User must be authenticated and have a valid user ID
- Process:
- Call the Get All Wallets API with
wallet_type = 3to get the main vault wallet ID - Extract the
wallet_idfrom the response (saving wallet type) - Call the Save User Wallet API to create the vault account
- Pass the vault
wallet_id,user_id,currency_id, and setis_default = false
- Call the Get All Wallets API with
- Result: User now has a vault account associated with their profile
Step 2: Display Vault Balance​
- Purpose: Show the current balance in the user's vault account
- Process:
- Call the Get All Wallets API with
wallet_type = 3to get vault wallet details - Call the Get All User Wallets API with
user_idandwallet_idto get user's vault balance - Extract the balance information from the response
- Display the vault balance to the user
- Call the Get All Wallets API with
- Result: User can see their current vault balance
Step 3: Add Money to Vault (Deposit)​
- Purpose: Transfer money from main wallet to vault account
- Process:
- Load Currency and Wallet Details: Follow the Common Transaction Flow
- Check Product and Calculate Charges:
- Call the Get User Profile API
- Call the Get Profile Product API with
product_code: "SWTR"(Sub Wallet Transfer) - Call the Calculate Charges API with
product_code: "SWTR"
- Execute Wallet Transfer:
- Call the Wallet Transfer Money API
- Set
txn_code: "SWW"(Sub Wallet Withdraw) - Configure transfer from main wallet to vault wallet
- Set
meta_data.source_wallet_name: "Gafa Wallet"andmeta_data.destination_wallet_name: "Vault+"
Add Money to Vault Request Example​
{
"charges_info": null,
"txn_amount": 10,
"payment_mode": 3,
"note": null,
"txn_code": "SWW",
"company_admin_user_info": {
"currency_id": "1f1519903ed240578f071aa45cb479f2",
"credit_type": 1,
"credit_type_id": "4010122e9d604e798b9a6e961df3e5b4",
"credit_account_type": 1,
"credit_account_type_id": "640b793d04e2428dbf19ab10399f4edb",
"username": "Mouhamad Amine"
},
"credit_user_info": {
"currency_id": "1f1519903ed240578f071aa45cb479f2",
"credit_type": 3,
"credit_type_id": "3a3d4e585aeb49e8bf3f3996fca0f82f",
"credit_account_type": 2,
"credit_account_type_id": "fb8f09210e0f46b7b4262d77f5b6c273",
"username": "Suresh Raina"
},
"debit_user_info": {
"currency_id": "1f1519903ed240578f071aa45cb479f2",
"debit_type": 1,
"debit_type_id": "4010122e9d604e798b9a6e961df3e5b4",
"debit_account_type": 2,
"debit_account_type_id": "fb8f09210e0f46b7b4262d77f5b6c273",
"username": "Suresh Raina"
},
"txn_device_info": {
"device_name": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
"os_name": "MacIntel",
"location": {},
"host_name": "localhost",
"url": "http://localhost:8000"
},
"meta_data": {
"source_wallet_name": "Gafa Wallet",
"destination_wallet_name": "Vault+"
}
}
Step 4: Withdraw Money from Vault​
- Purpose: Transfer money from vault account back to main wallet
- Process:
- Load Currency and Wallet Details: Follow the Common Transaction Flow
- Check Product and Calculate Charges:
- Call the Get User Profile API
- Call the Get Profile Product API with
product_code: "SWW"(Sub Wallet Withdraw) - Call the Calculate Charges API with
product_code: "SWW"
- Execute Wallet Transfer:
- Call the Wallet Transfer Money API
- Set
txn_code: "SWW" - Configure transfer from vault wallet to main wallet
- Set
meta_data.source_wallet_name: "Vault+"andmeta_data.destination_wallet_name: "Gafa Wallet"
Withdraw Money from Vault Request Example​
{
"charges_info": null,
"txn_amount": 10,
"payment_mode": 3,
"note": null,
"txn_code": "SWW",
"company_admin_user_info": {
"currency_id": "1f1519903ed240578f071aa45cb479f2",
"credit_type": 1,
"credit_type_id": "4010122e9d604e798b9a6e961df3e5b4",
"credit_account_type": 1,
"credit_account_type_id": "640b793d04e2428dbf19ab10399f4edb",
"username": "Mouhamad Amine"
},
"credit_user_info": {
"currency_id": "1f1519903ed240578f071aa45cb479f2",
"credit_type": 1,
"credit_type_id": "4010122e9d604e798b9a6e961df3e5b4",
"credit_account_type": 2,
"credit_account_type_id": "fb8f09210e0f46b7b4262d77f5b6c273",
"username": "Suresh Raina"
},
"debit_user_info": {
"currency_id": "1f1519903ed240578f071aa45cb479f2",
"debit_type": 3,
"debit_type_id": "3a3d4e585aeb49e8bf3f3996fca0f82f",
"debit_account_type": 2,
"debit_account_type_id": "fb8f09210e0f46b7b4262d77f5b6c273",
"username": "Suresh Raina"
},
"txn_device_info": {
"device_name": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
"os_name": "MacIntel",
"location": {},
"host_name": "localhost",
"url": "http://localhost:8000"
},
"meta_data": {
"source_wallet_name": "Vault+",
"destination_wallet_name": "Gafa Wallet"
}
}
Step 5: Lock Vault Amount​
- Purpose: Lock funds in the vault for a specific period to prevent withdrawals
- Process:
- Validate Lock Parameters:
- Ensure vault account exists for the user
- Validate lock amount is available in vault
- Set appropriate lock and maturity dates
- Create Wallet Lock:
- Call the Save User Wallet Lock API
- Pass
wallet_id(vault wallet),user_wallet_id,currency_id,locked_amount,locked_date, andmaturity_date
- Handle Response:
- If successful, show confirmation message
- If duplicate lock exists, show appropriate error message
- Validate Lock Parameters:
Step 6: Modify Vault Maturity Date​
- Purpose: Update the maturity date of an existing vault lock
- Process:
- Get Existing Lock Details:
- Call the Get All User Wallet Locks API to find the lock to modify
- Update Lock:
- Call the Update User Wallet Lock API
- Pass the lock
idand newmaturity_date
- Handle Response:
- If successful, show confirmation message
- If lock not found, show appropriate error message
- Get Existing Lock Details:
📡 API References​
Core Vault APIs​
- Get All Wallets API - Get vault wallet details
- Save User Wallet API - Create vault account
- Wallet Transfer Money API - Transfer money to/from vault
- Save User Wallet Lock API - Lock vault funds
- Get All User Wallet Locks API - Get vault lock details
- Update User Wallet Lock API - Modify vault lock
Common Transaction APIs​
- Get Currency Details API - Load currency information
- Get Company Main Wallet API - Get company wallet details
- Get Logged-In User Wallet API - Get user wallet information
- Get User Profile API - Get user profile for charges
- Get Profile Product API - Check product permissions
- Calculate Charges API - Calculate transaction charges
🔄 Flow Logic​
Vault Account Creation Flow​
User Request → Get Vault Wallet → Save User Wallet → Vault Account Created
Vault Balance Display Flow​
User Request → Get Vault Wallet → Get User Wallet → Display Balance
Vault Deposit Flow​
User Request → Load Currency/Wallet → Check SWTR Product → Calculate Charges → Transfer Money (Main → Vault) → Success
Vault Withdrawal Flow​
User Request → Load Currency/Wallet → Check SWW Product → Calculate Charges → Transfer Money (Vault → Main) → Success
Vault Lock Flow​
User Request → Validate Parameters → Save Wallet Lock → Lock Created
Vault Lock Update Flow​
User Request → Get Existing Lock → Update Lock → Lock Modified
💡 Key Implementation Notes​
Transaction Codes​
- SWTR: Sub Wallet Transfer (for adding money to vault)
- SWW: Sub Wallet Withdraw (for withdrawing money from vault)
Wallet Types​
- Type 3: Saving Wallet (Vault wallet type)
Account Types​
- Credit Type 1: Company Admin Account
- Credit Type 3: Vault Wallet Account
- Debit Type 1: Company Admin Account
- Debit Type 3: Vault Wallet Account
Meta Data Configuration​
- Deposit:
source_wallet_name: "Gafa Wallet",destination_wallet_name: "Vault+" - Withdrawal:
source_wallet_name: "Vault+",destination_wallet_name: "Gafa Wallet"
Error Handling​
- Duplicate Vault Account: Handle case where user already has a vault account
- Insufficient Balance: Check vault balance before withdrawal
- Lock Conflicts: Prevent duplicate locks for same user/wallet combination
- Invalid Dates: Validate lock and maturity dates
🎯 Use Cases​
Personal Savings​
- Users can create vault accounts for personal savings goals
- Lock funds for specific periods to prevent impulsive spending
- Track savings progress with balance display
Financial Planning​
- Set up structured savings plans with maturity dates
- Create multiple vault accounts for different savings goals
- Manage long-term financial objectives
Investment Preparation​
- Lock funds for investment opportunities
- Create time-bound savings for specific investments
- Manage investment capital allocation
Emergency Funds​
- Create locked emergency funds with specific maturity dates
- Ensure funds are available when needed
- Maintain financial discipline through fund locking