PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.4
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.4
1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk 1.2.0 All 47 releases
fluent-cart / app / Modules / PaymentMethods / PromoGateways / Addons / PaystackAddon.php

PaystackAddon.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.4, at app/Modules/PaymentMethods/PromoGateways/Addons/PaystackAddon.php

121 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Modules\PaymentMethods\PromoGateways\Addons;
4
5 use FluentCart\App\Modules\PaymentMethods\Core\AbstractPaymentGateway;
6 use FluentCart\App\Modules\PaymentMethods\PromoGateways\Addons\AddonGatewaySettings;
7 use FluentCart\App\Services\Payments\PaymentInstance;
8 use FluentCart\App\Services\PluginInstaller\PaymentAddonManager;
9 use FluentCart\App\Vite;
10
11 class PaystackAddon extends AbstractPaymentGateway
12 {
13 public array $supportedFeatures = [];
14
15 private $addonSlug = 'paystack-for-fluent-cart';
16 private $addonFile = 'paystack-for-fluent-cart/paystack-for-fluent-cart.php';
17
18 public function __construct()
19 {
20 $settings = new AddonGatewaySettings('paystack', 'fluent_cart_payment_settings_paystack');
21
22 $settings->setCustomStyles([
23 'light' => [
24 'icon_bg' => '#dcfce7',
25 'icon_color' => '#16a34a'
26 ],
27 'dark' => [
28 'icon_bg' => 'rgba(34, 197, 94, 0.15)',
29 'icon_color' => '#4ade80'
30 ]
31 ]);
32
33 parent::__construct($settings);
34 }
35
36 public function meta(): array
37 {
38 $addonStatus = PaymentAddonManager::getAddonStatus($this->addonSlug, $this->addonFile);
39
40 return [
41 'title' => 'Paystack',
42 'route' => 'paystack',
43 'slug' => 'paystack',
44 'description' => __('Pay securely with Paystack - Cards, Bank Transfer, USSD, and Mobile Money', 'fluent-cart'),
45 'logo' => Vite::getAssetUrl("images/payment-methods/paystack-logo.svg"),
46 'icon' => Vite::getAssetUrl("images/payment-methods/paystack-logo.svg"),
47 'brand_color' => '#0fa958',
48 'status' => false,
49 'is_addon' => true,
50 'addon_status' => $addonStatus,
51 'addon_source' => [
52 'type' => 'cdn',
53 'link' => 'https://addons-cdn.fluentcart.com/paystack-for-fluent-cart.zip',
54 'slug' => 'paystack-for-fluent-cart',
55 'repo_link' => 'https://fluentcart.com/fluentcart-addons'
56 ]
57 ];
58 }
59
60 public function makePaymentFromPaymentInstance(PaymentInstance $paymentInstance)
61 {
62 // This will not be called since the gateway is not active
63 return null;
64 }
65
66 public function handleIPN()
67 {
68 // This will not be called since the gateway is not active
69 }
70
71 public function getOrderInfo(array $data)
72 {
73 // This will not be called since the gateway is not active
74 return null;
75 }
76
77 /**
78 * Get Paystack-specific notice configuration
79 */
80 private function getNoticeConfig()
81 {
82 $meta = $this->meta();
83
84 return [
85 'title' => __('Paystack Payment Gateway', 'fluent-cart'),
86 'description' => __('Accept payments with Paystack - Cards, Bank Transfer, USSD, and Mobile Money. Perfect for businesses in Africa.', 'fluent-cart'),
87 'features' => [
88 __('Card payments & Bank transfers', 'fluent-cart'),
89 __('USSD & Mobile Money support', 'fluent-cart'),
90 __('Recurring payments & subscriptions', 'fluent-cart'),
91 __('Free & Open Source addon', 'fluent-cart')
92 ],
93 'icon_path' => 'M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z',
94 'addon_slug' => $this->addonSlug,
95 'addon_file' => $this->addonFile,
96 'repo_link' => 'https://fluentcart.com/fluentcart-addons',
97 'addon_source' => $meta['addon_source'] ?? [],
98 'footer_text' => __('Free addon - Click the button above to get started', 'fluent-cart')
99 ];
100 }
101
102 /**
103 * Generate addon notice message
104 */
105 public function addonNoticeMessage()
106 {
107 return $this->settings->generateAddonNotice($this->getNoticeConfig());
108 }
109
110 public function fields()
111 {
112 return [
113 'notice' => [
114 'value' => $this->addonNoticeMessage(),
115 'label' => __('Paystack Payment Gateway', 'fluent-cart'),
116 'type' => 'html_attr'
117 ],
118 ];
119 }
120 }
121