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:
@@ -124,9 +124,10 @@ export default function PaymentStep({ recordUuid, session, walletBalance, onCont
|
||||
const baseInsurance = session.base_insurance_rials ?? 0;
|
||||
const suppInsurance = session.supplementary_insurance_rials ?? 0;
|
||||
const hasInsurance = baseInsurance > 0 || suppInsurance > 0;
|
||||
const payable = session.remaining_rials !== undefined
|
||||
? session.remaining_rials + (session.paid_total_rials ?? 0)
|
||||
: Math.max(0, finalPrice - discountRials);
|
||||
// همان فرمول سرور (PatientSession::getPayableRials). بازسازی از روی
|
||||
// `remaining + paid` غلط بود: سرور remaining را در صفر کلمپ میکند، پس در
|
||||
// بیشپرداخت مبلغ نهایی تا اندازهی پرداختی بالا میرفت و اضافهپرداخت پنهان میشد.
|
||||
const payable = Math.max(0, finalPrice - discountRials);
|
||||
const debt = session.remaining_rials ?? session.patient_debt_rials ?? 0;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user