| 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 AirwallexAddon extends AbstractPaymentGateway |
| 12 |
{ |
| 13 |
public array $supportedFeatures = []; |
| 14 |
|
| 15 |
private $addonSlug = 'airwallex-for-fluent-cart'; |
| 16 |
private $addonFile = 'airwallex-for-fluent-cart/airwallex-for-fluent-cart.php'; |
| 17 |
|
| 18 |
public function __construct() |
| 19 |
{ |
| 20 |
$settings = new AddonGatewaySettings('airwallex', 'fluent_cart_payment_settings_airwallex'); |
| 21 |
|
| 22 |
$settings->setCustomStyles([ |
| 23 |
'light' => [ |
| 24 |
'icon_bg' => '#ede9fe', |
| 25 |
'icon_color' => '#6c5ce7', |
| 26 |
], |
| 27 |
'dark' => [ |
| 28 |
'icon_bg' => 'rgba(108, 92, 231, 0.15)', |
| 29 |
'icon_color' => '#a78bfa', |
| 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' => 'Airwallex', |
| 42 |
'route' => 'airwallex', |
| 43 |
'slug' => 'airwallex', |
| 44 |
'description' => __('Pay securely with Airwallex - Global payment processing with Drop-in Element for onsite checkout', 'fluent-cart'), |
| 45 |
'logo' => Vite::getAssetUrl('images/payment-methods/airwallex-logo.svg'), |
| 46 |
'icon' => Vite::getAssetUrl('images/payment-methods/airwallex-icon.svg'), |
| 47 |
'brand_color' => '#6c5ce7', |
| 48 |
'status' => false, |
| 49 |
'is_addon' => true, |
| 50 |
'requires_pro' => true, |
| 51 |
'addon_status' => $addonStatus, |
| 52 |
'addon_source' => [ |
| 53 |
'type' => 'cdn', |
| 54 |
'link' => 'https://fluentcart.com/?fluent-cart=get_license_version', |
| 55 |
'slug' => 'airwallex-for-fluent-cart', |
| 56 |
'repo_link' => 'https://fluentcart.com/pricing/', |
| 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' => __('Airwallex Payment Gateway', 'fluent-cart'), |
| 82 |
'description' => __('Accept global payments with Airwallex - Cards, Apple Pay, Google Pay, and more. Onsite checkout with no redirect.', 'fluent-cart'), |
| 83 |
'features' => [ |
| 84 |
__('Onsite checkout - no redirect', 'fluent-cart'), |
| 85 |
__('Apple Pay & Google Pay', 'fluent-cart'), |
| 86 |
__('Global payment processing', 'fluent-cart'), |
| 87 |
__('Automatic refunds via webhooks', '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 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.78L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z', |
| 90 |
'addon_slug' => $this->addonSlug, |
| 91 |
'addon_file' => $this->addonFile, |
| 92 |
'repo_link' => 'https://fluentcart.com/pricing/', |
| 93 |
'pro_required' => true, |
| 94 |
'addon_source' => $meta['addon_source'] ?? [], |
| 95 |
'footer_text' => __('Premium addon - requires FluentCart Pro', 'fluent-cart'), |
| 96 |
]; |
| 97 |
|
| 98 |
return $this->settings->generateAddonNotice($config); |
| 99 |
} |
| 100 |
|
| 101 |
public function fields() |
| 102 |
{ |
| 103 |
return [ |
| 104 |
'notice' => [ |
| 105 |
'value' => $this->addonNoticeMessage(), |
| 106 |
'label' => __('Airwallex Payment Gateway', 'fluent-cart'), |
| 107 |
'type' => 'html_attr', |
| 108 |
], |
| 109 |
]; |
| 110 |
} |
| 111 |
} |
| 112 |
|