# Payouts Service ## API Endpoints ### User Management #### Register User - **Path**: `/api/v1/user/register` - **Method**: POST - **Request Parameters**: ```json { "tin": "string", "phone": "string", "password": "string", "password_cfm": "string" } ``` - **Response Parameters**: ```json { "status": "string" } ``` - **Curl Example**: ```bash curl -X POST http://localhost:8080/api/v1/user/register \ -H "Content-Type: application/json" \ -d '{"tin":"1234567890","phone":"+79991234567","password":"password123","password_cfm":"password123"}' ``` #### User Login - **Path**: `/api/v1/user/login` - **Method**: POST - **Request Parameters**: ```json { "phone": "string", "password": "string" } ``` - **Response Parameters**: ```json { "token": "string", "token_ttl": "integer" } ``` - **Curl Example**: ```bash curl -X POST http://localhost:8080/api/v1/user/login \ -H "Content-Type: application/json" \ -d '{"phone":"+79991234567","password":"password123"}' ``` ### Payout Operations #### Get SBP Banks - **Path**: `/api/v1/payout/sbp/banks` - **Method**: GET - **Request Parameters**: None - **Response Parameters**: ```json { "type": "string", "items": [ { "bank_id": "string", "name": "string", "bic": "string" } ] } ``` - **Curl Example**: ```bash curl -X GET http://localhost:8080/api/v1/payout/sbp/banks ``` #### Create Payout - **Path**: `/api/v1/payout/create` - **Method**: POST - **Request Parameters**: ```json { "payout_type": "string (spb or yoo_money)", "account_number": "string (required for yoo_money)", "bank_id": "string (required for spb)", "amount": "float" } ``` - **Response Parameters**: ```json { "payout_id": "string", "payout_status": "string" } ``` - **Curl Example**: ```bash curl -X POST http://localhost:8080/api/v1/payout/create \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{"payout_type":"spb","bank_id":"123456","amount":1000.00}' ``` #### Payout Callback - **Path**: `/api/v1/payout/callback` - **Method**: POST - **Request Parameters**: YooKassa webhook data (JSON) - **Response Parameters**: None - **Curl Example**: ```bash curl -X POST http://localhost:8080/api/v1/payout/callback \ -H "Content-Type: application/json" \ -d '{"id":"payout_123456","status":"succeeded","amount":{"value":"1000.00","currency":"RUB"}}' ``` ## Service Configuration ### Server Configuration | Property | Description | Default Value | |----------|-------------|---------------| | Server.Tls.Enabled | Enable TLS for the server | true | | Server.Tls.CertFile | Path to TLS certificate file | ../server.pem | | Server.Tls.KeyFile | Path to TLS key file | ../server-key.pem | | Server.Port | Server port | :8080 | | Server.WriteTimeout | Write timeout for requests | 30s | | Server.ReadTimeout | Read timeout for requests | 30s | | Server.EnablePProfEndpoints | Enable pprof debug endpoints | false | ### Database Configuration | Property | Description | Default Value | |----------|-------------|---------------| | Database.Type | Database type (sqlite, postgres, mysql) | sqlite | | Database.Connection | Database connection string | ../payouts.db | | Database.LogLevel | Database logging level | Debug | | Database.TraceRequests | Enable request tracing | true | ### YooKassa Configuration | Property | Description | Default Value | |----------|-------------|---------------| | YooKassa.Test | Enable test mode | true | | YooKassa.ApiBaseKey | YooKassa base API key | (empty) | | YooKassa.ApiBaseSecret | YooKassa base API secret | (empty) | | YooKassa.ApiPaymentKey | YooKassa payment API key | (empty) | | YooKassa.ApiPaymentSecret | YooKassa payment API secret | (empty) | | YooKassa.BaseUrl | YooKassa API base URL | https://api.yookassa.ru/v3 | | YooKassa.Timeout | Request timeout | 30s | | YooKassa.CheckAllowedCallbackAddress | Check callback IP addresses | false | | YooKassa.AllowedCallbackSubnets | Allowed callback IP subnets | (empty) | | YooKassa.CallbackProcessTimeout | Callback processing timeout | 5s | | YooKassa.Retry.Enabled | Enable request retries | false | | YooKassa.Retry.Count | Number of retry attempts | 3 | | YooKassa.Retry.WaitTime | Initial wait time between retries | 1s | | YooKassa.Retry.MaxWaitTime | Maximum wait time between retries | 30s | ### Cache Configuration | Property | Description | Default Value | |----------|-------------|---------------| | Cache.TTL | Session TTL | 1h | ### Logging Configuration | Property | Description | Default Value | |----------|-------------|---------------| | Log.Level | Log level | info | | Log.Format | Log format (json, text) | json |