Files
famous-ly4-ev/app-modules/payment/src/Http/Resources/PaymentResource.php
T
Nyan Lin Paing d19a14a45e Complete Payment module: initiate/webhook/confirm/refund actions, Filament resources (T5.8-T5.13)
- InitiatePaymentAction + POST /api/v1/payments/{booking}/initiate
- Generic KBZ webhook (POST /api/v1/webhooks/{method}/{encryptBookingId?}),
  signature verification per KBZ's real callback spec, PaymentGatewayInterface::handleWebhook()
- ConfirmPaymentAction: idempotent confirmation, PaymentCompleted/PaymentFailed events,
  MarkBookingPaid listener
- RefundBookingAction + POST /api/v1/bookings/{booking}/refund: partial refunds validated
  against remaining balance, RefundProcessed event, MarkBookingRefunded listener
- CancelBookingAction now refunds confirmed bookings instead of rejecting; BookingPolicy::cancel
  requires process_refunds for confirmed bookings
- PaymentPlugin + PaymentResource/RefundResource Filament admin UI (read-only payments,
  refund list + Process action)
- Booking detail page now shows related payments
- Fix CACHE_STORE mismatch (database -> redis) so tagged route caching works
- CLAUDE.md: never run migrate:fresh/migrate:refresh/db:wipe on dev without being asked
2026-08-09 16:20:21 +07:00

32 lines
934 B
PHP

<?php
namespace Modules\Payment\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PaymentResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'booking_id' => $this->booking_id,
'gateway' => $this->gateway,
'status' => $this->status,
'amount' => $this->amount,
'currency' => $this->currency,
'gateway_transaction_id' => $this->gateway_transaction_id,
// The gateway's raw response — the client needs this to render the
// KBZ Mini App payment sheet (e.g. prepay_id).
'gateway_payload' => $this->gateway_payload,
'initiated_at' => $this->initiated_at,
];
}
}