- Add PaymentGatewayInterface contract for all payment providers - Add PayPalGateway (reads credentials from config, not hardcoded) - Add ManualGateway for admin-triggered payments - Add StripeGateway stub for future implementation - Add GatewayFactory for gateway instantiation by name - Add BillingRepository: parameterized-SQL data layer - Add BillingService: pricing, invoice creation, payment processing - Add gsp_billing_transactions table (DB version 2) for audit trail - Add new columns to gsp_billing_invoices (home_id, rate_type, players, period_start/end, subtotal, total_due, payment_status) - Add gsp_billing_service_remote_servers mapping table - Move PayPal credentials from api files into config.inc.php - Fix double session_start() bug in capture_order.php - Replace raw SQL with prepared statements throughout - Refactor admin_invoices.php to use billing_invoices + BillingRepository - Refactor admin_payments.php to read from gsp_billing_transactions - Update admin.php with links to Transaction Log and Manage Invoices Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../classes/PaymentGatewayInterface.php';
|
|
|
|
/**
|
|
* Manual / offline payment gateway.
|
|
* Used when an admin marks a payment as paid directly.
|
|
*/
|
|
class ManualGateway implements PaymentGatewayInterface
|
|
{
|
|
public function getName(): string { return 'manual'; }
|
|
|
|
public function createPayment(array $params): array
|
|
{
|
|
return ['success' => true, 'provider_order_id' => 'MANUAL-' . uniqid(), 'raw_response' => []];
|
|
}
|
|
|
|
public function handleCallback(array $params): array
|
|
{
|
|
$txid = $params['admin_txid'] ?? ('MANUAL-' . uniqid());
|
|
return [
|
|
'success' => true,
|
|
'transaction_id' => $txid,
|
|
'amount' => (float)($params['amount'] ?? 0),
|
|
'currency' => $params['currency'] ?? 'USD',
|
|
'status' => 'completed',
|
|
'raw_response' => $params,
|
|
];
|
|
}
|
|
|
|
public function verifyPayment(array $payload): bool { return true; }
|
|
|
|
public function getTransactionId(array $captureResult): ?string
|
|
{
|
|
return $captureResult['transaction_id'] ?? null;
|
|
}
|
|
}
|