| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\App\Modules\PaymentMethods\PromoGateways\Addons; |
| 4 |
|
| 5 |
use FluentCart\App\Modules\PaymentMethods\Core\AbstractPaymentGateway; |
| 6 |
use FluentCart\App\Services\Payments\PaymentInstance; |
| 7 |
use FluentCart\App\Services\PluginInstaller\PaymentAddonManager; |
| 8 |
use FluentCart\App\Vite; |
| 9 |
|
| 10 |
class SslcommerzAddon extends AbstractPaymentGateway |
| 11 |
{ |
| 12 |
public array $supportedFeatures = []; |
| 13 |
|
| 14 |
private $addonSlug = 'sslcommerz-for-fluent-cart'; |
| 15 |
private $addonFile = 'sslcommerz-for-fluent-cart/sslcommerz-for-fluent-cart.php'; |
| 16 |
|
| 17 |
public function __construct() |
| 18 |
{ |
| 19 |
$settings = new AddonGatewaySettings('sslcommerz', 'fluent_cart_payment_settings_sslcommerz'); |
| 20 |
|
| 21 |
$settings->setCustomStyles([ |
| 22 |
'light' => [ |
| 23 |
'icon_bg' => '#dcfce7', |
| 24 |
'icon_color' => '#0b9e48', |
| 25 |
], |
| 26 |
'dark' => [ |
| 27 |
'icon_bg' => 'rgba(11, 158, 72, 0.18)', |
| 28 |
'icon_color' => '#22c55e', |
| 29 |
], |
| 30 |
]); |
| 31 |
|
| 32 |
parent::__construct($settings); |
| 33 |
} |
| 34 |
|
| 35 |
public function meta(): array |
| 36 |
{ |
| 37 |
$addonStatus = PaymentAddonManager::getAddonStatus($this->addonSlug, $this->addonFile); |
| 38 |
|
| 39 |
return [ |
| 40 |
'title' => 'SSLCommerz', |
| 41 |
'route' => 'sslcommerz', |
| 42 |
'slug' => 'sslcommerz', |
| 43 |
'label' => 'SSLCommerz', |
| 44 |
'admin_title' => 'SSLCommerz', |
| 45 |
'description' => 'Accept SSLCommerz payments in FluentCart with cards, mobile banking, internet banking, and refunds.', |
| 46 |
'logo' => Vite::getAssetUrl('images/payment-methods/sslcommerz-logo.svg'), |
| 47 |
'icon' => Vite::getAssetUrl('images/payment-methods/sslcommerz-logo.svg'), |
| 48 |
'brand_color' => '#0b9e48', |
| 49 |
'status' => false, |
| 50 |
'is_addon' => true, |
| 51 |
'addon_status' => $addonStatus, |
| 52 |
'addon_source' => [ |
| 53 |
'type' => 'cdn', |
| 54 |
'link' => 'https://addons-cdn.fluentcart.com/sslcommerz-for-fluent-cart.zip', |
| 55 |
'slug' => $this->addonSlug, |
| 56 |
'repo_link' => 'https://fluentcart.com/fluentcart-addons/', |
| 57 |
], |
| 58 |
]; |
| 59 |
} |
| 60 |
|
| 61 |
public function makePaymentFromPaymentInstance(PaymentInstance $paymentInstance) |
| 62 |
{ |
| 63 |
return null; |
| 64 |
} |
| 65 |
|
| 66 |
public function handleIPN() |
| 67 |
{ |
| 68 |
// not active |
| 69 |
} |
| 70 |
|
| 71 |
public function getOrderInfo(array $data) |
| 72 |
{ |
| 73 |
return null; |
| 74 |
} |
| 75 |
|
| 76 |
public function addonNoticeMessage() |
| 77 |
{ |
| 78 |
$meta = $this->meta(); |
| 79 |
|
| 80 |
$config = [ |
| 81 |
'title' => __('SSLCommerz Payment Gateway', 'fluent-cart'), |
| 82 |
'description' => __('Accept payments with SSLCommerz for Bangladesh, including cards, mobile banking, internet banking, and supported wallet methods.', 'fluent-cart'), |
| 83 |
'features' => [ |
| 84 |
__('Hosted checkout and modal checkout', 'fluent-cart'), |
| 85 |
__('Cards, mobile banking, and internet banking', 'fluent-cart'), |
| 86 |
__('IPN payment verification', 'fluent-cart'), |
| 87 |
__('Refund support', 'fluent-cart'), |
| 88 |
], |
| 89 |
'icon_path' => 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 7.5h-1.8c-.3-.9-.9-1.7-1.7-2.2V5.5c1.6.5 2.9 2 3.5 4zm-5-2.3c1.5 0 2.8 1 3.2 2.3H8.8c.4-1.3 1.7-2.3 3.2-2.3zM7 9.5c.6-2 2.2-3.5 4-4v1.8c-.8.5-1.4 1.3-1.7 2.2H7zm-2.7 4c-.1-.5-.3-1-.3-1.5s.1-1 .3-1.5h15.4c.1.5.3 1 .3 1.5s-.1 1-.3 1.5H4.3zM7 14.5h2.3c.3.9.9 1.7 1.7 2.2v1.8c-1.8-.5-3.4-2-4-4zm5 2.3c-1.5 0-2.8-1-3.2-2.3h6.4c-.4 1.3-1.7 2.3-3.2 2.3zm1.5 1.7v-1.8c.8-.5 1.4-1.3 1.7-2.2H17c-.6 2-1.9 3.5-3.5 4z', |
| 90 |
'addon_slug' => $this->addonSlug, |
| 91 |
'addon_file' => $this->addonFile, |
| 92 |
'repo_link' => 'https://fluentcart.com/fluentcart-addons/', |
| 93 |
'addon_source' => $meta['addon_source'] ?? [], |
| 94 |
'footer_text' => __('Download manually with FluentCart free, or install automatically with FluentCart Pro.', 'fluent-cart'), |
| 95 |
]; |
| 96 |
|
| 97 |
if ($this->settings instanceof AddonGatewaySettings) { |
| 98 |
return $this->settings->generateAddonNotice($config); |
| 99 |
} |
| 100 |
|
| 101 |
return null; |
| 102 |
} |
| 103 |
|
| 104 |
public function fields() |
| 105 |
{ |
| 106 |
return [ |
| 107 |
'notice' => [ |
| 108 |
'value' => $this->addonNoticeMessage(), |
| 109 |
'label' => __('SSLCommerz Payment Gateway', 'fluent-cart'), |
| 110 |
'type' => 'html_attr', |
| 111 |
], |
| 112 |
]; |
| 113 |
} |
| 114 |
} |
| 115 |
|