Skip to content

Commit

Permalink
Merge pull request #11 from veneliniliev/add_lang_field
Browse files Browse the repository at this point in the history
Add language configuration support to README
  • Loading branch information
veneliniliev authored Dec 30, 2024
2 parents 533501a + b0dbc31 commit e2fdddc
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,37 @@ $saleRequest->isProduction(); // check is production environment?
$saleRequest->isDevelopment(); // check is development environment?
```

#### Configure language

The library supports setting the language for the user payment form. Use the `setLang` method to set a specific language based on the enum `VenelinIliev\Borica3ds\Enums\Language`. Supported languages are **Bulgarian (BG)** and **English (EN)**.

```php
use VenelinIliev\Borica3ds\SaleRequest;
use VenelinIliev\Borica3ds\Enums\Language;

$saleRequest = (new SaleRequest())
->setAmount(100.50) // Transaction amount.
->setOrder('123456') // Unique order number.
->setDescription('Test product purchase') // Order description.
->setTerminalID('<TID - V*******>') // Terminal ID.
->setMerchantId('<MID - 15 chars>') // Merchant ID.
->setPrivateKey('<path to private key>', '<password>')
->setLang(Language::EN()); // Set transaction language to English.

// Alternatively, set the language to Bulgarian.
$saleRequest->setLang(Language::BG());
```

If an invalid language code is provided, the library will throw a `ParameterValidationException`.

Example with an invalid language code:

```php
$saleRequest->setLang('DE'); // Throws exception because 'DE' is not supported.
```

Using `setLang` ensures that users are presented with a language-specific payment form, delivering a more user-friendly experience.

### Credit cards for testing

#### Cards
Expand Down

0 comments on commit e2fdddc

Please sign in to comment.