mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-02 14:24:27 -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
46 lines
2.3 KiB
PHP
46 lines
2.3 KiB
PHP
<?php
|
|
|
|
use CodeIgniter\Router\RouteCollection;
|
|
|
|
/**
|
|
* @var RouteCollection $routes
|
|
*/
|
|
$routes->setDefaultController('Login');
|
|
|
|
$routes->get('/', 'Login::index');
|
|
$routes->get('login', 'Login::index');
|
|
$routes->post('login', 'Login::index');
|
|
|
|
// Payment provider webhook routes (no authentication required)
|
|
$routes->post('payments/webhook/(:segment)', 'Payments\Webhook::handle/$1');
|
|
$routes->get('payments/status/(:segment)/(:segment)', 'Payments\Webhook::status/$1/$2');
|
|
|
|
$routes->add('no_access/index/(:segment)', 'No_access::index/$1');
|
|
$routes->add('no_access/index/(:segment)/(:segment)', 'No_access::index/$1/$2');
|
|
|
|
$routes->add('reports/summary_(:any)/(:any)/(:any)', 'Reports::Summary_$1/$2/$3/$4');
|
|
$routes->add('reports/summary_expenses_categories', 'Reports::date_input_only');
|
|
$routes->add('reports/summary_payments', 'Reports::date_input_only');
|
|
$routes->add('reports/summary_discounts', 'Reports::summary_discounts_input');
|
|
$routes->add('reports/summary_(:any)', 'Reports::date_input');
|
|
|
|
$routes->add('reports/graphical_(:any)/(:any)/(:any)', 'Reports::Graphical_$1/$2/$3/$4');
|
|
$routes->add('reports/graphical_summary_expenses_categories', 'Reports::date_input_only');
|
|
$routes->add('reports/graphical_summary_discounts', 'Reports::summary_discounts_input');
|
|
$routes->add('reports/graphical_(:any)', 'Reports::date_input');
|
|
|
|
$routes->add('reports/inventory_(:any)/(:any)', 'Reports::Inventory_$1/$2');
|
|
$routes->add('reports/inventory_low', 'Reports::inventory_low');
|
|
$routes->add('reports/inventory_summary', 'Reports::inventory_summary_input');
|
|
$routes->add('reports/inventory_summary/(:any)/(:any)/(:any)', 'Reports::inventory_summary/$1/$2/$3');
|
|
|
|
$routes->add('reports/detailed_(:any)/(:any)/(:any)/(:any)', 'Reports::Detailed_$1/$2/$3/$4');
|
|
$routes->add('reports/detailed_sales', 'Reports::date_input_sales');
|
|
$routes->add('reports/detailed_receivings', 'Reports::date_input_recv');
|
|
|
|
$routes->add('reports/specific_(:any)/(:any)/(:any)/(:any)', 'Reports::Specific_$1/$2/$3/$4');
|
|
$routes->add('reports/specific_customers', 'Reports::specific_customer_input');
|
|
$routes->add('reports/specific_employees', 'Reports::specific_employee_input');
|
|
$routes->add('reports/specific_discounts', 'Reports::specific_discount_input');
|
|
$routes->add('reports/specific_suppliers', 'Reports::specific_supplier_input');
|