From b0dbc314b013f75a93e46ca226c21ec3ba20a040 Mon Sep 17 00:00:00 2001 From: Venelin Iliev Date: Mon, 30 Dec 2024 12:07:21 +0200 Subject: [PATCH] Add language configuration support to README Update the README with instructions for using the `setLang` method to configure the language of the user payment form. Provide examples for setting supported languages (English and Bulgarian) and handling invalid language codes. This improves clarity and usability for library users. --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 1ca504f..76ab6c6 100644 --- a/README.md +++ b/README.md @@ -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('') // Terminal ID. + ->setMerchantId('') // Merchant ID. + ->setPrivateKey('', '') + ->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