add tests batch 20

This commit is contained in:
root
2026-06-09 01:03:53 -04:00
parent 95efb9652e
commit 6be4875c5e
1502 changed files with 13797 additions and 11313 deletions
@@ -18,7 +18,8 @@ class RefundRequestService
private RefundSummaryService $summaryService,
private RefundNotificationService $notifications,
private ApplicationUrlService $urls,
) {}
) {
}
public function requestRefund(array $payload, int $actorId): array
{
@@ -29,12 +30,12 @@ class RefundRequestService
$paymentId = isset($payload['payment_id']) ? (int) $payload['payment_id'] : null;
$reason = $payload['reason'] ?? null;
if (! in_array($requestType, self::REQUEST_TYPES, true)) {
if (!in_array($requestType, self::REQUEST_TYPES, true)) {
return ['ok' => false, 'message' => 'Invalid refund request type.'];
}
$parent = User::query()->find($parentId);
if (! $parent) {
if (!$parent) {
return ['ok' => false, 'message' => 'Parent not found.'];
}
@@ -100,19 +101,18 @@ class RefundRequestService
'status' => Refund::STATUS_PENDING,
'reason' => $reason,
'request' => $requestType,
'note' => $paymentId ? ('duplicate-of-payment#'.$paymentId) : null,
'note' => $paymentId ? ('duplicate-of-payment#' . $paymentId) : null,
'requested_at' => utc_now(),
'created_at' => utc_now(),
'updated_at' => utc_now(),
'updated_by' => $actorId,
]);
if (! $refund) {
if (!$refund) {
Log::error('Failed to create refund request.', [
'parent_id' => $parentId,
'type' => $requestType,
]);
return ['ok' => false, 'message' => 'Failed to create refund request.'];
}