diff --git a/aluxpay-payment-gateway/aluxpay-payment-gateway.php b/aluxpay-payment-gateway/aluxpay-payment-gateway.php
index 03000ba..46c2a31 100644
--- a/aluxpay-payment-gateway/aluxpay-payment-gateway.php
+++ b/aluxpay-payment-gateway/aluxpay-payment-gateway.php
@@ -18,6 +18,11 @@ if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
+// Define plugin constants
+define('ALUXPAY_PLUGIN_FILE', __FILE__);
+define('ALUXPAY_PLUGIN_DIR', plugin_dir_path(__FILE__));
+define('ALUXPAY_PLUGIN_URL', plugin_dir_url(__FILE__));
+
// Declare HPOS compatibility
add_action('before_woocommerce_init', function() {
if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) {
@@ -25,6 +30,24 @@ add_action('before_woocommerce_init', function() {
}
});
+// Include the gateway class
+add_action('plugins_loaded', 'aluxpay_init_gateway');
+
+function aluxpay_init_gateway() {
+ if (!class_exists('WC_Payment_Gateway')) {
+ return;
+ }
+
+ require_once ALUXPAY_PLUGIN_DIR . 'includes/class-aluxpay-payment-gateway.php';
+
+ add_filter('woocommerce_payment_gateways', 'aluxpay_add_gateway');
+}
+
+function aluxpay_add_gateway($gateways) {
+ $gateways[] = 'WC_AluxPay_Payment_Gateway';
+ return $gateways;
+}
+
// Define plugin constants
define('CPG_VERSION', '1.1.0');
define('CPG_PLUGIN_DIR', plugin_dir_path(__FILE__));
diff --git a/aluxpay-payment-gateway/assets/css/checkout.css b/aluxpay-payment-gateway/assets/css/checkout.css
new file mode 100644
index 0000000..5745585
--- /dev/null
+++ b/aluxpay-payment-gateway/assets/css/checkout.css
@@ -0,0 +1,34 @@
+/* Force payment method label to be column layout */
+.wc_payment_methods .payment_method_aluxpay_payment_gateway label {
+ display: flex !important;
+ flex-direction: column !important;
+ align-items: flex-start !important;
+}
+
+/* Icons container styling */
+.aluxpay-payment-icons {
+ display: inline-flex !important;
+ align-items: center !important;
+ gap: 6px;
+ margin-top: 8px !important;
+ margin-left: 0 !important;
+ white-space: nowrap;
+}
+
+.aluxpay-payment-icons img {
+ display: inline-block !important;
+ height: 24px !important;
+ width: auto !important;
+ max-width: none !important;
+ vertical-align: middle !important;
+ margin: 0 3px !important;
+ border: none !important;
+ box-shadow: none !important;
+}
+
+/* Responsive adjustments */
+@media (max-width: 768px) {
+ .aluxpay-payment-icons img {
+ height: 20px !important;
+ }
+}
\ No newline at end of file
diff --git a/aluxpay-payment-gateway/assets/images/american-express.svg b/aluxpay-payment-gateway/assets/images/american-express.svg
new file mode 100644
index 0000000..8922b56
--- /dev/null
+++ b/aluxpay-payment-gateway/assets/images/american-express.svg
@@ -0,0 +1,4 @@
+
diff --git a/aluxpay-payment-gateway/assets/images/discover.svg b/aluxpay-payment-gateway/assets/images/discover.svg
new file mode 100644
index 0000000..d9145ba
--- /dev/null
+++ b/aluxpay-payment-gateway/assets/images/discover.svg
@@ -0,0 +1,22 @@
+
diff --git a/aluxpay-payment-gateway/assets/images/mastercard-alt.svg b/aluxpay-payment-gateway/assets/images/mastercard-alt.svg
new file mode 100644
index 0000000..604c552
--- /dev/null
+++ b/aluxpay-payment-gateway/assets/images/mastercard-alt.svg
@@ -0,0 +1,9 @@
+
diff --git a/aluxpay-payment-gateway/assets/images/paypal.svg b/aluxpay-payment-gateway/assets/images/paypal.svg
new file mode 100644
index 0000000..fb0057a
--- /dev/null
+++ b/aluxpay-payment-gateway/assets/images/paypal.svg
@@ -0,0 +1,9 @@
+
diff --git a/aluxpay-payment-gateway/assets/images/visa.svg b/aluxpay-payment-gateway/assets/images/visa.svg
new file mode 100644
index 0000000..eb1507e
--- /dev/null
+++ b/aluxpay-payment-gateway/assets/images/visa.svg
@@ -0,0 +1,7 @@
+
diff --git a/aluxpay-payment-gateway/includes/class-aluxpay-payment-gateway.php b/aluxpay-payment-gateway/includes/class-aluxpay-payment-gateway.php
index 6c6982e..3245698 100644
--- a/aluxpay-payment-gateway/includes/class-aluxpay-payment-gateway.php
+++ b/aluxpay-payment-gateway/includes/class-aluxpay-payment-gateway.php
@@ -135,6 +135,8 @@ class WC_Aluxpay_Payment_Gateway extends WC_Payment_Gateway {
add_action('woocommerce_api_' . $this->id, array($this, 'webhook_handler'));
add_action('woocommerce_thankyou_' . $this->id, array($this, 'thankyou_page'));
+ add_action('wp_enqueue_scripts', array($this, 'enqueue_checkout_styles'));
+
// Customer Emails - Success
add_action('woocommerce_email_before_order_table', array($this, 'email_instructions'), 10, 3);
@@ -142,6 +144,62 @@ class WC_Aluxpay_Payment_Gateway extends WC_Payment_Gateway {
add_action('woocommerce_email_before_order_table', array($this, 'failed_email_instructions'), 10, 3);
}
+ // SVG icons on checkout
+ public function get_icon() {
+ $icons = array(
+ 'discover' => array(
+ 'file' => 'discover.svg',
+ 'alt' => 'Discover'
+ ),
+ 'amex' => array(
+ 'file' => 'american-express.svg',
+ 'alt' => 'American Express'
+ ),
+ 'visa' => array(
+ 'file' => 'visa.svg',
+ 'alt' => 'Visa'
+ ),
+ 'mastercard' => array(
+ 'file' => 'mastercard-alt.svg',
+ 'alt' => 'Mastercard'
+ ),
+ 'paypal' => array(
+ 'file' => 'paypal.svg',
+ 'alt' => 'PayPal'
+ ),
+ );
+ $icons_html = '';
+
+ foreach ($icons as $key => $icon) {
+ // Use the constant defined in main plugin file
+ $icon_url = ALUXPAY_PLUGIN_URL . 'assets/images/' . $icon['file'];
+
+ $icons_html .= sprintf(
+ '
',
+ esc_url($icon_url),
+ esc_attr($icon['alt']),
+ esc_attr($key)
+ );
+ }
+
+ $icons_html .= '';
+
+ return $icons_html;
+ }
+
+ /**
+ * Enqueue checkout styles
+ */
+ public function enqueue_checkout_styles() {
+ if (is_checkout()) {
+ wp_enqueue_style(
+ 'aluxpay-checkout',
+ ALUXPAY_PLUGIN_URL . 'assets/css/checkout.css',
+ array(),
+ '1.0.1'
+ );
+ }
+ }
/**
* Initialize Gateway Settings Form Fields