Add migration to enhance session_payments table with payment_method_uuid and reference fields for split-payment details
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -60,7 +60,7 @@ class AppointmentConfirmationService
|
||||
* مودالی ایستاده که مبلغ نشان داده و منتظر تأیید است؛ «قطعی شد ولی پول ثبت نشد»
|
||||
* بدترین خروجیِ ممکن است.
|
||||
*
|
||||
* @param array<int, array{method: string, amount_rials: int}> $payments
|
||||
* @param array<int, array{method: string, amount_rials: int, payment_method_uuid?: ?string, reference?: ?string}> $payments
|
||||
* @return PatientSession|null null یعنی این tenant قابلیت پرونده را ندارد
|
||||
* (فقط وقتی مجاز است که پرداختی هم ارسال نشده باشد)
|
||||
*/
|
||||
@@ -91,6 +91,8 @@ class AppointmentConfirmationService
|
||||
$payment['amount_rials'],
|
||||
null,
|
||||
$actor,
|
||||
$payment['payment_method_uuid'] ?? null,
|
||||
$payment['reference'] ?? null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user