Add migration to enhance session_payments table with payment_method_uuid and reference fields for split-payment details

This commit is contained in:
hamed
2026-07-23 15:37:58 +03:30
parent 1d1c3d5f30
commit a0a2eb1799
23 changed files with 2257 additions and 1432 deletions
@@ -1004,6 +1004,8 @@ class AppointmentController extends BaseController
), 422);
}
// پرداختِ چندروشی (split): هر ردیف یک روش + مبلغ، و به‌اختیار جزئیاتِ روش
// (uuid کارت‌خوان/حساب بانکیِ ثبت‌شده + شناسه تراکنش).
$payments = [];
foreach ((array) ($data['payments'] ?? []) as $row) {
$method = trim((string) ($row['method'] ?? ''));
@@ -1014,7 +1016,14 @@ class AppointmentController extends BaseController
if ($amount <= 0) {
return $this->error(ErrorCodes::ERR_SESSION_PAYMENT_INVALID, ErrorCodes::message(ErrorCodes::ERR_SESSION_PAYMENT_INVALID), 422, 'amount_rials');
}
$payments[] = ['method' => $method, 'amount_rials' => $amount];
$methodUuid = trim((string) ($row['payment_method_uuid'] ?? ''));
$reference = trim((string) ($row['reference'] ?? ''));
$payments[] = [
'method' => $method,
'amount_rials' => $amount,
'payment_method_uuid' => $methodUuid !== '' ? mb_substr($methodUuid, 0, 36) : null,
'reference' => $reference !== '' ? mb_substr($reference, 0, 255) : null,
];
}
try {