feat: update session payment logic to ensure accurate payable amounts and reflect consumables in cost breakdown
- Adjusted the calculation of payable amounts in PaymentStep to align with server logic, ensuring overpayments are handled correctly. - Enhanced DetailsStep to include consumables in the itemized cost breakdown, ensuring consistency with patient share calculations. - Updated tests for SessionPaymentPage to validate new behavior regarding overpayments and consumable listings. - Modified PatientController to register SessionPayment correctly when settling sessions via wallet, preventing double charges. - Refactored WalletService to remove outdated methods and ensure wallet transactions reflect the correct amounts after discounts. - Improved accessibility in SearchableSelect component by adding aria labels and ensuring proper role attributes for screen readers. - Updated styles to ensure minimum touch targets meet WCAG guidelines for mobile usability.
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
namespace App\Settlement\Service;
|
||||
|
||||
use App\Auth\Entity\User;
|
||||
use App\Patient\Entity\PatientSession;
|
||||
use App\Patient\Entity\SessionService;
|
||||
use App\Settlement\Entity\WalletTransaction;
|
||||
use App\Settlement\Repository\SettlementRepository;
|
||||
use App\Settlement\Repository\WalletTransactionRepository;
|
||||
@@ -84,29 +82,6 @@ class WalletService
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* تسویهٔ یک مراجعه از کیف پول: مبلغِ نهاییِ سهمِ بیمار را بهصورت debit کسر
|
||||
* میکند و دلیل را به نامِ سرویسها و شناسهٔ مراجعه گره میزند. موجودیِ ناکافی → ۴۲۲.
|
||||
*/
|
||||
public function settleSessionFromWallet(PatientSession $session, ?User $actor = null): WalletTransaction
|
||||
{
|
||||
$patient = $session->getRecord()->getUser();
|
||||
$amount = $session->getFinalPriceRials();
|
||||
|
||||
$names = array_values(array_filter(array_map(
|
||||
fn(SessionService $s) => $s->toArray()['service_name'] ?? null,
|
||||
$session->getServices()->toArray(),
|
||||
)));
|
||||
$label = $names !== [] ? implode('، ', $names) : 'ویزیت';
|
||||
|
||||
return $this->withdraw(
|
||||
$patient, $amount, $actor,
|
||||
'پرداخت سرویس: ' . $label,
|
||||
'wallet',
|
||||
'session:' . $session->getUuid(),
|
||||
);
|
||||
}
|
||||
|
||||
private function record(
|
||||
User $patient,
|
||||
int $amountRials,
|
||||
|
||||
Reference in New Issue
Block a user