# ebrahim-nahid/bkash-citybankpaymentgatewayimplementation architecture

> Architecture diagram of the GitHub repository ebrahim-nahid/bkash-citybankpaymentgatewayimplementation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation
- Repository: https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation

## Overview

This is an ASP.NET MVC guest-checkout application with two separate payment routes: bKash tokenized checkout and City Bank card checkout. Each route records a pending transaction, calls its provider, handles the provider return, updates status, and presents success or failure. The controllers own those actions and use a shared EF Core context; Program configures SQL Server, sessions, and MVC routing. The excerpts do not show the Razor form wiring or full provider protocol, so those links are omitted or marked unverified.

Main entry points: [`Bkash&CityBankPaymentGatewayImplementation/Controllers/bKashController.cs`](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Controllers/bKashController.cs) (bKash controller), [`Bkash&CityBankPaymentGatewayImplementation/Controllers/CityBankController.cs`](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Controllers/CityBankController.cs) (City Bank controller), [`Bkash&CityBankPaymentGatewayImplementation/Repository/AppDbContext.cs`](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Repository/AppDbContext.cs) (EF Core context), [`Bkash&CityBankPaymentGatewayImplementation/Program.cs`](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Program.cs) (Application startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_program["Application startup<br/>[Program.cs]"]
  node_home_controller["Home controller<br/>[HomeController.cs]"]
end

subgraph group_bkash["bKash checkout"]
  node_bkash_controller["bKash controller<br/>[bKashController.cs]"]
  node_bkash_records["bKash transaction model"]
  node_bkash_views["bKash payment views"]
end

subgraph group_city["City Bank checkout"]
  node_city_controller["City Bank controller"]
  node_city_records["City Bank transaction model"]
  node_city_views["City Bank payment views"]
end

subgraph group_persistence["Transaction persistence"]
  node_dbcontext["EF Core context<br/>[AppDbContext.cs]"]
end

subgraph group_presentation["User interface"]
  node_home_views["Home and shared views"]
  node_error_model["Error view model<br/>[ErrorViewModel.cs]"]
end

node_guest(("Guest"))
node_bkash_service{{"bKash gateway"}}
node_city_service{{"City Bank gateway"}}
node_sql[("SQL Server")]

node_guest -.->|"starts checkout"| node_bkash_controller
node_guest -.->|"starts checkout"| node_city_controller
node_program -->|"registers context"| node_dbcontext
node_program -->|"configures SQL Server"| node_sql
node_bkash_controller -->|"saves and updates"| node_dbcontext
node_bkash_controller -->|"creates records"| node_bkash_records
node_dbcontext -->|"stores"| node_bkash_records
node_bkash_controller -->|"requests payment"| node_bkash_service
node_bkash_service -->|"returns callback"| node_bkash_controller
node_bkash_controller -->|"renders results"| node_bkash_views
node_city_controller -->|"saves and updates"| node_dbcontext
node_city_controller -->|"creates records"| node_city_records
node_dbcontext -->|"stores"| node_city_records
node_city_controller -->|"creates session"| node_city_service
node_city_service -->|"returns redirect"| node_city_controller
node_city_controller -->|"renders results"| node_city_views
node_home_controller -.->|"renders pages"| node_home_views
node_home_controller -->|"creates error model"| node_error_model

click node_program "https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Program.cs"
click node_bkash_controller "https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Controllers/bKashController.cs"
click node_bkash_records "https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Models/bKashTransaction.cs"
click node_bkash_views "https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/tree/master/Bkash%26CityBankPaymentGatewayImplementation/Views/bKash"
click node_city_controller "https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Controllers/CityBankController.cs"
click node_city_records "https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Models/CityBankTransaction.cs"
click node_city_views "https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/tree/master/Bkash%26CityBankPaymentGatewayImplementation/Views/CityBank"
click node_dbcontext "https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Repository/AppDbContext.cs"
click node_home_controller "https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Controllers/HomeController.cs"
click node_home_views "https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/tree/master/Bkash%26CityBankPaymentGatewayImplementation/Views"
click node_error_model "https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Models/ErrorViewModel.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_program,node_home_controller toneBlue
class node_bkash_controller,node_bkash_records,node_bkash_views,node_sql toneAmber
class node_city_controller,node_city_records,node_city_views toneMint
class node_dbcontext toneRose
class node_home_views,node_error_model,node_guest,node_bkash_service,node_city_service toneIndigo
```

## Components

### Web application

- [Application startup](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Program.cs): `Bkash&CityBankPaymentGatewayImplementation/Program.cs`
- [Home controller](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Controllers/HomeController.cs): `Bkash&CityBankPaymentGatewayImplementation/Controllers/HomeController.cs`

### bKash checkout

- [bKash controller](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Controllers/bKashController.cs): `Bkash&CityBankPaymentGatewayImplementation/Controllers/bKashController.cs`
- [bKash transaction model](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Models/bKashTransaction.cs): `Bkash&CityBankPaymentGatewayImplementation/Models/bKashTransaction.cs`
- [bKash payment views](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/tree/master/Bkash%26CityBankPaymentGatewayImplementation/Views/bKash): `Bkash&CityBankPaymentGatewayImplementation/Views/bKash`

### City Bank checkout

- [City Bank controller](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Controllers/CityBankController.cs): `Bkash&CityBankPaymentGatewayImplementation/Controllers/CityBankController.cs`
- [City Bank transaction model](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Models/CityBankTransaction.cs): `Bkash&CityBankPaymentGatewayImplementation/Models/CityBankTransaction.cs`
- [City Bank payment views](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/tree/master/Bkash%26CityBankPaymentGatewayImplementation/Views/CityBank): `Bkash&CityBankPaymentGatewayImplementation/Views/CityBank`

### Transaction persistence

- [EF Core context](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Repository/AppDbContext.cs): `Bkash&CityBankPaymentGatewayImplementation/Repository/AppDbContext.cs`

### User interface

- [Home and shared views](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/tree/master/Bkash%26CityBankPaymentGatewayImplementation/Views): `Bkash&CityBankPaymentGatewayImplementation/Views`
- [Error view model](https://github.com/ebrahim-nahid/bkash-citybankpaymentgatewayimplementation/blob/master/Bkash%26CityBankPaymentGatewayImplementation/Models/ErrorViewModel.cs): `Bkash&CityBankPaymentGatewayImplementation/Models/ErrorViewModel.cs`

### Other components

- **Guest**
- **bKash gateway**
- **City Bank gateway**
- **SQL Server**

## Connections

- Guest → bKash controller: starts checkout
- Guest → City Bank controller: starts checkout
- Application startup → EF Core context: registers context (evidence: `Bkash&CityBankPaymentGatewayImplementation/Program.cs`)
- Application startup → SQL Server: configures SQL Server (evidence: `Bkash&CityBankPaymentGatewayImplementation/Program.cs`)
- bKash controller → EF Core context: saves and updates (evidence: `Bkash&CityBankPaymentGatewayImplementation/Controllers/bKashController.cs`)
- bKash controller → bKash transaction model: creates records (evidence: `Bkash&CityBankPaymentGatewayImplementation/Controllers/bKashController.cs`)
- EF Core context → bKash transaction model: stores (evidence: `Bkash&CityBankPaymentGatewayImplementation/Repository/AppDbContext.cs`)
- bKash controller → bKash gateway: requests payment (evidence: `Bkash&CityBankPaymentGatewayImplementation/Controllers/bKashController.cs`)
- bKash gateway → bKash controller: returns callback (evidence: `Bkash&CityBankPaymentGatewayImplementation/Controllers/bKashController.cs`)
- bKash controller → bKash payment views: renders results (evidence: `Bkash&CityBankPaymentGatewayImplementation/Controllers/bKashController.cs`)
- City Bank controller → EF Core context: saves and updates (evidence: `Bkash&CityBankPaymentGatewayImplementation/Controllers/CityBankController.cs`)
- City Bank controller → City Bank transaction model: creates records (evidence: `Bkash&CityBankPaymentGatewayImplementation/Controllers/CityBankController.cs`)
- EF Core context → City Bank transaction model: stores (evidence: `Bkash&CityBankPaymentGatewayImplementation/Repository/AppDbContext.cs`)
- City Bank controller → City Bank gateway: creates session (evidence: `Bkash&CityBankPaymentGatewayImplementation/Controllers/CityBankController.cs`)
- City Bank gateway → City Bank controller: returns redirect (evidence: `Bkash&CityBankPaymentGatewayImplementation/Controllers/CityBankController.cs`)
- City Bank controller → City Bank payment views: renders results (evidence: `Bkash&CityBankPaymentGatewayImplementation/Controllers/CityBankController.cs`)
- Home controller → Home and shared views: renders pages
- Home controller → Error view model: creates error model (evidence: `Bkash&CityBankPaymentGatewayImplementation/Controllers/HomeController.cs`)
