mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-05 07:34:49 -04:00
This commit introduces a comprehensive payment provider architecture to enable
seamless integration with external payment gateways like SumUp and PayPal/Zettle.
Architecture:
- PaymentProviderInterface: Contract for all payment providers
- PaymentProviderBase: Abstract base class with common functionality
- PaymentProviderRegistry: Singleton registry for provider management
- PaymentTransaction model: Transaction tracking and status management
Infrastructure:
- Webhook controller: Endpoint for external payment callbacks
- Payment events: payment_initiated, payment_completed, sale_completed
- payment_helper.php: Helper functions for payment provider content
- Migration for ospos_payment_transactions table
Core changes:
- Add Events::trigger('payment_options') in locale_helper.php
- Add Events::trigger('sale_completed') in Sales controller
- Add Events::trigger('payment_initiated') in postAddPayment()
- Add webhook routes for /payments/webhook/{provider}
Provider stubs:
- SumUpProvider: Card reader terminal integration
- PayPalProvider: Card reader and QR code payment integration
Related issues: #4346, #4322, #3232, #3789, #3790, #2275
36 lines
956 B
PHP
36 lines
956 B
PHP
<?php
|
|
|
|
namespace App\Libraries\Payments;
|
|
|
|
interface PaymentProviderInterface
|
|
{
|
|
public function getProviderId(): string;
|
|
|
|
public function getProviderName(): string;
|
|
|
|
public function getProviderDescription(): string;
|
|
|
|
public function getVersion(): string;
|
|
|
|
public function getPaymentTypes(): array;
|
|
|
|
public function getIcon(?string $paymentType = null): ?string;
|
|
|
|
public function initiatePayment(float $amount, string $currency, array $options = []): array;
|
|
|
|
public function processCallback(array $data): array;
|
|
|
|
public function getPaymentStatus(string $transactionId): array;
|
|
|
|
public function refund(string $transactionId, float $amount, string $reason = ''): array;
|
|
|
|
public function cancel(string $transactionId): array;
|
|
|
|
public function isAvailable(): bool;
|
|
|
|
public function getSettings(): array;
|
|
|
|
public function saveSettings(array $settings): bool;
|
|
|
|
public function getConfigView(): ?string;
|
|
} |