Skip to content

Commit 21cfc50

Browse files
committed
refactoring
1 parent 88a5494 commit 21cfc50

File tree

99 files changed

+47517
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+47517
-6
lines changed

payments/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ We use Makefile for build and deploy.
1313
$> make help # show help message with all commands and targets
1414
```
1515

16+
### Payment Providers
17+
18+
The service supports multiple payment providers. Configuration details are available in each provider's documentation:
19+
20+
- **[Stripe Provider](./internal/adapter/stripe/README.md)** - Default provider for international payments
21+
- **[Tinkoff Provider](./internal/adapter/tinkoff/README.md)** - Provider for Russian payments with TLS client certificate authentication
22+
1623
### ADR
1724

1825
- [ADR-0001](./docs/ADR/decisions/0001-init.md) - Init project
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Stripe Payment Provider
2+
3+
This package provides integration with Stripe payment processing service.
4+
5+
## Configuration
6+
7+
### Environment Variables
8+
9+
| Variable | Description | Required |
10+
|----------|-------------|----------|
11+
| `STRIPE_API_KEY` | Stripe API key (starts with `sk_`) | Yes |
12+
13+
### Example Configuration
14+
15+
```bash
16+
export STRIPE_API_KEY=sk_test_...
17+
```
18+
19+
### API Key Types
20+
21+
- **Test keys**: Start with `sk_test_` - use for development and testing
22+
- **Live keys**: Start with `sk_live_` - use for production
23+
24+
## Usage
25+
26+
The Stripe provider is automatically selected when:
27+
- `PAYMENT_PROVIDER` is set to `stripe`
28+
- `PAYMENT_PROVIDER` is not set (default behavior)
29+
30+
## Error Handling
31+
32+
- `ErrMissingAPIKey`: Returned when `STRIPE_API_KEY` environment variable is not set
33+
34+
## Implementation Details
35+
36+
The provider uses the official Stripe Go SDK (v82) and automatically configures the client with the provided API key.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Tinkoff Payment Provider
2+
3+
This package provides integration with Tinkoff Bank payment processing service.
4+
5+
## Configuration
6+
7+
### Environment Variables
8+
9+
| Variable | Description | Required |
10+
|----------|-------------|----------|
11+
| `TINKOFF_API_KEY` | Tinkoff API key for authentication | Yes |
12+
| `TINKOFF_CERT_FILE` | Path to client certificate file (.pem) | Yes |
13+
| `TINKOFF_KEY_FILE` | Path to client private key file (.key) | Yes |
14+
| `TINKOFF_BASE_URL` | Base URL for Tinkoff API | No (defaults to https://secured-openapi.tbank.ru) |
15+
16+
### Example Configuration
17+
18+
```bash
19+
export TINKOFF_API_KEY=your_tinkoff_api_key
20+
export TINKOFF_CERT_FILE=/path/to/your/cert.pem
21+
export TINKOFF_KEY_FILE=/path/to/your/key.key
22+
export TINKOFF_BASE_URL=https://secured-openapi.tbank.ru
23+
```
24+
25+
## Setup
26+
27+
To use Tinkoff as a payment provider, you need to:
28+
29+
1. Obtain client certificates from Tinkoff
30+
2. Set up the required environment variables
31+
3. Configure the payment details (currently hardcoded for demo purposes)
32+
33+
## Usage
34+
35+
The Tinkoff provider is selected when `PAYMENT_PROVIDER` is set to `tinkoff`:
36+
37+
```bash
38+
export PAYMENT_PROVIDER=tinkoff
39+
```
40+
41+
## Error Handling
42+
43+
- `ErrMissingAPIKey`: Returned when `TINKOFF_API_KEY` environment variable is not set
44+
- `ErrMissingCertFile`: Returned when `TINKOFF_CERT_FILE` environment variable is not set
45+
- `ErrMissingKeyFile`: Returned when `TINKOFF_KEY_FILE` environment variable is not set
46+
47+
## Production Configuration
48+
49+
The following fields in the Tinkoff payment request are currently hardcoded and should be configured for production:
50+
51+
- `From.AccountNumber` - Your Tinkoff account number
52+
- `To.Name` - Recipient name
53+
- `To.INN` - Recipient INN
54+
- `To.KPP` - Recipient KPP
55+
- `To.BIK` - Bank BIK
56+
- `To.BankName` - Bank name
57+
- `To.CorrAccountNumber` - Correspondent account number
58+
- `To.AccountNumber` - Recipient account number
59+
- `Tax.KBK` - Budget classification code
60+
- `Tax.OKTMO` - OKTMO code
61+
62+
These should be moved to configuration files or environment variables for production use.
63+
64+
## Implementation Details
65+
66+
The provider uses mutual TLS authentication with client certificates and makes HTTP requests to the Tinkoff API endpoints.
88 MB
Binary file not shown.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Квалифицированный инвестор
2+
3+
Согласно законодательству Российской Федерации, физическое лицо должно иметь статус квалифицированного инвестора для доступа к операциям с определённым перечнем ценных бумаг. Например, для торгов ценными бумагами на иностранных биржах и активами на внебиржевом рынке — сплитированными и целыми лотами евробондов российских и зарубежных компаний, структурными нотами и многим другим.
4+
5+
Неквалифицированные инвесторы не могут торгововать ценными бумагами, которых нет на Бирже СПБ и ММВБ.
6+
7+
## Требования к квалифицированным инвесторам
8+
9+
Чтобы получить статус квалифицированного инвестора, нужно выполнить одно из условий:
10+
11+
* владеть активами на сумму от 6 млн рублей;
12+
* иметь опыт работы на финансовом рынке;
13+
* иметь профильное образование;
14+
* иметь оборот по сделкам от 6 млн рублей.
15+
16+
## Смотрите также
17+
18+
* [Подробнее про статус квалифицированного инвестора](https://www.tbank.ru/invest/help/educate/qualification/)
19+
20+
* [Как получить статус квалифицированного инвестора](https://www.tbank.ru/invest/help/educate/qualification/about/how-get/)
21+
22+
* [Как получить статус квалифицированного инвестора по опыту работы](https://www.tbank.ru/invest/help/educate/qualification/about/terms/)

0 commit comments

Comments
 (0)