diff --git a/hyperswitch-checkout.php b/hyperswitch-checkout.php
index 8bfdcc7..036290f 100644
--- a/hyperswitch-checkout.php
+++ b/hyperswitch-checkout.php
@@ -7,6 +7,8 @@
* Author URI: https://hyperswitch.io/
* Version: 1.6.2
* License: GPLv2 or later
+ * Text Domain: hyperswitch
+ * Domain Path: /languages
*
* WC requires at least: 4.0.0
* WC tested up to: 8.6.1
@@ -55,7 +57,7 @@ public function __construct() {
$this->enabled = $this->get_option( 'enabled' );
$this->id = 'hyperswitch_checkout';
$this->method_title = __( 'Hyperswitch' );
- $this->method_description = __( 'Allow customers to securely pay via Hyperswitch', 'hyperswitch-checkout' );
+ $this->method_description = __( 'Allow customers to securely pay via Hyperswitch', 'hyperswitch' );
$this->has_fields = true;
@@ -123,57 +125,56 @@ public function __construct() {
add_action( 'woocommerce_order_action_wc_manual_sync_action', array( $this, 'hyperswitch_process_manual_sync_action' ) );
add_filter( 'woocommerce_order_button_html', array( $this, 'place_order_custom_button' ) );
add_filter( 'woocommerce_thankyou_order_received_text', array( $this, 'hyperswitch_thankyou' ) );
+ add_action('init', array($this, 'load_plugin_textdomain'));
}
}
function plugin_action_links( $links ) {
$plugin_links = [
- '' . esc_html__( 'Settings', 'hyperswitch-checkout' ) . '',
+ '' . esc_html__( 'Settings', 'hyperswitch' ) . '',
];
return array_merge( $plugin_links, $links );
}
function hyperswitch_thankyou( $esc_html__ ) {
- $order_id = wc_get_order_id_by_order_key( $_GET['key'] );
- $order = wc_get_order( $order_id );
- if ( $order ) {
- $payment_method = $order->get_payment_method();
- if ( $payment_method == 'hyperswitch_checkout' ) {
- $payment_id = $order->get_transaction_id();
- $paymentResponse = $this->retrieve_payment_intent( $payment_id );
- $status = $paymentResponse['status'];
- $pm = $paymentResponse['payment_method'];
- $pmt = $paymentResponse['payment_method_type'];
- $intermediate_status = array( "processing", "requires_merchant_action", "requires_customer_action", "requires_confirmation", "requires_capture" );
- $msg = $esc_html__;
-
- global $woocommerce;
- if ( $status == 'succeeded' ) {
- $woocommerce->cart->empty_cart();
- } else if ( in_array( $status, $intermediate_status ) ) {
- if ( $status == 'requires_capture' ) {
- $msg = "Thank you for shopping with us. Please note that your payment has been authorized and can now be captured by the merchant. Kindly check the status of your order after some time.";
- } else {
- $msg = "Thank you for shopping with us. Please note that your payment is currently being processed. Kindly check the status of your order after some time.";
- }
- $woocommerce->cart->empty_cart();
- } else {
- $msg = "Thank you for shopping with us. However, the payment has failed. Please retry the payment.";
- }
- $this->post_log(
- "WC_THANK_YOU_MESSAGE",
- array(
- "payment_method" => $pm,
- "payment_method_type" => $pmt,
- "order_id" => $order_id,
- "payment_id" => $payment_id,
- "message" => $msg
- )
- );
- return esc_html( $msg );
- }
- }
- return $esc_html__;
+ $order_id = wc_get_order_id_by_order_key( $_GET['key'] );
+ $order = wc_get_order( $order_id );
+ if ( $order ) {
+ $payment_method = $order->get_payment_method();
+ if ( $payment_method == 'hyperswitch_checkout' ) {
+ $payment_id = $order->get_transaction_id();
+ $paymentResponse = $this->retrieve_payment_intent( $payment_id );
+ $status = $paymentResponse['status'];
+ $pm = $paymentResponse['payment_method'];
+ $pmt = $paymentResponse['payment_method_type'];
+ $intermediate_status = array( "processing", "requires_merchant_action", "requires_customer_action", "requires_confirmation", "requires_capture" );
+ $msg = $esc_html__;
+
+ global $woocommerce;
+ if ( $status == 'succeeded' ) {
+ $woocommerce->cart->empty_cart();
+ } else if ( in_array( $status, $intermediate_status ) ) {
+ if ( $status == 'requires_capture' ) {
+ $msg = __('Thank you for shopping with us. Please note that your payment has been authorized and can now be captured by the merchant. Kindly check the status of your order after some time.', 'hyperswitch');
+ } else {
+ $msg = __('Thank you for shopping with us. Please note that your payment is currently being processed. Kindly check the status of your order after some time.', 'hyperswitch');
+ }
+ $woocommerce->cart->empty_cart();
+ } else {
+ $msg = __('Thank you for shopping with us. However, the payment has failed. Please retry the payment.', 'hyperswitch');
+ }
+ return esc_html( $msg );
+ }
+ }
+ return $esc_html__;
+ }
+
+ public function load_plugin_textdomain() {
+ load_plugin_textdomain(
+ 'hyperswitch',
+ false,
+ dirname(plugin_basename(__FILE__)) . '/locale/'
+ );
}
function place_order_custom_button( $button_html ) {
@@ -190,30 +191,41 @@ function place_order_custom_button( $button_html ) {
}
- function process_refund( $order_id, $amount = NULL, $reason = '' ) {
- $refund = new WC_Order_Refund;
- $order = wc_get_order( $order_id );
- $payment_id = $order->get_transaction_id();
- $refund_num = $refund->id;
- $responseObj = $this->create_refund( $payment_id, $amount, $reason, $refund_num, $order_id );
- $status = $responseObj['status'];
- $refund_id = $responseObj['refund_id'];
- $intermediate_status = array( "pending" );
- if ( $status == 'succeeded' ) {
- $refund->set_refunded_payment( true );
- $order->add_order_note( 'Refund Successful (Hyperswitch Refund ID: ' . $refund_id . ')' );
- } else if ( in_array( $status, $intermediate_status ) ) {
- $order->add_order_note( 'Refund processing (Hyperswitch Refund ID: ' . $refund_id . ')' );
- $refund->set_refunded_payment( true );
- $refund->set_status( "processing" );
- } else {
- $refund->set_refunded_payment( false );
- $order->add_order_note( 'Refund failed with error message: ' . $responseObj['error']['message'] );
- return false;
- }
- $this->post_log( "WC_MANUAL_REFUND", $status, $payment_id );
- return true;
- }
+ public function process_refund( $order_id, $amount = NULL, $reason = '' ) {
+ $refund = new WC_Order_Refund;
+ $order = wc_get_order( $order_id );
+ $payment_id = $order->get_transaction_id();
+ $refund_num = $refund->id;
+ $responseObj = $this->create_refund( $payment_id, $amount, $reason, $refund_num, $order_id );
+ $status = $responseObj['status'];
+ $refund_id = $responseObj['refund_id'];
+ $intermediate_status = array( "pending" );
+ if ( $status == 'succeeded' ) {
+ $refund->set_refunded_payment( true );
+ $order->add_order_note( sprintf(
+ /* translators: %s: refund ID */
+ __('Refund Successful (Hyperswitch Refund ID: %s)', 'hyperswitch'),
+ $refund_id
+ ));
+ } else if ( in_array( $status, $intermediate_status ) ) {
+ $order->add_order_note( sprintf(
+ /* translators: %s: refund ID */
+ __('Refund processing (Hyperswitch Refund ID: %s)', 'hyperswitch'),
+ $refund_id
+ ));
+ $refund->set_refunded_payment( true );
+ $refund->set_status( "processing" );
+ } else {
+ $refund->set_refunded_payment( false );
+ $order->add_order_note( sprintf(
+ /* translators: %s: error message */
+ __('Refund failed with error message: %s', 'hyperswitch'),
+ $responseObj['error']['message']
+ ));
+ return false;
+ }
+ return true;
+ }
function hyperswitch_add_manual_actions( $actions ) {
global $theorder;
@@ -222,11 +234,11 @@ function hyperswitch_add_manual_actions( $actions ) {
$terminal_status = array( "processing", "refunded" );
// bail if the order has been paid for or this action has been run
if ( ! ( $theorder->is_paid() || $theorder->get_meta( 'payment_captured' ) == 'yes' || strlen( $payment_id ) < 3 || in_array( $theorder->status, $terminal_status ) ) ) {
- $actions['wc_manual_capture_action'] = __( 'Capture Payment with Hyperswitch', 'hyperswitch-checkout' );
+ $actions['wc_manual_capture_action'] = __( 'Capture Payment with Hyperswitch', 'hyperswitch' );
}
if ( ! ( in_array( $theorder->status, $terminal_status ) || strlen( $payment_id ) < 3 ) ) {
- $actions['wc_manual_sync_action'] = __( 'Sync Payment with Hyperswitch', 'hyperswitch-checkout' );
+ $actions['wc_manual_sync_action'] = __( 'Sync Payment with Hyperswitch', 'hyperswitch' );
}
return $actions;
}
@@ -240,9 +252,15 @@ function hyperswitch_process_manual_capture_action( $order ) {
if ( $status == 'succeeded' ) {
if ( $order->status !== 'processing' && $order->status !== 'refunded' ) {
$order->payment_complete( $payment_id );
- $order->add_order_note( 'Manual Capture successful (Hyperswitch Payment ID: ' . $payment_id . ')' );
- $order->add_order_note( 'Payment successful via ' . $payment_method . ' (Hyperswitch Payment ID: ' . $payment_id . ')' );
- $order->update_meta_data( 'payment_captured', 'yes' );
+ $order->add_order_note( sprintf(
+ /* translators: %s: payment ID */
+ __('Manual Capture successful (Hyperswitch Payment ID: %s)', 'hyperswitch'),$payment_id ) );
+ $order->add_order_note( sprintf(
+ /* translators: %1$s: payment method, %2$s: payment ID */
+ __('Payment successful via %1$s (Hyperswitch Payment ID: %2$s)', 'hyperswitch'),
+ $payment_method,
+ $payment_id
+ ) ); $order->update_meta_data( 'payment_captured', 'yes' );
$this->post_log( "WC_ORDER_PLACED", null, $payment_id );
}
} else if ( in_array( $status, $intermediate_status ) ) {
@@ -257,134 +275,158 @@ function hyperswitch_process_manual_capture_action( $order ) {
}
function hyperswitch_process_manual_sync_action( $order ) {
- $payment_id = $order->get_transaction_id();
- $responseObj = $this->retrieve_payment_intent( $payment_id );
- $status = $responseObj['status'];
- $payment_method = $responseObj['payment_method'];
- $intermediate_status = array( "processing", "requires_merchant_action", "requires_customer_action", "requires_confirmation", "requires_capture" );
- $order->add_order_note( 'Synced Payment Status (Hyperswitch Payment ID: ' . $payment_id . ')' );
- if ( $status == 'succeeded' ) {
- if ( $order->status !== 'processing' && $order->status !== 'refunded' ) {
- $this->post_log( "WC_ORDER_PLACED", null, $payment_id );
- }
- if ( $order->status !== 'refunded' ) {
- $order->add_order_note( 'Payment successful via ' . $payment_method . ' (Hyperswitch Payment ID: ' . $payment_id . ')' );
- $order->payment_complete( $payment_id );
- }
- } else if ( in_array( $status, $intermediate_status ) ) {
- $order->add_order_note( 'Payment processing via ' . $payment_method . ' (Hyperswitch Payment ID: ' . $payment_id . ')' );
- } else {
- $order->add_order_note( 'Payment failed via ' . $payment_method . ' (Hyperswitch Payment ID: ' . $payment_id . ')' );
- }
- $this->post_log( "WC_MANUAL_SYNC", $status, $payment_id );
- }
+ $payment_id = $order->get_transaction_id();
+ $responseObj = $this->retrieve_payment_intent( $payment_id );
+ $status = $responseObj['status'];
+ $payment_method = $responseObj['payment_method'];
+ $intermediate_status = array( "processing", "requires_merchant_action", "requires_customer_action", "requires_confirmation", "requires_capture" );
+
+ $order->add_order_note( sprintf(
+ /* translators: %s: payment ID */
+ __('Synced Payment Status (Hyperswitch Payment ID: %s)', 'hyperswitch'),
+ $payment_id
+ ));
+
+ if ( $status == 'succeeded' ) {
+ if ( $order->status !== 'processing' && $order->status !== 'refunded' ) {
+ $this->post_log( "WC_ORDER_PLACED", null, $payment_id );
+ }
+ if ( $order->status !== 'refunded' ) {
+ $order->add_order_note( sprintf(
+ /* translators: %1$s: payment method, %2$s: payment ID */
+ __('Payment successful via %1$s (Hyperswitch Payment ID: %2$s)', 'hyperswitch'),
+ $payment_method,
+ $payment_id
+ ));
+ $order->payment_complete( $payment_id );
+ }
+ } else if ( in_array( $status, $intermediate_status ) ) {
+ $order->add_order_note( sprintf(
+ /* translators: %1$s: payment method, %2$s: payment ID */
+ __('Payment processing via %1$s (Hyperswitch Payment ID: %2$s)', 'hyperswitch'),
+ $payment_method,
+ $payment_id
+ ));
+ } else {
+ $order->add_order_note( sprintf(
+ /* translators: %1$s: payment method, %2$s: payment ID */
+ __('Payment failed via %1$s (Hyperswitch Payment ID: %2$s)', 'hyperswitch'),
+ $payment_method,
+ $payment_id
+ ));
+ }
+ $this->post_log( "WC_MANUAL_SYNC", $status, $payment_id );
+}
- public function init_form_fields() {
-
- $webhookUrl = esc_url( admin_url( 'admin-post.php' ) ) . '?action=hyperswitch_wc_webhook';
-
- $this->form_fields = array(
- 'enabled' => array(
- 'title' => __( 'Enable/Disable', 'hyperswitch-checkout' ),
- 'label' => __( 'Enable Hyperswitch', 'hyperswitch-checkout' ),
- 'type' => 'checkbox',
- 'description' => '',
- 'default' => 'yes'
- ),
- 'method_title' => array(
- 'title' => __( 'Title', 'hyperswitch-checkout' ),
- 'type' => 'textarea',
- 'description' => __( 'The title to be displayed for Hyperswitch Payment Method (in case of multiple WooCommerce Payment Gateways/ Methods)', 'hyperswitch-checkout' ),
- 'default' => __( 'Credit, Debit Card and Wallet Payments (powered by Hyperswitch)', 'hyperswitch-checkout' )
- ),
- 'environment' => array(
- 'title' => __( 'Environment' ),
- 'label' => __( 'Select Environment' ),
- 'type' => 'select',
- 'options' => array(
- 'production' => __( 'Production', 'hyperswitch-checkout' ),
- 'sandbox' => __( 'Sandbox', 'hyperswitch-checkout' ),
- ),
- 'default' => 'sandbox',
- ),
- 'api_key' => array(
- 'title' => 'Api Key',
- 'type' => 'password',
- 'description' => __( 'Find this on Developers > API Keys section of Hyperswitch Dashboard', 'hyperswitch-checkout' )
- ),
- 'publishable_key' => array(
- 'title' => 'Publishable key',
- 'type' => 'text',
- 'description' => __( 'Find this on Developers > API Keys section of Hyperswitch Dashboard', 'hyperswitch-checkout' )
- ),
- 'webhook_secret_key' => array(
- 'title' => 'Payment Response Hash Key',
- 'type' => 'password',
- 'description' => __( 'Find this on Developers > API Keys section of Hyperswitch Dashboard', 'hyperswitch-checkout' )
- ),
- 'profile_id' => array(
- 'title' => 'Business Profile ID',
- 'type' => 'text',
- 'description' => __( 'Find this on Settings > Business profiles section of Hyperswitch Dashboard', 'hyperswitch-checkout' )
- ),
- 'enable_webhook' => array(
- 'title' => __( 'Enable Webhook', 'hyperswitch-checkout' ),
- 'type' => 'checkbox',
- 'description' => "Allow webhooks from Hyperswitch to receive real time updates of payments to update orders.
$webhookUrl
Use this URL to be entered as Webhook URL on Hyperswitch dashboard",
- 'label' => __( 'Enable Hyperswitch Webhook', 'hyperswitch-checkout' ),
- 'default' => 'yes'
- ),
- 'capture_method' => array(
- 'title' => __( 'Capture Method', 'hyperswitch-checkout' ),
- 'label' => __( 'Select Capture Method', 'hyperswitch-checkout' ),
- 'type' => 'select',
- 'description' => __( "Specify whether you want to capture payments manually or automatically", 'hyperswitch-checkout' ),
- 'options' => array(
- 'automatic' => __( 'Automatic', 'hyperswitch-checkout' ),
- 'manual' => __( 'Manual', 'hyperswitch-checkout' ),
- ),
- 'default' => 'automatic',
- ),
- 'enable_saved_payment_methods' => array(
- 'title' => __( 'Enable Saved Payment Methods', 'hyperswitch-checkout' ),
- 'type' => 'checkbox',
- 'description' => __( 'Allow registered customers to pay via saved payment methods', 'hyperswitch-checkout' ),
- 'label' => __( 'Enable Saved Payment Methods', 'hyperswitch-checkout' ),
- 'default' => 'yes'
- ),
- 'show_card_from_by_default' => array(
- 'title' => __( 'Show Card Form Always', 'hyperswitch-checkout' ),
- 'type' => 'checkbox',
- 'label' => __( 'Show Card Form before Payment Methods List has loaded', 'hyperswitch-checkout' ),
- 'default' => 'yes'
- ),
- 'appearance' => array(
- 'title' => 'Appearance',
- 'type' => 'textarea',
- 'default' => '{}',
- 'description' => __( 'Use the above parameter to pass appearance config (in json format) to the checkout.', 'hyperswitch-checkout' ),
- ),
- 'layout' => array(
- 'title' => 'Layout',
- 'label' => 'Select Layout',
- 'type' => 'select',
- 'description' => __( "Choose a layout that fits well with your UI pattern.", 'hyperswitch-checkout' ),
- 'options' => array(
- 'tabs' => __( 'Tabs', 'hyperswitch-checkout' ),
- 'accordion' => __( 'Accordion', 'hyperswitch-checkout' ),
- 'spaced' => __( 'Spaced Accordion', 'hyperswitch-checkout' ),
- ),
- 'default' => 'tabs',
- ),
- 'hold_order' => array(
- 'title' => __( 'Hold Order on Processing Payments', 'hyperswitch-checkout' ),
- 'type' => 'checkbox',
- 'description' => __( "Disable this only if you do not want to reduce stock levels until the payment is successful.", 'hyperswitch-checkout' ),
- 'label' => __( 'Whether to hold order, reduce stock if a payment goes into processing status.', 'hyperswitch-checkout' ),
- 'default' => 'yes'
- ),
- );
- }
+public function init_form_fields() {
+ $webhookUrl = esc_url( admin_url( 'admin-post.php' ) ) . '?action=hyperswitch_wc_webhook';
+
+ $this->form_fields = array(
+ 'enabled' => array(
+ 'title' => __('Enable/Disable', 'hyperswitch'),
+ 'label' => __('Enable Hyperswitch', 'hyperswitch'),
+ 'type' => 'checkbox',
+ 'description' => '',
+ 'default' => 'yes'
+ ),
+ 'method_title' => array(
+ 'title' => __('Title', 'hyperswitch'),
+ 'type' => 'textarea',
+ 'description' => __('The title to be displayed for Hyperswitch Payment Method (in case of multiple WooCommerce Payment Gateways/ Methods)', 'hyperswitch'),
+ 'default' => __('Credit, Debit Card and Wallet Payments (powered by Hyperswitch)', 'hyperswitch')
+ ),
+ 'environment' => array(
+ 'title' => __('Environment', 'hyperswitch'),
+ 'label' => __('Select Environment', 'hyperswitch'),
+ 'type' => 'select',
+ 'options' => array(
+ 'production' => __('Production', 'hyperswitch'),
+ 'sandbox' => __('Sandbox', 'hyperswitch'),
+ ),
+ 'default' => 'sandbox',
+ ),
+ 'api_key' => array(
+ 'title' => __('Api Key', 'hyperswitch'),
+ 'type' => 'password',
+ 'description' => __('Find this on Developers > API Keys section of Hyperswitch Dashboard', 'hyperswitch')
+ ),
+ 'publishable_key' => array(
+ 'title' => __('Publishable key', 'hyperswitch'),
+ 'type' => 'text',
+ 'description' => __('Find this on Developers > API Keys section of Hyperswitch Dashboard', 'hyperswitch')
+ ),
+ 'webhook_secret_key' => array(
+ 'title' => __('Payment Response Hash Key', 'hyperswitch'),
+ 'type' => 'password',
+ 'description' => __('Find this on Developers > API Keys section of Hyperswitch Dashboard', 'hyperswitch')
+ ),
+ 'profile_id' => array(
+ 'title' => __('Business Profile ID', 'hyperswitch'),
+ 'type' => 'text',
+ 'description' => __('Find this on Settings > Business profiles section of Hyperswitch Dashboard', 'hyperswitch')
+ ),
+ 'enable_webhook' => array(
+ 'title' => __('Enable Webhook', 'hyperswitch'),
+ 'type' => 'checkbox',
+ 'description' => sprintf(
+ /* translators: %s: webhook URL */
+ __('Allow webhooks from Hyperswitch to receive real time updates of payments to update orders.
%s
Use this URL to be entered as Webhook URL on Hyperswitch dashboard', 'hyperswitch'),
+ $webhookUrl
+ ),
+ 'label' => __('Enable Hyperswitch Webhook', 'hyperswitch'),
+ 'default' => 'yes'
+ ),
+ 'capture_method' => array(
+ 'title' => __('Capture Method', 'hyperswitch'),
+ 'label' => __('Select Capture Method', 'hyperswitch'),
+ 'type' => 'select',
+ 'description' => __('Specify whether you want to capture payments manually or automatically', 'hyperswitch'),
+ 'options' => array(
+ 'automatic' => __('Automatic', 'hyperswitch'),
+ 'manual' => __('Manual', 'hyperswitch'),
+ ),
+ 'default' => 'automatic',
+ ),
+ 'enable_saved_payment_methods' => array(
+ 'title' => __('Enable Saved Payment Methods', 'hyperswitch'),
+ 'type' => 'checkbox',
+ 'description' => __('Allow registered customers to pay via saved payment methods', 'hyperswitch'),
+ 'label' => __('Enable Saved Payment Methods', 'hyperswitch'),
+ 'default' => 'yes'
+ ),
+ 'show_card_from_by_default' => array(
+ 'title' => __('Show Card Form Always', 'hyperswitch'),
+ 'type' => 'checkbox',
+ 'label' => __('Show Card Form before Payment Methods List has loaded', 'hyperswitch'),
+ 'default' => 'yes'
+ ),
+ 'appearance' => array(
+ 'title' => __('Appearance', 'hyperswitch'),
+ 'type' => 'textarea',
+ 'default' => '{}',
+ 'description' => __('Use the above parameter to pass appearance config (in json format) to the checkout.', 'hyperswitch'),
+ ),
+ 'layout' => array(
+ 'title' => __('Layout', 'hyperswitch'),
+ 'label' => __('Select Layout', 'hyperswitch'),
+ 'type' => 'select',
+ 'description' => __('Choose a layout that fits well with your UI pattern.', 'hyperswitch'),
+ 'options' => array(
+ 'tabs' => __('Tabs', 'hyperswitch'),
+ 'accordion' => __('Accordion', 'hyperswitch'),
+ 'spaced' => __('Spaced Accordion', 'hyperswitch'),
+ ),
+ 'default' => 'tabs',
+ ),
+ 'hold_order' => array(
+ 'title' => __('Hold Order on Processing Payments', 'hyperswitch'),
+ 'type' => 'checkbox',
+ 'description' => __('Disable this only if you do not want to reduce stock levels until the payment is successful.', 'hyperswitch'),
+ 'label' => __('Whether to hold order, reduce stock if a payment goes into processing status.', 'hyperswitch'),
+ 'default' => 'yes'
+ ),
+ );
+}
function receipt_page( $payment_id ) {
$payment_intent = $this->create_payment_intent( $payment_id );
@@ -407,14 +449,14 @@ function receipt_page( $payment_id ) {
global $woocommerce;
$order = new WC_Order( $payment_id );
$error = $payment_intent['body'];
- $order->add_order_note( __( 'Unable to Create Hyperswitch Payment Intent.', 'hyperswitch-checkout' ) );
+ $order->add_order_note( __( 'Unable to Create Hyperswitch Payment Intent.', 'hyperswitch' ) );
$order->add_order_note( 'Error: ' . $error );
$this->post_log( "WC_FAILED_TO_CREATE_PAYMENT_INTENT", $error );
if ( function_exists( 'wc_add_notice' ) ) {
- wc_add_notice( __( "Something went wrong. Please contact support for assistance.", 'hyperswitch-checkout' ), 'error' );
+ wc_add_notice( __( "Something went wrong. Please contact support for assistance.", 'hyperswitch' ), 'error' );
} else {
- $woocommerce->add_error( __( "Something went wrong. Please contact support for assistance.", 'hyperswitch-checkout' ) );
+ $woocommerce->add_error( __( "Something went wrong. Please contact support for assistance.", 'hyperswitch' ) );
$woocommerce->set_messages();
}
$redirect_url = get_permalink( wc_get_page_id( 'cart' ) );
@@ -447,14 +489,14 @@ function render_payment_sheet( $order_id, $client_secret = null ) {
global $woocommerce;
$order = new WC_Order( $order_id );
$error = $payment_intent['body'];
- $order->add_order_note( __( 'Unable to Create Hyperswitch Payment Intent.', 'hyperswitch-checkout' ) );
+ $order->add_order_note( __( 'Unable to Create Hyperswitch Payment Intent.', 'hyperswitch' ) );
$order->add_order_note( 'Error: ' . $error );
$this->post_log( "WC_FAILED_TO_CREATE_PAYMENT_INTENT", $error );
if ( function_exists( 'wc_add_notice' ) ) {
- wc_add_notice( __( "Something went wrong. Please contact support for assistance.", 'hyperswitch-checkout' ), 'error' );
+ wc_add_notice( __( "Something went wrong. Please contact support for assistance.", 'hyperswitch' ), 'error' );
} else {
- $woocommerce->add_error( __( "Something went wrong. Please contact support for assistance.", 'hyperswitch-checkout' ) );
+ $woocommerce->add_error( __( "Something went wrong. Please contact support for assistance.", 'hyperswitch' ) );
$woocommerce->set_messages();
}
$redirect_url = get_permalink( woocommerce_get_page_id( 'cart' ) );
@@ -662,13 +704,13 @@ function retrieve_payment_intent( $payment_id ) {
public function create_customer( $customer_id, $name, $email ) {
$apiKey = $this->get_option( 'api_key' );
-
+
$url = $this->hyperswitch_url . "/customers";
$payload = array(
"customer_id" => $customer_id,
"email" => $email,
"name" => $name,
- "description" => __( "Customer created via Woocommerce Application", 'hyperswitch-checkout' )
+ "description" => __("Customer created via Woocommerce Application", 'hyperswitch')
);
$args = array(
'body' => wp_json_encode( $payload ),
@@ -682,14 +724,14 @@ public function create_customer( $customer_id, $name, $email ) {
'api-key' => $apiKey
)
);
-
+
$response = wp_remote_retrieve_body( wp_remote_post( $url, $args ) );
return json_decode( $response, true );
}
-
+
public function post_log( $event_name, $value = null, $payment_id = null ) {
$publishable_key = $this->get_option( 'publishable_key' );
-
+
switch ( $this->environment ) {
case "sandbox":
$url = "https://sandbox.hyperswitch.io/logs/sdk";
@@ -701,13 +743,13 @@ public function post_log( $event_name, $value = null, $payment_id = null ) {
$url = "https://sandbox.hyperswitch.io/logs/sdk";
break;
}
-
+
if ( str_contains( $event_name, "ERROR" ) ) {
$log_type = "ERROR";
} else {
$log_type = "INFO";
}
-
+
$payload = array(
"merchant_id" => $publishable_key,
"event_name" => $event_name,
@@ -718,19 +760,19 @@ public function post_log( $event_name, $value = null, $payment_id = null ) {
"log_category" => "MERCHANT_EVENT",
"timestamp" => floor( microtime( true ) * 1000 ) . ""
);
-
+
if ( isset( $payment_id ) ) {
$payload["payment_id"] = $payment_id;
}
-
+
if ( isset( $value ) ) {
$payload["value"] = $value;
}
-
+
$data = array(
"data" => [ $payload ]
);
-
+
$args = array(
'body' => wp_json_encode( $data ),
'timeout' => 45,
@@ -742,17 +784,15 @@ public function post_log( $event_name, $value = null, $payment_id = null ) {
'Content-Type' => 'application/json'
)
);
-
+
$response = wp_remote_retrieve_body( wp_remote_post( $url, $args ) );
return json_decode( $response, true );
}
-
+
public function manual_capture( $payment_id ) {
$apiKey = $this->get_option( 'api_key' );
-
$url = $this->hyperswitch_url . "/payments/" . $payment_id . "/capture";
-
- // Execute the request
+
$args = array(
'timeout' => 45,
'redirection' => 5,
@@ -763,21 +803,20 @@ public function manual_capture( $payment_id ) {
'api-key' => $apiKey
)
);
-
+
$response = wp_remote_retrieve_body( wp_remote_post( $url, $args ) );
return json_decode( $response, true );
}
-
+
public function create_refund( $payment_id, $amount, $reason, $refund_num, $order_id ) {
$apiKey = $this->get_option( 'api_key' );
-
$url = $this->hyperswitch_url . "/refunds";
-
+
$metadata = array(
"refund_num" => $refund_num,
"order_num" => $order_id
);
-
+
$payload = array(
"payment_id" => $payment_id,
"amount" => ( (int) $amount * 100 ),
@@ -785,8 +824,7 @@ public function create_refund( $payment_id, $amount, $reason, $refund_num, $orde
"refund_type" => "instant",
"metadata" => $metadata
);
-
- // Execute the request
+
$args = array(
'body' => wp_json_encode( $payload ),
'timeout' => 45,
@@ -799,12 +837,11 @@ public function create_refund( $payment_id, $amount, $reason, $refund_num, $orde
'api-key' => $apiKey
)
);
-
+
$response = wp_remote_retrieve_body( wp_remote_post( $url, $args ) );
-
return json_decode( $response, true );
}
-
+
/**
* Process the payment and return the result
**/
@@ -816,33 +853,48 @@ function process_payment( $payment_id ) {
$order = new WC_Order( $payment_id );
return array( 'result' => 'success', 'redirect' => $order->get_checkout_payment_url( true ) );
}
-
+
public function check_hyperswitch_response() {
-
global $woocommerce;
$payment_id = $_GET['payment_id'];
-
+
$msg['class'] = 'error';
- $msg['message'] = "Thank you for shopping with us. However, the transaction has been declined.";
-
+ $msg['message'] = __("Thank you for shopping with us. However, the transaction has been declined.", 'hyperswitch');
+
$paymentResponse = $this->retrieve_payment_intent( $payment_id );
$status = $paymentResponse['status'];
$payment_method = $paymentResponse['payment_method'];
$intermediate_status = array( "processing", "requires_merchant_action", "requires_customer_action", "requires_confirmation", "requires_capture" );
$order_num = ( $paymentResponse['metadata'] )['order_num'];
$order = new WC_Order( $order_num );
+
if ( $status == 'succeeded' ) {
$msg['class'] = 'success';
$order->payment_complete( $payment_id );
- $order->add_order_note( 'Payment successful via ' . $payment_method . ' (Hyperswitch Payment ID: ' . $payment_id . ')' );
+ $order->add_order_note( sprintf(
+ /* translators: %1$s: payment method, %2$s: payment ID */
+ __('Payment successful via %1$s (Hyperswitch Payment ID: %2$s)', 'hyperswitch'),
+ $payment_method,
+ $payment_id
+ ));
$woocommerce->cart->empty_cart();
$this->post_log( "WC_ORDER_PLACED", null, $payment_id );
} else if ( in_array( $status, $intermediate_status ) ) {
$original_status = $order->status;
if ( $status == 'requires_capture' ) {
- $order->add_order_note( 'Payment authorized via ' . $payment_method . ' (Hyperswitch Payment ID: ' . $payment_id . '). Note: Requires Capture' );
+ $order->add_order_note( sprintf(
+ /* translators: %1$s: payment method, %2$s: payment ID */
+ __('Payment authorized via %1$s (Hyperswitch Payment ID: %2$s). Note: Requires Capture', 'hyperswitch'),
+ $payment_method,
+ $payment_id
+ ));
} else {
- $order->add_order_note( 'Payment processing via ' . $payment_method . ' (Hyperswitch Payment ID: ' . $payment_id . ')' );
+ $order->add_order_note( sprintf(
+ /* translators: %1$s: payment method, %2$s: payment ID */
+ __('Payment processing via %1$s (Hyperswitch Payment ID: %2$s)', 'hyperswitch'),
+ $payment_method,
+ $payment_id
+ ));
}
$order->set_transaction_id( $payment_id );
$order->update_status( $this->processing_payment_order_status );
@@ -851,27 +903,32 @@ public function check_hyperswitch_response() {
$this->post_log( "WC_ORDER_ON_HOLD", $status, $payment_id );
} else {
$errorMessage = $paymentResponse['error']['message'] ?? $paymentResponse['error_code'] ?? "NA";
- $order->add_order_note( 'Payment failed via ' . $payment_method . ' (Hyperswitch Payment ID: ' . $payment_id . ') with error message: ' . $errorMessage );
+ $order->add_order_note( sprintf(
+ /* translators: %1$s: payment method, %2$s: payment ID, %3$s: error message */
+ __('Payment failed via %1$s (Hyperswitch Payment ID: %2$s) with error message: %3$s', 'hyperswitch'),
+ $payment_method,
+ $payment_id,
+ $errorMessage
+ ));
$order->update_status( 'pending' );
$msg['class'] = 'error';
- $msg['message'] = "Thank you for shopping with us. However, the payment has failed. Please retry the payment.";
+ $msg['message'] = __("Thank you for shopping with us. However, the payment has failed. Please retry the payment.", 'hyperswitch');
$this->post_log( "WC_ERROR_IN_PLACING_ORDER", $errorMessage, $payment_id );
}
-
+
if ( $paymentResponse['capture_method'] === "automatic" ) {
$order->update_meta_data( 'payment_captured', 'yes' );
}
-
+
if ( $msg['class'] != 'success' ) {
if ( function_exists( 'wc_add_notice' ) ) {
wc_add_notice( $msg['message'], $msg['class'] );
-
} else {
$woocommerce->add_error( $msg['message'] );
$woocommerce->set_messages();
}
}
-
+
if ( $msg['class'] == 'success' ) {
$redirect_url = $this->get_return_url( $order );
} else {
@@ -883,66 +940,67 @@ public function check_hyperswitch_response() {
}
}
- function hyperswitch_add_payment_class( $gateways ) {
- $gateways[] = 'Hyperswitch_Checkout';
- return $gateways;
- }
-
- add_filter( 'woocommerce_payment_gateways', 'hyperswitch_add_payment_class' );
-
-}
+ function hyperswitch_add_payment_class( $gateways ) {
+ $gateways[] = 'Hyperswitch_Checkout';
+ return $gateways;
+ }
+
+ add_filter( 'woocommerce_payment_gateways', 'hyperswitch_add_payment_class' );
-// This is set to a priority of 10
-function hyperswitch_webhook_init() {
- $hyperswitchWebhook = new Hyperswitch_Webhook();
- $hyperswitchWebhook->process();
}
-
-function hyperswitch_create_or_update_payment_intent() {
- $nonce = $_POST['wc_nonce'];
- if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $nonce ) ), 'woocommerce-process_checkout' ) ) {
- wp_send_json(
- array(
- "messages" => __( "Something went wrong. Please try again or reload the page.", 'hyperswitch-checkout' )
- )
- );
- } else {
- $hyperswitch = new Hyperswitch_Checkout();
- $order_id = $_POST['order_id'];
- $client_secret = $_POST['client_secret'];
- if ( ! isset( $client_secret ) ) {
- $hyperswitch->post_log( "WC_ORDER_CREATE", null, $order_id );
- } else {
- $payment_id = "";
- $parts = explode( "_secret", $client_secret );
- if ( count( $parts ) === 2 ) {
- $payment_id = $parts[0];
- }
- $hyperswitch->post_log( "WC_ORDER_UPDATE", $payment_id, $order_id );
+
+
+ // This is set to a priority of 10
+ function hyperswitch_webhook_init() {
+ $hyperswitchWebhook = new Hyperswitch_Webhook();
+ $hyperswitchWebhook->process();
}
- $payment_sheet = $hyperswitch->render_payment_sheet( $order_id, $client_secret );
- if ( isset( $payment_sheet['payment_sheet'] ) ) {
- $hyperswitch->post_log( "WC_CHECKOUT_INITIATED", $order_id, $order_id );
- wp_send_json(
- array(
- "order_id" => $order_id,
- "payment_sheet" => $payment_sheet['payment_sheet']
- )
- );
- } else {
- $hyperswitch->post_log( "WC_INTEGRATION_ERROR", $order_id, $order_id );
- wp_send_json(
- array(
- "order_id" => $order_id,
- "redirect" => $payment_sheet['redirect_url']
- )
- );
+
+ function hyperswitch_create_or_update_payment_intent() {
+ $nonce = $_POST['wc_nonce'];
+ if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $nonce ) ), 'woocommerce-process_checkout' ) ) {
+ wp_send_json(
+ array(
+ "messages" => __("Something went wrong. Please try again or reload the page.", 'hyperswitch')
+ )
+ );
+ } else {
+ $hyperswitch = new Hyperswitch_Checkout();
+ $order_id = $_POST['order_id'];
+ $client_secret = $_POST['client_secret'];
+ if ( ! isset( $client_secret ) ) {
+ $hyperswitch->post_log( "WC_ORDER_CREATE", null, $order_id );
+ } else {
+ $payment_id = "";
+ $parts = explode( "_secret", $client_secret );
+ if ( count( $parts ) === 2 ) {
+ $payment_id = $parts[0];
+ }
+ $hyperswitch->post_log( "WC_ORDER_UPDATE", $payment_id, $order_id );
+ }
+ $payment_sheet = $hyperswitch->render_payment_sheet( $order_id, $client_secret );
+ if ( isset( $payment_sheet['payment_sheet'] ) ) {
+ $hyperswitch->post_log( "WC_CHECKOUT_INITIATED", $order_id, $order_id );
+ wp_send_json(
+ array(
+ "order_id" => $order_id,
+ "payment_sheet" => $payment_sheet['payment_sheet']
+ )
+ );
+ } else {
+ $hyperswitch->post_log( "WC_INTEGRATION_ERROR", $order_id, $order_id );
+ wp_send_json(
+ array(
+ "order_id" => $order_id,
+ "redirect" => $payment_sheet['redirect_url']
+ )
+ );
+ }
+ }
}
- }
-}
-
-function hyperswitch_declare_compatibility() {
- if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
- \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
- }
-}
\ No newline at end of file
+
+ function hyperswitch_declare_compatibility() {
+ if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
+ \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
+ }
+ }
\ No newline at end of file
diff --git a/i18n-setup.php b/i18n-setup.php
new file mode 100644
index 0000000..1db767c
--- /dev/null
+++ b/i18n-setup.php
@@ -0,0 +1,68 @@
+ $match) {
+ if (empty($matches[2][$key]) || $matches[2][$key] !== 'hyperswitch') {
+ $missing_domain[] = array(
+ 'file' => $file,
+ 'string' => $match
+ );
+ }
+ }
+ }
+ }
+ }
+
+ return $missing_domain;
+}
+
+// Scan files
+$files = scan_php_files(__DIR__);
+$missing = check_translation_functions($files);
+
+if (!empty($missing)) {
+ echo "Found translation functions missing 'hyperswitch' text domain:\n\n";
+ foreach ($missing as $item) {
+ echo "File: {$item['file']}\n";
+ echo "Function: {$item['string']}\n\n";
+ }
+} else {
+ echo "All translation functions have proper text domain.\n";
+}
diff --git a/includes/hyperswitch-webhook.php b/includes/hyperswitch-webhook.php
index 74cbee0..da38183 100644
--- a/includes/hyperswitch-webhook.php
+++ b/includes/hyperswitch-webhook.php
@@ -1,4 +1,15 @@
hyperswitch = new Hyperswitch_Checkout();
+
+ // Load plugin text domain
+ add_action('init', array($this, 'load_plugin_textdomain'));
+ }
+ /**
+ * Load plugin textdomain.
+ */
+ public function load_plugin_textdomain() {
+ load_plugin_textdomain(
+ 'hyperswitch',
+ false,
+ dirname(plugin_basename(__FILE__)) . '/locale/'
+ );
}
public function process() {
if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) {
$raw_post_data = file_get_contents( 'php://input' );
- if ( ! empty ( $raw_post_data ) ) {
+ if ( ! empty( $raw_post_data ) ) {
$data = json_decode( $raw_post_data, true );
$signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE_512'];
-
if ( json_last_error() !== 0 ) {
return;
}
$enabled = $this->hyperswitch->get_option( 'enable_webhook' );
- if ( ( $enabled === 'yes' ) and ( empty ( $data['event_type'] ) === false ) ) {
- // Skip the webhook if webhooks are disabled, or the event type is unrecognised
+ if ( ( $enabled === 'yes' ) && ( ! empty( $data['event_type'] ) ) ) {
$payment_id = $data['content']['object']['payment_id'];
- $this->hyperswitch->post_log( "WC_WEBHOOK_RECEIVED", $data['event_type'], $payment_id );
+ $this->hyperswitch->post_log(
+ /* translators: Webhook received log message */
+ __( 'WC_WEBHOOK_RECEIVED', 'hyperswitch' ),
+ $data['event_type'],
+ $payment_id
+ );
+
if ( $this->shouldConsumeWebhook( $data, $signature, $raw_post_data ) === false ) {
return;
}
+
switch ( $data['event_type'] ) {
case self::PAYMENT_SUCCEEDED:
return $this->paymentAuthorized( $data );
case self::PAYMENT_FAILED:
- return $this->paymentHandle( $data, "failed" );
+ return $this->paymentHandle( $data, __( 'failed', 'hyperswitch' ) );
case self::PAYMENT_PROCESSING:
- return $this->paymentHandle( $data, "processing" );
+ return $this->paymentHandle( $data, __( 'processing', 'hyperswitch' ) );
- case self::ACTION_REQURIED:
- return $this->paymentHandle( $data, "action required" );
+ case self::ACTION_REQUIRED:
+ return $this->paymentHandle( $data, __( 'action required', 'hyperswitch' ) );
case self::REFUND_SUCCEEDED:
return $this->refundedCreated( $data );
@@ -89,48 +102,76 @@ public function process() {
}
protected function paymentAuthorized( array $data ) {
-
$order_id = $data['content']['object']['metadata']['order_num'];
-
$order = wc_get_order( $order_id );
if ( $order ) {
$payment_id = $data['content']['object']['payment_id'];
$payment_method = $data['content']['object']['payment_method'];
+
if ( $order->status !== 'processing' ) {
- $this->hyperswitch->post_log( "WC_ORDER_PLACED", null, $payment_id );
+ $this->hyperswitch->post_log(
+ /* translators: Order placed log message */
+ __( 'WC_ORDER_PLACED', 'hyperswitch' ),
+ null,
+ $payment_id
+ );
}
+
$order->payment_complete( $payment_id );
- $order->add_order_note( 'Payment successful via ' . $payment_method . ' (Hyperswitch Payment ID: ' . $payment_id . ') (via Hyperswitch Webhook)' );
+ $order->add_order_note( sprintf(
+ /* translators: 1: Payment method 2: Payment ID */
+ __( 'Payment successful via %1$s (Hyperswitch Payment ID: %2$s) (via Hyperswitch Webhook)', 'hyperswitch' ),
+ $payment_method,
+ $payment_id
+ ));
+
if ( $data['object']['capture_method'] === "automatic" ) {
$order->update_meta_data( 'payment_captured', 'yes' );
}
- $this->hyperswitch->post_log( "WC_PAYMENT_SUCCEEDED_WEBHOOK", null, $payment_id );
-
+
+ $this->hyperswitch->post_log(
+ /* translators: Payment succeeded webhook log message */
+ __( 'WC_PAYMENT_SUCCEEDED_WEBHOOK', 'hyperswitch' ),
+ null,
+ $payment_id
+ );
} else {
- exit; // Not a Woocommerce Order
+ exit; // Not a WooCommerce Order
}
exit;
}
protected function paymentHandle( array $data, $status ) {
-
$order_id = $data['content']['object']['metadata']['order_num'];
-
$order = wc_get_order( $order_id );
if ( $order ) {
$payment_id = $data['content']['object']['payment_id'];
$payment_method = $data['content']['object']['payment_method'];
$order->set_transaction_id( $payment_id );
- if ( $status == 'processing' ) {
+
+ if ( $status == __( 'processing', 'hyperswitch' ) ) {
$order->update_status( $this->hyperswitch->processing_payment_order_status );
} else {
- $order->update_status( 'pending' );
+ $order->update_status( __( 'pending', 'hyperswitch' ) );
}
- $order->add_order_note( 'Payment ' . $status . ' via ' . $payment_method . ' (Hyperswitch Payment ID: ' . $payment_id . ') (via Hyperswitch Webhook)' );
- $this->hyperswitch->post_log( "WC_PAYMENT_" . str_replace( " ", "_", strtoupper( $status ) ) . "_WEBHOOK", null, $payment_id );
+
+ $order->add_order_note( sprintf(
+ /* translators: 1: Payment status 2: Payment method 3: Payment ID */
+ __( 'Payment %1$s via %2$s (Hyperswitch Payment ID: %3$s) (via Hyperswitch Webhook)', 'hyperswitch' ),
+ $status,
+ $payment_method,
+ $payment_id
+ ));
+
+ $this->hyperswitch->post_log(
+ /* translators: Payment status webhook log message */
+ __( sprintf('WC_PAYMENT_%s_WEBHOOK', str_replace( " ", "_", strtoupper( $status ) )), 'hyperswitch' ),
+ null,
+ $payment_id
+ );
}
exit;
@@ -138,20 +179,22 @@ protected function paymentHandle( array $data, $status ) {
protected function refundedCreated( array $data ) {
$payment_id = $data['content']['object']['payment_id'];
- if ( isset ( $data['content']['object']['metadata']['order_num'] ) ) {
+ if ( isset( $data['content']['object']['metadata']['order_num'] ) ) {
$order_id = $data['content']['object']['metadata']['order_num'];
} else {
$payment_intent = $this->hyperswitch->retrieve_payment_intent( $payment_id );
$order_id = $payment_intent['metadata']['order_num'];
}
+
$refund_num = $data['content']['object']['metadata']['refund_num'];
$refund_id = $data['content']['object']['refund_id'];
$order = wc_get_order( $order_id );
+
if ( $order ) {
$refunds = $order->get_refunds();
$targetRefund = null;
- if ( isset ( $refund_num ) ) {
+ if ( isset( $refund_num ) ) {
foreach ( $refunds as $refund ) {
if ( $refund->id == $refund_num ) {
$targetRefund = $refund;
@@ -159,31 +202,37 @@ protected function refundedCreated( array $data ) {
}
}
}
- if ( ! isset ( $targetRefund ) ) { // Refund initiated via Hyperswitch Dashboard
+
+ if ( ! isset( $targetRefund ) ) { // Refund initiated via Hyperswitch Dashboard
$refund = new WC_Order_Refund;
$amount = $data['content']['object']['amount'];
$reason = $data['content']['object']['reason'];
$refund->set_amount( (float) $amount / 100 );
$refund->set_reason( $reason );
}
- $order->add_order_note( 'Refund Successful (Hyperswitch Refund ID: ' . $refund_id . ') (via Hyperswitch Webhook)' );
+
+ $order->add_order_note( sprintf(
+ /* translators: %s: Refund ID */
+ __( 'Refund Successful (Hyperswitch Refund ID: %1$s) (via Hyperswitch Webhook)', 'hyperswitch' ),
+ $refund_id
+ ));
$refund->set_refunded_payment( true );
} else {
- exit; // Not a refund for a Woocommerce Order
+ exit; // Not a refund for a WooCommerce Order
}
- // Graceful exit since payment is now refunded.
+
exit;
}
-
protected function shouldConsumeWebhook( $data, $signature, $payload ) {
$webhook_key = $this->hyperswitch->get_option( 'webhook_secret_key' );
$generated_signature = hash_hmac( 'sha512', $payload, $webhook_key );
$signature_verification_result = $generated_signature === $signature;
if (
- ( isset ( $data['event_type'] ) ) and
- ( in_array( $data['event_type'], $this->eventsArray ) && $signature_verification_result )
+ isset( $data['event_type'] ) &&
+ in_array( $data['event_type'], $this->eventsArray ) &&
+ $signature_verification_result
) {
return true;
}
diff --git a/locale/hyperswitch.pot b/locale/hyperswitch.pot
new file mode 100644
index 0000000..17cec41
--- /dev/null
+++ b/locale/hyperswitch.pot
@@ -0,0 +1,348 @@
+# Copyright (C) 2024 Hyperswitch
+# This file is distributed under the GPLv2 or later.
+#, fuzzy
+msgid ""
+msgstr ""
+"#-#-#-#-# hyperswitch-checkout.pot (Hyperswitch Checkout for WooCommerce "
+"1.6.2) #-#-#-#-#\n"
+"Project-Id-Version: Hyperswitch Checkout for WooCommerce 1.6.2\n"
+"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/hyperswitch-"
+"woocommerce-plugin\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"POT-Creation-Date: 2024-10-06T12:46:48+05:30\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"X-Generator: WP-CLI 2.11.0\n"
+"X-Domain: hyperswitch-checkout\n"
+"#-#-#-#-# hyperswitch.pot (Hyperswitch Checkout for WooCommerce 1.6.2) #-#-"
+"#-#-#\n"
+"Project-Id-Version: Hyperswitch Checkout for WooCommerce 1.6.2\n"
+"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/hyperswitch-"
+"woocommerce-plugin\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"POT-Creation-Date: 2024-10-05T22:36:53+05:30\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"X-Generator: WP-CLI 2.11.0\n"
+"X-Domain: hyperswitch\n"
+
+#. Plugin Name of the plugin
+#: hyperswitch-checkout.php
+msgid "Hyperswitch Checkout for WooCommerce"
+msgstr ""
+
+#. Plugin URI of the plugin
+#. Author URI of the plugin
+#: hyperswitch-checkout.php
+msgid "https://hyperswitch.io/"
+msgstr ""
+
+#. Description of the plugin
+#: hyperswitch-checkout.php
+msgid "Hyperswitch checkout plugin for WooCommerce"
+msgstr ""
+
+#. Author of the plugin
+#: hyperswitch-checkout.php
+msgid "Hyperswitch"
+msgstr ""
+
+#: hyperswitch-checkout.php:60
+msgid "Allow customers to securely pay via Hyperswitch"
+msgstr ""
+
+#: hyperswitch-checkout.php:134
+msgid "Settings"
+msgstr ""
+
+#: hyperswitch-checkout.php:237
+msgid "Capture Payment with Hyperswitch"
+msgstr ""
+
+#: hyperswitch-checkout.php:241
+msgid "Sync Payment with Hyperswitch"
+msgstr ""
+
+#. translators: %s: payment ID
+#: hyperswitch-checkout.php:286
+msgid "Synced Payment Status (Hyperswitch Payment ID: %s)"
+msgstr ""
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:297 hyperswitch-checkout.php:876
+msgid "Payment successful via %1$s (Hyperswitch Payment ID: %2$s)"
+msgstr ""
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:306 hyperswitch-checkout.php:894
+msgid "Payment processing via %1$s (Hyperswitch Payment ID: %2$s)"
+msgstr ""
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:313
+msgid "Payment failed via %1$s (Hyperswitch Payment ID: %2$s)"
+msgstr ""
+
+#: hyperswitch-checkout.php:326
+msgid "Enable/Disable"
+msgstr ""
+
+#: hyperswitch-checkout.php:327
+msgid "Enable Hyperswitch"
+msgstr ""
+
+#: hyperswitch-checkout.php:333
+msgid "Title"
+msgstr ""
+
+#: hyperswitch-checkout.php:335
+msgid ""
+"The title to be displayed for Hyperswitch Payment Method (in case of "
+"multiple WooCommerce Payment Gateways/ Methods)"
+msgstr ""
+
+#: hyperswitch-checkout.php:336
+msgid "Credit, Debit Card and Wallet Payments (powered by Hyperswitch)"
+msgstr ""
+
+#: hyperswitch-checkout.php:339
+msgid "Environment"
+msgstr ""
+
+#: hyperswitch-checkout.php:340
+msgid "Select Environment"
+msgstr ""
+
+#: hyperswitch-checkout.php:343
+msgid "Production"
+msgstr ""
+
+#: hyperswitch-checkout.php:344
+msgid "Sandbox"
+msgstr ""
+
+#: hyperswitch-checkout.php:349
+msgid "Api Key"
+msgstr ""
+
+#: hyperswitch-checkout.php:351 hyperswitch-checkout.php:356
+#: hyperswitch-checkout.php:361
+msgid "Find this on Developers > API Keys section of Hyperswitch Dashboard"
+msgstr ""
+
+#: hyperswitch-checkout.php:354
+msgid "Publishable key"
+msgstr ""
+
+#: hyperswitch-checkout.php:359
+msgid "Payment Response Hash Key"
+msgstr ""
+
+#: hyperswitch-checkout.php:364
+msgid "Business Profile ID"
+msgstr ""
+
+#: hyperswitch-checkout.php:366
+msgid ""
+"Find this on Settings > Business profiles section of Hyperswitch Dashboard"
+msgstr ""
+
+#: hyperswitch-checkout.php:369
+msgid "Enable Webhook"
+msgstr ""
+
+#. translators: %s: webhook URL
+#: hyperswitch-checkout.php:373
+msgid ""
+"Allow webhooks from Hyperswitch to receive real time updates of payments to "
+"update orders.
%s
Use this URL to be entered "
+"as Webhook URL on Hyperswitch dashboard"
+msgstr ""
+
+#: hyperswitch-checkout.php:376
+msgid "Enable Hyperswitch Webhook"
+msgstr ""
+
+#: hyperswitch-checkout.php:380
+msgid "Capture Method"
+msgstr ""
+
+#: hyperswitch-checkout.php:381
+msgid "Select Capture Method"
+msgstr ""
+
+#: hyperswitch-checkout.php:383
+msgid "Specify whether you want to capture payments manually or automatically"
+msgstr ""
+
+#: hyperswitch-checkout.php:385
+msgid "Automatic"
+msgstr ""
+
+#: hyperswitch-checkout.php:386
+msgid "Manual"
+msgstr ""
+
+#: hyperswitch-checkout.php:391 hyperswitch-checkout.php:394
+msgid "Enable Saved Payment Methods"
+msgstr ""
+
+#: hyperswitch-checkout.php:393
+msgid "Allow registered customers to pay via saved payment methods"
+msgstr ""
+
+#: hyperswitch-checkout.php:398
+msgid "Show Card Form Always"
+msgstr ""
+
+#: hyperswitch-checkout.php:400
+msgid "Show Card Form before Payment Methods List has loaded"
+msgstr ""
+
+#: hyperswitch-checkout.php:404
+msgid "Appearance"
+msgstr ""
+
+#: hyperswitch-checkout.php:407
+msgid ""
+"Use the above parameter to pass appearance config (in json format) to the "
+"checkout."
+msgstr ""
+
+#: hyperswitch-checkout.php:410
+msgid "Layout"
+msgstr ""
+
+#: hyperswitch-checkout.php:411
+msgid "Select Layout"
+msgstr ""
+
+#: hyperswitch-checkout.php:413
+msgid "Choose a layout that fits well with your UI pattern."
+msgstr ""
+
+#: hyperswitch-checkout.php:415
+msgid "Tabs"
+msgstr ""
+
+#: hyperswitch-checkout.php:416
+msgid "Accordion"
+msgstr ""
+
+#: hyperswitch-checkout.php:417
+msgid "Spaced Accordion"
+msgstr ""
+
+#: hyperswitch-checkout.php:422
+msgid "Hold Order on Processing Payments"
+msgstr ""
+
+#: hyperswitch-checkout.php:424
+msgid ""
+"Disable this only if you do not want to reduce stock levels until the "
+"payment is successful."
+msgstr ""
+
+#: hyperswitch-checkout.php:425
+msgid ""
+"Whether to hold order, reduce stock if a payment goes into processing status."
+msgstr ""
+
+#: hyperswitch-checkout.php:452 hyperswitch-checkout.php:492
+msgid "Unable to Create Hyperswitch Payment Intent."
+msgstr ""
+
+#: hyperswitch-checkout.php:456 hyperswitch-checkout.php:459
+#: hyperswitch-checkout.php:496 hyperswitch-checkout.php:499
+msgid "Something went wrong. Please contact support for assistance."
+msgstr ""
+
+#: hyperswitch-checkout.php:713
+msgid "Customer created via Woocommerce Application"
+msgstr ""
+
+#: hyperswitch-checkout.php:862
+msgid ""
+"Thank you for shopping with us. However, the transaction has been declined."
+msgstr ""
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:887
+msgid ""
+"Payment authorized via %1$s (Hyperswitch Payment ID: %2$s). Note: Requires "
+"Capture"
+msgstr ""
+
+#. translators: %1$s: payment method, %2$s: payment ID, %3$s: error message
+#: hyperswitch-checkout.php:908
+msgid ""
+"Payment failed via %1$s (Hyperswitch Payment ID: %2$s) with error message: "
+"%3$s"
+msgstr ""
+
+#: hyperswitch-checkout.php:915
+msgid ""
+"Thank you for shopping with us. However, the payment has failed. Please "
+"retry the payment."
+msgstr ""
+
+#: hyperswitch-checkout.php:964
+msgid "Something went wrong. Please try again or reload the page."
+msgstr ""
+
+#. translators: Webhook received log message
+#: includes/hyperswitch-webhook.php:71
+msgid "WC_WEBHOOK_RECEIVED"
+msgstr ""
+
+#: includes/hyperswitch-webhook.php:85
+msgid "failed"
+msgstr ""
+
+#: includes/hyperswitch-webhook.php:88 includes/hyperswitch-webhook.php:155
+msgid "processing"
+msgstr ""
+
+#: includes/hyperswitch-webhook.php:91
+msgid "action required"
+msgstr ""
+
+#. translators: Order placed log message
+#: includes/hyperswitch-webhook.php:115
+msgid "WC_ORDER_PLACED"
+msgstr ""
+
+#. translators: 1: Payment method 2: Payment ID
+#: includes/hyperswitch-webhook.php:124
+msgid ""
+"Payment successful via %1$s (Hyperswitch Payment ID: %2$s) (via Hyperswitch "
+"Webhook)"
+msgstr ""
+
+#. translators: Payment succeeded webhook log message
+#: includes/hyperswitch-webhook.php:135
+msgid "WC_PAYMENT_SUCCEEDED_WEBHOOK"
+msgstr ""
+
+#: includes/hyperswitch-webhook.php:158
+msgid "pending"
+msgstr ""
+
+#. translators: 1: Payment status 2: Payment method 3: Payment ID
+#: includes/hyperswitch-webhook.php:163
+msgid ""
+"Payment %1$s via %2$s (Hyperswitch Payment ID: %3$s) (via Hyperswitch "
+"Webhook)"
+msgstr ""
+
+#. translators: %s: Refund ID
+#: includes/hyperswitch-webhook.php:216
+msgid ""
+"Refund Successful (Hyperswitch Refund ID: %1$s) (via Hyperswitch Webhook)"
+msgstr ""
diff --git a/locale/languages/en_US/hyperswitch-en_US.mo b/locale/languages/en_US/hyperswitch-en_US.mo
new file mode 100644
index 0000000..d447e2c
Binary files /dev/null and b/locale/languages/en_US/hyperswitch-en_US.mo differ
diff --git a/locale/languages/en_US/hyperswitch-en_US.po b/locale/languages/en_US/hyperswitch-en_US.po
new file mode 100644
index 0000000..c745d20
--- /dev/null
+++ b/locale/languages/en_US/hyperswitch-en_US.po
@@ -0,0 +1,357 @@
+# Copyright (C) 2024 Hyperswitch
+# This file is distributed under the GPLv2 or later.
+msgid ""
+msgstr ""
+"Project-Id-Version: Hyperswitch Checkout for WooCommerce 1.6.2\n"
+"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/hyperswitch-"
+"woocommerce-plugin\n"
+"POT-Creation-Date: 2024-10-06T12:46:48+05:30\n"
+"PO-Revision-Date: 2024-10-05 22:37+0530\n"
+"Last-Translator: \n"
+"Language-Team: English\n"
+"Language: en_US\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: WP-CLI 2.11.0\n"
+"X-Domain: hyperswitch\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. Plugin Name of the plugin
+#: hyperswitch-checkout.php
+msgid "Hyperswitch Checkout for WooCommerce"
+msgstr "Hyperswitch Checkout for WooCommerce"
+
+#. Plugin URI of the plugin
+#. Author URI of the plugin
+#: hyperswitch-checkout.php
+msgid "https://hyperswitch.io/"
+msgstr "https://hyperswitch.io/"
+
+#. Description of the plugin
+#: hyperswitch-checkout.php
+msgid "Hyperswitch checkout plugin for WooCommerce"
+msgstr "Hyperswitch checkout plugin for WooCommerce"
+
+#. Author of the plugin
+#: hyperswitch-checkout.php
+msgid "Hyperswitch"
+msgstr "Hyperswitch"
+
+#: hyperswitch-checkout.php:60
+msgid "Allow customers to securely pay via Hyperswitch"
+msgstr ""
+
+#: hyperswitch-checkout.php:134
+msgid "Settings"
+msgstr ""
+
+#: hyperswitch-checkout.php:237
+msgid "Capture Payment with Hyperswitch"
+msgstr ""
+
+#: hyperswitch-checkout.php:241
+msgid "Sync Payment with Hyperswitch"
+msgstr ""
+
+#. translators: %s: payment ID
+#: hyperswitch-checkout.php:286
+#, fuzzy
+msgid "Synced Payment Status (Hyperswitch Payment ID: %s)"
+msgstr ""
+"Payment %1$s via %2$s (Hyperswitch Payment ID: %3$s) (via Hyperswitch "
+"Webhook)"
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:297 hyperswitch-checkout.php:876
+#, fuzzy
+msgid "Payment successful via %1$s (Hyperswitch Payment ID: %2$s)"
+msgstr ""
+"Payment successful via %1$s (Hyperswitch Payment ID: %2$s) (via Hyperswitch "
+"Webhook)"
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:306 hyperswitch-checkout.php:894
+#, fuzzy
+msgid "Payment processing via %1$s (Hyperswitch Payment ID: %2$s)"
+msgstr ""
+"Payment successful via %1$s (Hyperswitch Payment ID: %2$s) (via Hyperswitch "
+"Webhook)"
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:313
+#, fuzzy
+msgid "Payment failed via %1$s (Hyperswitch Payment ID: %2$s)"
+msgstr ""
+"Payment successful via %1$s (Hyperswitch Payment ID: %2$s) (via Hyperswitch "
+"Webhook)"
+
+#: hyperswitch-checkout.php:326
+msgid "Enable/Disable"
+msgstr ""
+
+#: hyperswitch-checkout.php:327
+#, fuzzy
+msgid "Enable Hyperswitch"
+msgstr "Hyperswitch"
+
+#: hyperswitch-checkout.php:333
+msgid "Title"
+msgstr ""
+
+#: hyperswitch-checkout.php:335
+msgid ""
+"The title to be displayed for Hyperswitch Payment Method (in case of "
+"multiple WooCommerce Payment Gateways/ Methods)"
+msgstr ""
+
+#: hyperswitch-checkout.php:336
+msgid "Credit, Debit Card and Wallet Payments (powered by Hyperswitch)"
+msgstr ""
+
+#: hyperswitch-checkout.php:339
+msgid "Environment"
+msgstr ""
+
+#: hyperswitch-checkout.php:340
+msgid "Select Environment"
+msgstr ""
+
+#: hyperswitch-checkout.php:343
+msgid "Production"
+msgstr ""
+
+#: hyperswitch-checkout.php:344
+msgid "Sandbox"
+msgstr ""
+
+#: hyperswitch-checkout.php:349
+msgid "Api Key"
+msgstr ""
+
+#: hyperswitch-checkout.php:351 hyperswitch-checkout.php:356
+#: hyperswitch-checkout.php:361
+msgid "Find this on Developers > API Keys section of Hyperswitch Dashboard"
+msgstr ""
+
+#: hyperswitch-checkout.php:354
+msgid "Publishable key"
+msgstr ""
+
+#: hyperswitch-checkout.php:359
+msgid "Payment Response Hash Key"
+msgstr ""
+
+#: hyperswitch-checkout.php:364
+msgid "Business Profile ID"
+msgstr ""
+
+#: hyperswitch-checkout.php:366
+msgid ""
+"Find this on Settings > Business profiles section of Hyperswitch Dashboard"
+msgstr ""
+
+#: hyperswitch-checkout.php:369
+msgid "Enable Webhook"
+msgstr ""
+
+#. translators: %s: webhook URL
+#: hyperswitch-checkout.php:373
+msgid ""
+"Allow webhooks from Hyperswitch to receive real time updates of payments to "
+"update orders.
%s
Use this URL to be entered "
+"as Webhook URL on Hyperswitch dashboard"
+msgstr ""
+
+#: hyperswitch-checkout.php:376
+msgid "Enable Hyperswitch Webhook"
+msgstr ""
+
+#: hyperswitch-checkout.php:380
+msgid "Capture Method"
+msgstr ""
+
+#: hyperswitch-checkout.php:381
+msgid "Select Capture Method"
+msgstr ""
+
+#: hyperswitch-checkout.php:383
+msgid "Specify whether you want to capture payments manually or automatically"
+msgstr ""
+
+#: hyperswitch-checkout.php:385
+msgid "Automatic"
+msgstr ""
+
+#: hyperswitch-checkout.php:386
+msgid "Manual"
+msgstr ""
+
+#: hyperswitch-checkout.php:391 hyperswitch-checkout.php:394
+msgid "Enable Saved Payment Methods"
+msgstr ""
+
+#: hyperswitch-checkout.php:393
+msgid "Allow registered customers to pay via saved payment methods"
+msgstr ""
+
+#: hyperswitch-checkout.php:398
+msgid "Show Card Form Always"
+msgstr ""
+
+#: hyperswitch-checkout.php:400
+msgid "Show Card Form before Payment Methods List has loaded"
+msgstr ""
+
+#: hyperswitch-checkout.php:404
+msgid "Appearance"
+msgstr ""
+
+#: hyperswitch-checkout.php:407
+msgid ""
+"Use the above parameter to pass appearance config (in json format) to the "
+"checkout."
+msgstr ""
+
+#: hyperswitch-checkout.php:410
+msgid "Layout"
+msgstr ""
+
+#: hyperswitch-checkout.php:411
+msgid "Select Layout"
+msgstr ""
+
+#: hyperswitch-checkout.php:413
+msgid "Choose a layout that fits well with your UI pattern."
+msgstr ""
+
+#: hyperswitch-checkout.php:415
+msgid "Tabs"
+msgstr ""
+
+#: hyperswitch-checkout.php:416
+msgid "Accordion"
+msgstr ""
+
+#: hyperswitch-checkout.php:417
+msgid "Spaced Accordion"
+msgstr ""
+
+#: hyperswitch-checkout.php:422
+msgid "Hold Order on Processing Payments"
+msgstr ""
+
+#: hyperswitch-checkout.php:424
+msgid ""
+"Disable this only if you do not want to reduce stock levels until the "
+"payment is successful."
+msgstr ""
+
+#: hyperswitch-checkout.php:425
+msgid ""
+"Whether to hold order, reduce stock if a payment goes into processing status."
+msgstr ""
+
+#: hyperswitch-checkout.php:452 hyperswitch-checkout.php:492
+msgid "Unable to Create Hyperswitch Payment Intent."
+msgstr ""
+
+#: hyperswitch-checkout.php:456 hyperswitch-checkout.php:459
+#: hyperswitch-checkout.php:496 hyperswitch-checkout.php:499
+msgid "Something went wrong. Please contact support for assistance."
+msgstr ""
+
+#: hyperswitch-checkout.php:713
+msgid "Customer created via Woocommerce Application"
+msgstr ""
+
+#: hyperswitch-checkout.php:862
+msgid ""
+"Thank you for shopping with us. However, the transaction has been declined."
+msgstr ""
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:887
+#, fuzzy
+msgid ""
+"Payment authorized via %1$s (Hyperswitch Payment ID: %2$s). Note: Requires "
+"Capture"
+msgstr ""
+"Payment successful via %1$s (Hyperswitch Payment ID: %2$s) (via Hyperswitch "
+"Webhook)"
+
+#. translators: %1$s: payment method, %2$s: payment ID, %3$s: error message
+#: hyperswitch-checkout.php:908
+#, fuzzy
+msgid ""
+"Payment failed via %1$s (Hyperswitch Payment ID: %2$s) with error message: "
+"%3$s"
+msgstr ""
+"Payment successful via %1$s (Hyperswitch Payment ID: %2$s) (via Hyperswitch "
+"Webhook)"
+
+#: hyperswitch-checkout.php:915
+msgid ""
+"Thank you for shopping with us. However, the payment has failed. Please "
+"retry the payment."
+msgstr ""
+
+#: hyperswitch-checkout.php:964
+msgid "Something went wrong. Please try again or reload the page."
+msgstr ""
+
+#. translators: Webhook received log message
+#: includes/hyperswitch-webhook.php:71
+msgid "WC_WEBHOOK_RECEIVED"
+msgstr "WC_WEBHOOK_RECEIVED"
+
+#: includes/hyperswitch-webhook.php:85
+msgid "failed"
+msgstr "failed"
+
+#: includes/hyperswitch-webhook.php:88 includes/hyperswitch-webhook.php:155
+msgid "processing"
+msgstr "processing"
+
+#: includes/hyperswitch-webhook.php:91
+msgid "action required"
+msgstr "action required"
+
+#. translators: Order placed log message
+#: includes/hyperswitch-webhook.php:115
+msgid "WC_ORDER_PLACED"
+msgstr "WC_ORDER_PLACED"
+
+#. translators: 1: Payment method 2: Payment ID
+#: includes/hyperswitch-webhook.php:124
+msgid ""
+"Payment successful via %1$s (Hyperswitch Payment ID: %2$s) (via Hyperswitch "
+"Webhook)"
+msgstr ""
+"Payment successful via %1$s (Hyperswitch Payment ID: %2$s) (via Hyperswitch "
+"Webhook)"
+
+#. translators: Payment succeeded webhook log message
+#: includes/hyperswitch-webhook.php:135
+msgid "WC_PAYMENT_SUCCEEDED_WEBHOOK"
+msgstr "WC_PAYMENT_SUCCEEDED_WEBHOOK"
+
+#: includes/hyperswitch-webhook.php:158
+msgid "pending"
+msgstr "pending"
+
+#. translators: 1: Payment status 2: Payment method 3: Payment ID
+#: includes/hyperswitch-webhook.php:163
+msgid ""
+"Payment %1$s via %2$s (Hyperswitch Payment ID: %3$s) (via Hyperswitch "
+"Webhook)"
+msgstr ""
+"Payment %1$s via %2$s (Hyperswitch Payment ID: %3$s) (via Hyperswitch "
+"Webhook)"
+
+#. translators: %s: Refund ID
+#: includes/hyperswitch-webhook.php:216
+msgid ""
+"Refund Successful (Hyperswitch Refund ID: %1$s) (via Hyperswitch Webhook)"
+msgstr ""
+"Refund Successful (Hyperswitch Refund ID: %1$s) (via Hyperswitch Webhook)"
diff --git a/locale/languages/es_ES/hyperswitch-es_ES.mo b/locale/languages/es_ES/hyperswitch-es_ES.mo
new file mode 100644
index 0000000..f355bdd
Binary files /dev/null and b/locale/languages/es_ES/hyperswitch-es_ES.mo differ
diff --git a/locale/languages/es_ES/hyperswitch-es_ES.po b/locale/languages/es_ES/hyperswitch-es_ES.po
new file mode 100644
index 0000000..8fd91bd
--- /dev/null
+++ b/locale/languages/es_ES/hyperswitch-es_ES.po
@@ -0,0 +1,358 @@
+# Copyright (C) 2024 Hyperswitch
+# This file is distributed under the GPLv2 or later.
+msgid ""
+msgstr ""
+"Project-Id-Version: Hyperswitch Checkout for WooCommerce 1.6.2\n"
+"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/hyperswitch-"
+"woocommerce-plugin\n"
+"POT-Creation-Date: 2024-10-06T12:46:48+05:30\n"
+"PO-Revision-Date: 2024-10-05 22:42+0530\n"
+"Last-Translator: \n"
+"Language-Team: Spanish \n"
+"Language: es\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: WP-CLI 2.11.0\n"
+"X-Domain: hyperswitch\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. Plugin Name of the plugin
+#: hyperswitch-checkout.php
+msgid "Hyperswitch Checkout for WooCommerce"
+msgstr "Pago Hyperswitch para WooCommerce"
+
+#. Plugin URI of the plugin
+#. Author URI of the plugin
+#: hyperswitch-checkout.php
+msgid "https://hyperswitch.io/"
+msgstr "https://hyperswitch.io/"
+
+#. Description of the plugin
+#: hyperswitch-checkout.php
+msgid "Hyperswitch checkout plugin for WooCommerce"
+msgstr "Plugin de pago Hyperswitch para WooCommerce"
+
+#. Author of the plugin
+#: hyperswitch-checkout.php
+msgid "Hyperswitch"
+msgstr "Hyperswitch"
+
+#: hyperswitch-checkout.php:60
+msgid "Allow customers to securely pay via Hyperswitch"
+msgstr ""
+
+#: hyperswitch-checkout.php:134
+msgid "Settings"
+msgstr ""
+
+#: hyperswitch-checkout.php:237
+msgid "Capture Payment with Hyperswitch"
+msgstr ""
+
+#: hyperswitch-checkout.php:241
+msgid "Sync Payment with Hyperswitch"
+msgstr ""
+
+#. translators: %s: payment ID
+#: hyperswitch-checkout.php:286
+#, fuzzy
+msgid "Synced Payment Status (Hyperswitch Payment ID: %s)"
+msgstr ""
+"Pago %1$s a través de %2$s (ID de pago Hyperswitch: %3$s) (a través del "
+"Webhook de Hyperswitch)"
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:297 hyperswitch-checkout.php:876
+#, fuzzy
+msgid "Payment successful via %1$s (Hyperswitch Payment ID: %2$s)"
+msgstr ""
+"Pago exitoso a través de %1$s (ID de pago Hyperswitch: %2$s) (a través del "
+"Webhook de Hyperswitch)"
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:306 hyperswitch-checkout.php:894
+#, fuzzy
+msgid "Payment processing via %1$s (Hyperswitch Payment ID: %2$s)"
+msgstr ""
+"Pago exitoso a través de %1$s (ID de pago Hyperswitch: %2$s) (a través del "
+"Webhook de Hyperswitch)"
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:313
+#, fuzzy
+msgid "Payment failed via %1$s (Hyperswitch Payment ID: %2$s)"
+msgstr ""
+"Pago exitoso a través de %1$s (ID de pago Hyperswitch: %2$s) (a través del "
+"Webhook de Hyperswitch)"
+
+#: hyperswitch-checkout.php:326
+msgid "Enable/Disable"
+msgstr ""
+
+#: hyperswitch-checkout.php:327
+#, fuzzy
+msgid "Enable Hyperswitch"
+msgstr "Hyperswitch"
+
+#: hyperswitch-checkout.php:333
+msgid "Title"
+msgstr ""
+
+#: hyperswitch-checkout.php:335
+msgid ""
+"The title to be displayed for Hyperswitch Payment Method (in case of "
+"multiple WooCommerce Payment Gateways/ Methods)"
+msgstr ""
+
+#: hyperswitch-checkout.php:336
+msgid "Credit, Debit Card and Wallet Payments (powered by Hyperswitch)"
+msgstr ""
+
+#: hyperswitch-checkout.php:339
+msgid "Environment"
+msgstr ""
+
+#: hyperswitch-checkout.php:340
+msgid "Select Environment"
+msgstr ""
+
+#: hyperswitch-checkout.php:343
+msgid "Production"
+msgstr ""
+
+#: hyperswitch-checkout.php:344
+msgid "Sandbox"
+msgstr ""
+
+#: hyperswitch-checkout.php:349
+msgid "Api Key"
+msgstr ""
+
+#: hyperswitch-checkout.php:351 hyperswitch-checkout.php:356
+#: hyperswitch-checkout.php:361
+msgid "Find this on Developers > API Keys section of Hyperswitch Dashboard"
+msgstr ""
+
+#: hyperswitch-checkout.php:354
+msgid "Publishable key"
+msgstr ""
+
+#: hyperswitch-checkout.php:359
+msgid "Payment Response Hash Key"
+msgstr ""
+
+#: hyperswitch-checkout.php:364
+msgid "Business Profile ID"
+msgstr ""
+
+#: hyperswitch-checkout.php:366
+msgid ""
+"Find this on Settings > Business profiles section of Hyperswitch Dashboard"
+msgstr ""
+
+#: hyperswitch-checkout.php:369
+msgid "Enable Webhook"
+msgstr ""
+
+#. translators: %s: webhook URL
+#: hyperswitch-checkout.php:373
+msgid ""
+"Allow webhooks from Hyperswitch to receive real time updates of payments to "
+"update orders.
%s
Use this URL to be entered "
+"as Webhook URL on Hyperswitch dashboard"
+msgstr ""
+
+#: hyperswitch-checkout.php:376
+msgid "Enable Hyperswitch Webhook"
+msgstr ""
+
+#: hyperswitch-checkout.php:380
+msgid "Capture Method"
+msgstr ""
+
+#: hyperswitch-checkout.php:381
+msgid "Select Capture Method"
+msgstr ""
+
+#: hyperswitch-checkout.php:383
+msgid "Specify whether you want to capture payments manually or automatically"
+msgstr ""
+
+#: hyperswitch-checkout.php:385
+msgid "Automatic"
+msgstr ""
+
+#: hyperswitch-checkout.php:386
+msgid "Manual"
+msgstr ""
+
+#: hyperswitch-checkout.php:391 hyperswitch-checkout.php:394
+msgid "Enable Saved Payment Methods"
+msgstr ""
+
+#: hyperswitch-checkout.php:393
+msgid "Allow registered customers to pay via saved payment methods"
+msgstr ""
+
+#: hyperswitch-checkout.php:398
+msgid "Show Card Form Always"
+msgstr ""
+
+#: hyperswitch-checkout.php:400
+msgid "Show Card Form before Payment Methods List has loaded"
+msgstr ""
+
+#: hyperswitch-checkout.php:404
+msgid "Appearance"
+msgstr ""
+
+#: hyperswitch-checkout.php:407
+msgid ""
+"Use the above parameter to pass appearance config (in json format) to the "
+"checkout."
+msgstr ""
+
+#: hyperswitch-checkout.php:410
+msgid "Layout"
+msgstr ""
+
+#: hyperswitch-checkout.php:411
+msgid "Select Layout"
+msgstr ""
+
+#: hyperswitch-checkout.php:413
+msgid "Choose a layout that fits well with your UI pattern."
+msgstr ""
+
+#: hyperswitch-checkout.php:415
+msgid "Tabs"
+msgstr ""
+
+#: hyperswitch-checkout.php:416
+msgid "Accordion"
+msgstr ""
+
+#: hyperswitch-checkout.php:417
+msgid "Spaced Accordion"
+msgstr ""
+
+#: hyperswitch-checkout.php:422
+msgid "Hold Order on Processing Payments"
+msgstr ""
+
+#: hyperswitch-checkout.php:424
+msgid ""
+"Disable this only if you do not want to reduce stock levels until the "
+"payment is successful."
+msgstr ""
+
+#: hyperswitch-checkout.php:425
+msgid ""
+"Whether to hold order, reduce stock if a payment goes into processing status."
+msgstr ""
+
+#: hyperswitch-checkout.php:452 hyperswitch-checkout.php:492
+msgid "Unable to Create Hyperswitch Payment Intent."
+msgstr ""
+
+#: hyperswitch-checkout.php:456 hyperswitch-checkout.php:459
+#: hyperswitch-checkout.php:496 hyperswitch-checkout.php:499
+msgid "Something went wrong. Please contact support for assistance."
+msgstr ""
+
+#: hyperswitch-checkout.php:713
+msgid "Customer created via Woocommerce Application"
+msgstr ""
+
+#: hyperswitch-checkout.php:862
+msgid ""
+"Thank you for shopping with us. However, the transaction has been declined."
+msgstr ""
+
+#. translators: %1$s: payment method, %2$s: payment ID
+#: hyperswitch-checkout.php:887
+#, fuzzy
+msgid ""
+"Payment authorized via %1$s (Hyperswitch Payment ID: %2$s). Note: Requires "
+"Capture"
+msgstr ""
+"Pago exitoso a través de %1$s (ID de pago Hyperswitch: %2$s) (a través del "
+"Webhook de Hyperswitch)"
+
+#. translators: %1$s: payment method, %2$s: payment ID, %3$s: error message
+#: hyperswitch-checkout.php:908
+#, fuzzy
+msgid ""
+"Payment failed via %1$s (Hyperswitch Payment ID: %2$s) with error message: "
+"%3$s"
+msgstr ""
+"Pago exitoso a través de %1$s (ID de pago Hyperswitch: %2$s) (a través del "
+"Webhook de Hyperswitch)"
+
+#: hyperswitch-checkout.php:915
+msgid ""
+"Thank you for shopping with us. However, the payment has failed. Please "
+"retry the payment."
+msgstr ""
+
+#: hyperswitch-checkout.php:964
+msgid "Something went wrong. Please try again or reload the page."
+msgstr ""
+
+#. translators: Webhook received log message
+#: includes/hyperswitch-webhook.php:71
+msgid "WC_WEBHOOK_RECEIVED"
+msgstr "WC_WEBHOOK_RECIBIDO"
+
+#: includes/hyperswitch-webhook.php:85
+msgid "failed"
+msgstr "fallido"
+
+#: includes/hyperswitch-webhook.php:88 includes/hyperswitch-webhook.php:155
+msgid "processing"
+msgstr "procesando"
+
+#: includes/hyperswitch-webhook.php:91
+msgid "action required"
+msgstr "acción requerida"
+
+#. translators: Order placed log message
+#: includes/hyperswitch-webhook.php:115
+msgid "WC_ORDER_PLACED"
+msgstr "WC_ORDEN_REALIZADA"
+
+#. translators: 1: Payment method 2: Payment ID
+#: includes/hyperswitch-webhook.php:124
+msgid ""
+"Payment successful via %1$s (Hyperswitch Payment ID: %2$s) (via Hyperswitch "
+"Webhook)"
+msgstr ""
+"Pago exitoso a través de %1$s (ID de pago Hyperswitch: %2$s) (a través del "
+"Webhook de Hyperswitch)"
+
+#. translators: Payment succeeded webhook log message
+#: includes/hyperswitch-webhook.php:135
+msgid "WC_PAYMENT_SUCCEEDED_WEBHOOK"
+msgstr "WC_PAGO_EXITOSO_WEBHOOK"
+
+#: includes/hyperswitch-webhook.php:158
+msgid "pending"
+msgstr "pendiente"
+
+#. translators: 1: Payment status 2: Payment method 3: Payment ID
+#: includes/hyperswitch-webhook.php:163
+msgid ""
+"Payment %1$s via %2$s (Hyperswitch Payment ID: %3$s) (via Hyperswitch "
+"Webhook)"
+msgstr ""
+"Pago %1$s a través de %2$s (ID de pago Hyperswitch: %3$s) (a través del "
+"Webhook de Hyperswitch)"
+
+#. translators: %s: Refund ID
+#: includes/hyperswitch-webhook.php:216
+msgid ""
+"Refund Successful (Hyperswitch Refund ID: %1$s) (via Hyperswitch Webhook)"
+msgstr ""
+"Reembolso exitoso (ID de reembolso Hyperswitch: %1$s) (a través del Webhook "
+"de Hyperswitch)"