# Release Notes - RON-Only Mode

**Date:** July 16, 2026
**Feature:** RON-Only Mode for Romanian Plugin (No EUR Dependency)
**Type:** Enhancement

---

## Overview

This release introduces a new configuration option that allows the Romanian (RON) plugin to operate entirely in RON, removing the dependency on EUR. When enabled, merchants no longer need to keep EUR as an Allowed Currency or maintain the RON to EUR exchange rate in **Stores → Currency Rates**.

---

## Problem Statement

Even with **API Endpoint Type** set to **RON**, the module converted checkout payload amounts through EUR and the payment configuration UI required an EUR currency rate:

- Checkout payload creation converted cart item prices via `convert($price, 'EUR')`, which fails when no RON to EUR rate exists
- The **Base Currency rate** configuration field displayed *"Please set up Currency rate for EUR"* when the EUR rate was missing

As a result, Romanian merchants selling exclusively in RON were forced to keep EUR enabled and manually maintain the RON to EUR exchange rate.

---

## What's New

### RON-Only Mode Configuration

**Location:** `Stores → Configuration → Sales → Payment Methods → Leanpay`

A new admin configuration field **"RON-Only Mode"** has been added. The field is visible only when **API Endpoint Type** is set to **RON**.

**How it works:**
- When enabled, checkout payload amounts (order total and cart item prices) are taken directly in RON without any currency conversion
- The **Base Currency rate** field no longer checks for an EUR rate and instead shows *"RON-Only Mode is enabled - no EUR currency rate is required"*
- The Multiple Financing Products cart-size validation compares the cart total directly in RON instead of converting it to EUR
- This feature **only applies to the Romanian (RON) plugin** and does not affect Slovenian or Croatian implementations

**Default behavior:** Disabled (opt-in feature)

---

## Technical Details

### Affected Components

- **Admin Configuration:** New `ron_only_mode` field added to `etc/adminhtml/system.xml` (default value in `etc/config.xml`)
- **Helper Class:** `Helper/Data.php` - Added `isRonOnlyMode()`; `validateGlobal()` compares cart size in RON when the mode is enabled
- **Payment Method:** `Model/Method/Leanpay.php` - `initialize()` builds the checkout payload without currency conversion when the mode is enabled
- **Admin Block:** `Block/Adminhtml/Form/Field/Currency.php` - Skips the EUR rate check when the mode is enabled

### Implementation Details

- RON-only mode is active only when **both** of the following are true:
  1. **"RON-Only Mode"** is set to **"Yes"** in the admin configuration
  2. API endpoint type is Romanian (`API_ENDPOINT_ROMANIA`)
- With the mode disabled, the checkout payload is built exactly as before (amounts converted through the Magento currency rate table)

---

## Configuration

### Enabling RON-Only Mode

1. Navigate to **Stores → Configuration → Sales → Payment Methods**
2. Expand the **"Leanpay"** section
3. Set **"API Endpoint Type"** to **"RON"**
4. Set **"RON-Only Mode"** to **"Yes"**
5. Save configuration
6. Clear cache if needed: `php bin/magento cache:clean`

Once enabled, EUR can be removed from **Allowed Currencies** and the RON to EUR rate no longer needs to be maintained.

### Scope

- Configuration is available at **Store View**, **Website**, and **Default** levels
- Can be configured independently per store/website
- Default value: `0` (disabled)

---

## Impact

### Benefits

- ✅ Romanian merchants can run the module with only RON configured (no EUR in Allowed Currencies, no RON to EUR rate)
- ✅ Checkout payload amounts are sent directly in RON
- ✅ Configuration UI no longer requires an EUR currency rate in RON-only mode
- ✅ Maintains backward compatibility (disabled by default)
- ✅ Only affects the Romanian plugin, preserving existing behavior for other regions
- ✅ No database schema changes required

### Compatibility

- ✅ Fully backward compatible
- ✅ No database schema changes required
- ✅ No impact on existing functionality when disabled
- ✅ Slovenian and Croatian plugins remain unaffected
- ✅ No breaking changes

---

## Testing Recommendations

### 1. Test with RON-only mode disabled (default)
- Verify existing behavior remains unchanged with the current EUR-based setup (EUR allowed, RON to EUR rate maintained)
- Place a test order and confirm the checkout payload matches the previous behavior

### 2. Test with RON-only mode enabled
- Remove EUR from **Allowed Currencies** and delete the RON to EUR rate
- Verify the payment method is available in checkout and orders can be placed
- Verify the checkout payload order amount and cart item prices are correct in RON
- Verify the **Base Currency rate** field no longer shows the EUR rate warning

### 3. Test other regions
- Verify Slovenian (SLO) and Croatian (CRO) configurations behave exactly as before
- Confirm the **"RON-Only Mode"** field is hidden unless **API Endpoint Type** is **RON**
