# BPC Integration Service

This service provides integration with BPC's payment processing system via REST API.

## Overview

The integration service facilitates communication with BPC APIs, particularly for OCT (Original Credit Transaction) payments. It handles:

- Registration of orders
- Verification of fees
- Execution of credit transfers
- Status checking of transactions

## Technical Stack

- PHP 8.0+
- Symfony 5.4
- Symfony HTTP Client for REST API communication
- AWS Serverless deployment

## Project Structure

- `src/Controller`: API endpoints that clients can call
- `src/BPC`: REST client implementation for BPC API
- `src/Builder`: Builders for creating request objects
- `src/Dto`: Data Transfer Objects for requests and responses
- `src/RequestManager`: Manages API requests to BPC

## Configuration

Configuration is done via environment variables:

```
# .env
APP_ENV=dev
APP_SECRET=your_secret_key
DATABASE_URL=mysql://user:pass@host:port/db_name
```

## API Endpoints

### POST /v1/oct

Processes an OCT (Original Credit Transaction) payment.

#### Request

```json
{
  "amount": 100.0,
  "currency": "USD",
  "category": "gambling",
  "reference": "REF123456",
  "card": {
    "number": "4111111111111111",
    "cardholderName": "John Doe"
  },
  "cardAcceptor": {
    "name": "Merchant Name",
    "country": "US",
    "address": "123 Main St",
    "city": "New York"
  },
  "configuration": {
    "merchantId": "your_merchant_id",
    "password": "your_password"
  }
}
```

#### Response

```json
{
  "status": "SUCCESS",
  "reference": "REF123456",
  "approvalCode": "123456",
  "transactionId": "T123456789"
}
```

## Deployment

The application is designed to be deployed on AWS Lambda using the Serverless framework:

```
serverless deploy
```

## Development

To run locally:

```
composer install
symfony serve
```

## Testing

```
php bin/phpunit
``` 