Retry Montzar orders after refreshing a stale quote.

When the partner rejects with a mazaneh-changed error, pull the live quote and submit once more so the customer buy can succeed without a page refresh.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-31 16:14:02 +03:30
co-authored by Cursor
parent c5fd6608bf
commit 5537cd7086
2 changed files with 271 additions and 26 deletions
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace Tests\Unit;
use App\Services\MontzarService;
use PHPUnit\Framework\TestCase;
class MontzarQuoteChangedTest extends TestCase
{
public function test_detects_persian_quote_changed_toast(): void
{
$this->assertTrue(MontzarService::isQuoteChangedMessage('تغییر در مظنه !'));
$this->assertTrue(MontzarService::isQuoteChangedMessage('تغيير در مظنه'));
$this->assertTrue(MontzarService::isQuoteChangedMessage('مظنه تغییر کرده است'));
$this->assertTrue(MontzarService::isQuoteChangedMessage('Quote changed'));
}
public function test_ignores_unrelated_messages(): void
{
$this->assertFalse(MontzarService::isQuoteChangedMessage(null));
$this->assertFalse(MontzarService::isQuoteChangedMessage(''));
$this->assertFalse(MontzarService::isQuoteChangedMessage('موجودی شما کمتر از میزان سفارش است'));
$this->assertFalse(MontzarService::isQuoteChangedMessage('سفارشات توسط ارائه دهنده بسته شده است.'));
}
}