add controllers, servoices

This commit is contained in:
root
2026-03-09 02:52:13 -04:00
parent c8de5f7edc
commit d76c871cb7
501 changed files with 34439 additions and 21843 deletions
@@ -0,0 +1,32 @@
<?php
namespace App\Http\Resources\Payments;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PaymentNotificationLogResource extends JsonResource
{
public function toArray(Request $request): array
{
$parent = $this->resource->parent ?? null;
$parentName = $parent ? trim(($parent->firstname ?? '') . ' ' . ($parent->lastname ?? '')) : null;
return [
'id' => (int) ($this->resource->id ?? 0),
'parent_id' => (int) ($this->resource->parent_id ?? 0),
'parent_name' => $parentName,
'invoice_id' => $this->resource->invoice_id ? (int) $this->resource->invoice_id : null,
'school_year' => $this->resource->school_year ?? null,
'period_year' => (int) ($this->resource->period_year ?? 0),
'period_month' => (int) ($this->resource->period_month ?? 0),
'type' => $this->resource->type ?? null,
'to_email' => $this->resource->to_email ?? null,
'cc_email' => $this->resource->cc_email ?? null,
'status' => $this->resource->status ?? null,
'error_message' => $this->resource->error_message ?? null,
'balance_snapshot' => (float) ($this->resource->balance_snapshot ?? 0),
'sent_at' => $this->resource->sent_at ?? null,
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Http\Resources\Payments;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PaymentResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => (int) ($this->resource['id'] ?? 0),
'parent_id' => (int) ($this->resource['parent_id'] ?? 0),
'invoice_id' => isset($this->resource['invoice_id']) ? (int) $this->resource['invoice_id'] : null,
'total_amount' => (float) ($this->resource['total_amount'] ?? 0),
'paid_amount' => (float) ($this->resource['paid_amount'] ?? 0),
'balance' => (float) ($this->resource['balance'] ?? 0),
'number_of_installments' => (int) ($this->resource['number_of_installments'] ?? 0),
'transaction_id' => $this->resource['transaction_id'] ?? null,
'payment_method' => $this->resource['payment_method'] ?? null,
'payment_date' => $this->resource['payment_date'] ?? null,
'status' => $this->resource['status'] ?? null,
'semester' => $this->resource['semester'] ?? null,
'school_year' => $this->resource['school_year'] ?? null,
'created_at' => $this->resource['created_at'] ?? null,
'updated_at' => $this->resource['updated_at'] ?? null,
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Http\Resources\Payments;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PaymentTransactionResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'transaction_id' => $this->resource['transaction_id'] ?? null,
'payment_id' => (int) ($this->resource['payment_id'] ?? 0),
'transaction_date' => $this->resource['transaction_date'] ?? null,
'amount' => (float) ($this->resource['amount'] ?? 0),
'payment_method' => $this->resource['payment_method'] ?? null,
'payment_status' => $this->resource['payment_status'] ?? null,
'transaction_fee' => isset($this->resource['transaction_fee']) ? (float) $this->resource['transaction_fee'] : null,
'payment_reference' => $this->resource['payment_reference'] ?? null,
'is_full_payment' => isset($this->resource['is_full_payment']) ? (bool) $this->resource['is_full_payment'] : null,
'school_year' => $this->resource['school_year'] ?? null,
'semester' => $this->resource['semester'] ?? null,
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Http\Resources\Payments;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PaypalTransactionResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => (int) ($this->resource['id'] ?? 0),
'transaction_id' => $this->resource['transaction_id'] ?? null,
'order_id' => $this->resource['order_id'] ?? null,
'parent_school_id' => $this->resource['parent_school_id'] ?? null,
'payer_email' => $this->resource['payer_email'] ?? null,
'amount' => (float) ($this->resource['amount'] ?? 0),
'net_amount' => (float) ($this->resource['net_amount'] ?? 0),
'currency' => $this->resource['currency'] ?? null,
'status' => $this->resource['status'] ?? null,
'event_type' => $this->resource['event_type'] ?? null,
'created_at' => $this->resource['created_at'] ?? null,
];
}
}