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 / MercadoPagoAddon.php

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

121 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 MercadoPagoAddon extends AbstractPaymentGateway
12 {
13 public array $supportedFeatures = [];
14
15 private $addonSlug = 'mercado-pago-for-fluent-cart';
16 private $addonFile = 'mercado-pago-for-fluent-cart/mercado-pago-for-fluent-cart.php';
17
18 public function __construct()
19 {
20 $settings = new AddonGatewaySettings('mercado_pago', 'fluent_cart_payment_settings_mercado_pago');
21
22 $settings->setCustomStyles([
23 'light' => [
24 'icon_bg' => '#e0f2fe',
25 'icon_color' => '#009EE3'
26 ],
27 'dark' => [
28 'icon_bg' => 'rgba(0, 158, 227, 0.15)',
29 'icon_color' => '#38bdf8'
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' => 'Mercado Pago',
42 'route' => 'mercado_pago',
43 'slug' => 'mercado_pago',
44 'description' => __('Pay securely with Mercado Pago - Cards, Pix, Boleto, OXXO, and more', 'fluent-cart'),
45 'logo' => Vite::getAssetUrl("images/payment-methods/mercado-pago-logo.svg"),
46 'icon' => Vite::getAssetUrl("images/payment-methods/mercado-pago-logo.svg"),
47 'brand_color' => '#009EE3',
48 'status' => false,
49 'is_addon' => true,
50 'addon_status' => $addonStatus,
51 'addon_source' => [
52 'type' => 'cdn',
53 'link' => 'https://addons-cdn.fluentcart.com/mercado-pago-for-fluent-cart.zip',
54 'slug' => 'mercado-pago-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 Mercado Pago-specific notice configuration
79 */
80 private function getNoticeConfig()
81 {
82 $meta = $this->meta();
83
84 return [
85 'title' => __('Mercado Pago Payment Gateway', 'fluent-cart'),
86 'description' => __('Accept payments with Mercado Pago - Cards, Pix, Boleto, OXXO, and more. Perfect for businesses in Latin America.', 'fluent-cart'),
87 'features' => [
88 __('Card payments & Bank transfers', 'fluent-cart'),
89 __('Pix, Boleto & Virtual Debit Card', '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' => __('Mercado Pago Payment Gateway', 'fluent-cart'),
115 'type' => 'html_attr'
116 ],
117 ];
118 }
119 }
120
121