PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.4.1
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.4.1
1.6.5 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 All 48 releases
fluent-cart / app / Modules / PaymentMethods / PromoGateways / Addons / FlutterwaveAddon.php

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

120 lines 4.5 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 FlutterwaveAddon extends AbstractPaymentGateway
12 {
13 public array $supportedFeatures = [];
14
15 private $addonSlug = 'flutterwave-for-fluent-cart';
16 private $addonFile = 'flutterwave-for-fluent-cart/flutterwave-for-fluent-cart.php';
17
18 public function __construct()
19 {
20 $settings = new AddonGatewaySettings('flutterwave');
21
22 $settings->setCustomStyles([
23 'light' => [
24 'icon_bg' => '#fff7ed',
25 'icon_color' => '#F5A623'
26 ],
27 'dark' => [
28 'icon_bg' => 'rgba(245, 166, 35, 0.15)',
29 'icon_color' => '#fbbf24'
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' => 'Flutterwave',
42 'route' => 'flutterwave',
43 'slug' => 'flutterwave',
44 'description' => 'Pay securely with Flutterwave - Card, Bank Transfer, Mobile Money, and more',
45 'logo' => Vite::getAssetUrl("images/payment-methods/flutterwave-logo.svg"),
46 'icon' => Vite::getAssetUrl("images/payment-methods/flutterwave-logo.svg"),
47 'brand_color' => '#F5A623',
48 'status' => false,
49 'is_addon' => true,
50 'addon_status' => $addonStatus,
51 'addon_source' => [
52 'type' => 'cdn',
53 'link' => 'https://addons-cdn.fluentcart.com/flutterwave-for-fluent-cart.zip',
54 'slug' => 'flutterwave-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 Flutterwave-specific notice configuration
79 */
80 private function getNoticeConfig()
81 {
82 $meta = $this->meta();
83
84 return [
85 'title' => __('Flutterwave Payment Gateway', 'fluent-cart'),
86 'description' => __('Accept payments with Flutterwave - Card, Bank Transfer, Mobile Money, USSD, M-Pesa and more. Perfect for businesses in Africa.', 'fluent-cart'),
87 'features' => [
88 __('Card payments & Bank transfers', 'fluent-cart'),
89 __('Mobile Money, USSD & M-Pesa', 'fluent-cart'),
90 __('Free & Open Source addon', 'fluent-cart')
91 ],
92 'icon_path' => 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm.31-8.86c-1.77-.45-2.34-.94-2.34-1.67 0-.84.79-1.43 2.1-1.43 1.38 0 1.9.66 1.94 1.64h1.71c-.05-1.34-.87-2.57-2.49-2.97V5H10.9v1.69c-1.51.32-2.72 1.3-2.72 2.81 0 1.79 1.49 2.69 3.66 3.21 1.95.46 2.34 1.15 2.34 1.87 0 .53-.39 1.39-2.1 1.39-1.6 0-2.23-.72-2.32-1.64H8.04c.1 1.7 1.36 2.66 2.86 2.97V19h2.34v-1.67c1.52-.29 2.72-1.16 2.73-2.77-.01-2.2-1.9-2.96-3.66-3.42z',
93 'addon_slug' => $this->addonSlug,
94 'addon_file' => $this->addonFile,
95 'repo_link' => 'https://fluentcart.com/fluentcart-addons',
96 'addon_source' => $meta['addon_source'] ?? [],
97 'footer_text' => __('Free addon - Click the button above to get started', 'fluent-cart')
98 ];
99 }
100
101 /**
102 * Generate addon notice message
103 */
104 public function addonNoticeMessage()
105 {
106 return $this->settings->generateAddonNotice($this->getNoticeConfig());
107 }
108
109 public function fields()
110 {
111 return [
112 'notice' => [
113 'value' => $this->addonNoticeMessage(),
114 'label' => __('Flutterwave Payment Gateway', 'fluent-cart'),
115 'type' => 'html_attr'
116 ],
117 ];
118 }
119 }
120