Skip to content

Commit

Permalink
Comply to WP plugin guide line
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperstrongBE committed Dec 16, 2024
1 parent 1a973a1 commit 11ddb32
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 77 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/buildzip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: 'xprcheckout_gateway.zip'
filename: 'xprcheckout_webauth_gateway.zip'
directory: '.'
exclusions: '*.git* /*node_modules/* .editorconfig /*applications/*'
- name: Generate JSON manifest
Expand All @@ -37,5 +37,5 @@ jobs:
uses: ncipollo/[email protected]
with:
tag: '${{ github.ref_name }}'
artifacts: "xprcheckout_gateway.zip,info.json"
artifacts: "xprcheckout_webauth_gateway.zip,info.json"
token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
=== XPRCheckout - WebAuth Gateway for Woocommerce ===
=== XPRCheckout - WebAuth Gateway for e-commerce ===
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.0
Stable tag: ##VERSION_TAG##
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

# XPRCheckout - WebAuth Gateway for Woocommerce
*A WebAuth-Enabled Gateway for WooCommerce*
# XPRCheckout - WebAuth Gateway for e-commerce
*A WebAuth-Enabled Gateway for e-commerce*

## The basic scope

Expand Down
4 changes: 2 additions & 2 deletions includes/api/admin-refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function xprcheckout_register_payments_with_orders_routes()
function admin_only_permission_check($request) {

if (!is_user_logged_in()) {
return new WP_Error('rest_forbidden', __('You must be logged in to access this endpoint.','xprcheckout_gateway'), ['status' => 403]);
return new WP_Error('rest_forbidden', __('You must be logged in to access this endpoint.','xprcheckout_webauth_gateway'), ['status' => 403]);
}

// Get the current user
Expand All @@ -37,7 +37,7 @@ function admin_only_permission_check($request) {
return true;
}

return new WP_Error('rest_forbidden', __('You do not have permission to access this endpoint.','xprcheckout_gateway'), ['status' => 403]);
return new WP_Error('rest_forbidden', __('You do not have permission to access this endpoint.','xprcheckout_webauth_gateway'), ['status' => 403]);
}


Expand Down
4 changes: 2 additions & 2 deletions includes/api/admin-save-wallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function xprcheckout_register_save_wallet_config_routes()
function admin_only_save_wallet_permission_check($request) {

if (!is_user_logged_in()) {
return new WP_Error('rest_forbidden', __('You must be logged in to access this endpoint.','xprcheckout_gateway'), ['status' => 403]);
return new WP_Error('rest_forbidden', __('You must be logged in to access this endpoint.','xprcheckout_webauth_gateway'), ['status' => 403]);
}

// Get the current user
Expand All @@ -60,7 +60,7 @@ function admin_only_save_wallet_permission_check($request) {
return true;
}

return new WP_Error('rest_forbidden', __('You do not have permission to access this endpoint.','xprcheckout_gateway'), ['status' => 403]);
return new WP_Error('rest_forbidden', __('You do not have permission to access this endpoint.','xprcheckout_webauth_gateway'), ['status' => 403]);
}


Expand Down
6 changes: 3 additions & 3 deletions includes/controllers/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public function mutateOrdersColumnsHeader($columns)
foreach ($columns as $column_name => $column_info) {
$new_columns[$column_name] = $column_info;
if ('order_status' === $column_name) {
$new_columns['transactionId'] = __('Transaction', 'xprcheckout_gateway'); // title
$new_columns['network'] = __('Mainnet/testnet', 'xprcheckout_gateway'); // title
$new_columns['paid_token'] = __('Received tokens', 'xprcheckout_gateway'); // title
$new_columns['transactionId'] = __('Transaction', 'xprcheckout_webauth_gateway'); // title
$new_columns['network'] = __('Mainnet/testnet', 'xprcheckout_webauth_gateway'); // title
$new_columns['paid_token'] = __('Received tokens', 'xprcheckout_webauth_gateway'); // title
}
}
return $new_columns;
Expand Down
4 changes: 2 additions & 2 deletions includes/controllers/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function registerMetabox()
{
add_meta_box(
'woocommerce-xprcheckout-payment',
__('XPRCheckout payment', 'xprcheckout_gateway'),
__('XPRCheckout payment', 'xprcheckout_webauth_gateway'),
[$this, 'renderMetabox'],
'woocommerce_page_wc-orders',
'advanced',
Expand All @@ -78,7 +78,7 @@ public function registerMetabox()
);
add_meta_box(
'woocommerce-xprcheckout-payment',
__('XPRCheckout payment', 'xprcheckout_gateway'),
__('XPRCheckout payment', 'xprcheckout_webauth_gateway'),
[$this, 'renderMetabox'],
'shop_order',
'advanced',
Expand Down
50 changes: 25 additions & 25 deletions includes/controllers/i18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,47 +45,47 @@ private function registerActions()
*/
function initTextDomain()
{
load_plugin_textdomain('xprcheckout_gateway');
load_plugin_textdomain('xprcheckout_webauth_gateway');
}

/**
* Retrieves public-facing translated strings.
*
* Provides an array of translated strings that are likely to be used in public-facing interfaces
* related to the xprcheckout_gateway payment gateway. Uses the plugin's text domain for translations.
* related to the xprcheckout_webauth_gateway payment gateway. Uses the plugin's text domain for translations.
*
* @return array Associative array of public-facing translated strings.
*/
public static function getPublicTranslations()
{

return [
"payInviteTitle" => __('Pay with WebAuth', 'xprcheckout_gateway'),
"payInviteText" => __('Connect your WebAuth wallet to start the payment flow.', 'xprcheckout_gateway'),
"payInviteButtonLabel" => __('Connect WebAuth', 'xprcheckout_gateway'),
"orderStatusTitle" => __("Payment succesfull", 'xprcheckout_gateway'),
"orderStatusText" => __("This order is marked as complete", 'xprcheckout_gateway'),
"selectTokenDialogTitle" => __("Select token", 'xprcheckout_gateway'),
"selectTokenDialogText" => __("Select the token you want to pay with.", 'xprcheckout_gateway'),
"selectTokenDialogConnectedAs" => __("Connected as", 'xprcheckout_gateway'),
"selectTokenDialogChangeAccountLabel" => __("change account ?", 'xprcheckout_gateway'),
"selectTokenPayButtonLabel" => __("Pay", 'xprcheckout_gateway'),
"selectTokenPayProcessingLabel" => __("Fetching tokens rates", 'xprcheckout_gateway'),
"payInviteTitle" => __('Pay with WebAuth', 'xprcheckout_webauth_gateway'),
"payInviteText" => __('Connect your WebAuth wallet to start the payment flow.', 'xprcheckout_webauth_gateway'),
"payInviteButtonLabel" => __('Connect WebAuth', 'xprcheckout_webauth_gateway'),
"orderStatusTitle" => __("Payment succesfull", 'xprcheckout_webauth_gateway'),
"orderStatusText" => __("This order is marked as complete", 'xprcheckout_webauth_gateway'),
"selectTokenDialogTitle" => __("Select token", 'xprcheckout_webauth_gateway'),
"selectTokenDialogText" => __("Select the token you want to pay with.", 'xprcheckout_webauth_gateway'),
"selectTokenDialogConnectedAs" => __("Connected as", 'xprcheckout_webauth_gateway'),
"selectTokenDialogChangeAccountLabel" => __("change account ?", 'xprcheckout_webauth_gateway'),
"selectTokenPayButtonLabel" => __("Pay", 'xprcheckout_webauth_gateway'),
"selectTokenPayProcessingLabel" => __("Fetching tokens rates", 'xprcheckout_webauth_gateway'),

"paymentProcessingLabel" => __("Waiting for transaction to complete", 'xprcheckout_gateway'),
"paymentFailureDialogTitle" => __("Something wrong with your transfer.", 'xprcheckout_gateway'),
"paymentFailureDialogText" => __("The transfer fail. The issue came from the chain side, but do not worry, no tokens have been transferred. Please retry or save your order to pay it later.", 'xprcheckout_gateway'),
"paymentProcessingLabel" => __("Waiting for transaction to complete", 'xprcheckout_webauth_gateway'),
"paymentFailureDialogTitle" => __("Something wrong with your transfer.", 'xprcheckout_webauth_gateway'),
"paymentFailureDialogText" => __("The transfer fail. The issue came from the chain side, but do not worry, no tokens have been transferred. Please retry or save your order to pay it later.", 'xprcheckout_webauth_gateway'),

"invalidOrderDialogTitle" => __("No order found.", 'xprcheckout_gateway'),
"invalidOrderDialogText" => __("Not order has been found at the given url. ", 'xprcheckout_gateway'),
"invalidOrderDialogTitle" => __("No order found.", 'xprcheckout_webauth_gateway'),
"invalidOrderDialogText" => __("Not order has been found at the given url. ", 'xprcheckout_webauth_gateway'),

"verifyPaymentDialogTitle" => __("Payment verification", 'xprcheckout_gateway'),
"verifyPaymentDialogText" => __("Please wait while we check payment information.", 'xprcheckout_gateway'),
"verifyPaymentDialogProcessLabel" => __("Verifying payment", 'xprcheckout_gateway'),
"verifySuccessPaymentDialogTitle" => __("Payment verified", 'xprcheckout_gateway'),
"verifySuccessPaymentDialogText" => __("Great, your payment has be verified, order is now completed! ", 'xprcheckout_gateway'),
"verifyFailurePaymentDialogTitle" => __("Payment verification failed", 'xprcheckout_gateway'),
"verifyFailurePaymentDialogText" => __("Your payment could'nt been verified , order is pending! ", 'xprcheckout_gateway'),
"verifyPaymentDialogTitle" => __("Payment verification", 'xprcheckout_webauth_gateway'),
"verifyPaymentDialogText" => __("Please wait while we check payment information.", 'xprcheckout_webauth_gateway'),
"verifyPaymentDialogProcessLabel" => __("Verifying payment", 'xprcheckout_webauth_gateway'),
"verifySuccessPaymentDialogTitle" => __("Payment verified", 'xprcheckout_webauth_gateway'),
"verifySuccessPaymentDialogText" => __("Great, your payment has be verified, order is now completed! ", 'xprcheckout_webauth_gateway'),
"verifyFailurePaymentDialogTitle" => __("Payment verification failed", 'xprcheckout_webauth_gateway'),
"verifyFailurePaymentDialogText" => __("Your payment could'nt been verified , order is pending! ", 'xprcheckout_webauth_gateway'),
];
}
}
54 changes: 27 additions & 27 deletions includes/woocommerce/gateway/xprcheckout-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ protected function setup_properties()
{
$this->id = 'xprcheckout';
$this->icon = apply_filters('woocommerce_cod_icon', '');
$this->title = __('XPR Checkout', 'xprcheckout_gateway');
$this->method_title = __('XPR Checkout', 'xprcheckout_gateway');
$this->method_description = __('Provides a Webauth wallet Payment Gateway for your customer.', 'xprcheckout_gateway');
$this->title = __('XPR Checkout', 'xprcheckout_webauth_gateway');
$this->method_title = __('XPR Checkout', 'xprcheckout_webauth_gateway');
$this->method_description = __('Provides a Webauth wallet Payment Gateway for your customer.', 'xprcheckout_webauth_gateway');
$this->has_fields = false;
}

Expand All @@ -53,75 +53,75 @@ public function init_form_fields()
{
$this->form_fields = array(
'enabled' => array(
'title' => __('Enable/Disable', 'xprcheckout_gateway'),
'title' => __('Enable/Disable', 'xprcheckout_webauth_gateway'),
'type' => 'checkbox',
'label' => __('Enable Webauth Payment', 'xprcheckout_gateway'),
'label' => __('Enable Webauth Payment', 'xprcheckout_webauth_gateway'),
'default' => 'yes'
),
'network' => array(
'title' => __('Select network', 'xprcheckout_gateway'),
'title' => __('Select network', 'xprcheckout_webauth_gateway'),
'type' => 'select',
'options' => [
'mainnet' => 'Mainnet',
'testnet' => 'Testnet',
],
'label' => __('Select network', 'xprcheckout_gateway'),
'label' => __('Select network', 'xprcheckout_webauth_gateway'),
'default' => 'testnet',
'value'
),
'registered' => array(
'title' => __('Register store ', 'xprcheckout_gateway'),
'title' => __('Register store ', 'xprcheckout_webauth_gateway'),
'type' => 'xprcheckout_register',
'description' => __('Register you store nearby the smart contract', 'xprcheckout_gateway'),
'description' => __('Register you store nearby the smart contract', 'xprcheckout_webauth_gateway'),
'desc_tip' => true,
),
'title' => array(
'title' => __('Title', 'xprcheckout_gateway'),
'title' => __('Title', 'xprcheckout_webauth_gateway'),
'type' => 'text',
'default' => 'Pay with WebAuth',
'description' => __('This controls the title which the user sees during checkout.', 'xprcheckout_gateway'),
'description' => __('This controls the title which the user sees during checkout.', 'xprcheckout_webauth_gateway'),
'desc_tip' => true,
),
'description' => array(
'title' => __('Description', 'xprcheckout_gateway'),
'title' => __('Description', 'xprcheckout_webauth_gateway'),
'type' => 'textarea',
'description' => __('This controls the title which the user sees during checkout.', 'xprcheckout_gateway'),
'default' => __('Pay securely with with multiple crypto currencies through WebAuth with zero gas fee', 'xprcheckout_gateway'),
'description' => __('This controls the title which the user sees during checkout.', 'xprcheckout_webauth_gateway'),
'default' => __('Pay securely with with multiple crypto currencies through WebAuth with zero gas fee', 'xprcheckout_webauth_gateway'),
'desc_tip' => true,
),

'wallet' => array(
'title' => __('Mainnet account', 'xprcheckout_gateway'),
'title' => __('Mainnet account', 'xprcheckout_webauth_gateway'),
'type' => 'hidden',
'description' => __('Set the destination account on mainnet where pay token will be paid. <b>Used only when "Use testnet" option is disabled</b>', 'xprcheckout_gateway'),
'description' => __('Set the destination account on mainnet where pay token will be paid. <b>Used only when "Use testnet" option is disabled</b>', 'xprcheckout_webauth_gateway'),
'desc_tip' => true,
),

'appName' => array(
'title' => __('dApp Name', 'xprcheckout_gateway'),
'title' => __('dApp Name', 'xprcheckout_webauth_gateway'),
'type' => 'text',
'description' => __('The application name displayed in the webauth modal', 'xprcheckout_gateway'),
'default' => __('My awesome store', 'xprcheckout_gateway'),
'description' => __('The application name displayed in the webauth modal', 'xprcheckout_webauth_gateway'),
'default' => __('My awesome store', 'xprcheckout_webauth_gateway'),
'desc_tip' => true,
),
/*'appLogo' => array(
'title' => __('dApp Logo', 'xprcheckout_gateway'),
'title' => __('dApp Logo', 'xprcheckout_webauth_gateway'),
'type' => 'text',
'description' => __('The application logo displayed in the webauth modal', 'xprcheckout_gateway'),
'description' => __('The application logo displayed in the webauth modal', 'xprcheckout_webauth_gateway'),
'desc_tip' => true,
),*/
'allowedTokens' => array(
'title' => __('Allowed Tokens', 'xprcheckout_gateway'),
'title' => __('Allowed Tokens', 'xprcheckout_webauth_gateway'),
'type' => 'text',
'description' => __('Accepted tokens as payment for transfer, will be displayed in the payments process flow. Specify a uppercase only, coma separated, tokens list', 'xprcheckout_gateway'),
'default' => __('XPR,XUSDC', 'xprcheckout_gateway'),
'description' => __('Accepted tokens as payment for transfer, will be displayed in the payments process flow. Specify a uppercase only, coma separated, tokens list', 'xprcheckout_webauth_gateway'),
'default' => __('XPR,XUSDC', 'xprcheckout_webauth_gateway'),
'desc_tip' => true,
),
'currencyApi' => array(
'title' => __('Free api key ', 'xprcheckout_gateway'),
'title' => __('Free api key ', 'xprcheckout_webauth_gateway'),
'type' => 'text',
'description' => __('We provide limited one. You can register yours for free <a target="_blank" style="text-decoration:underline" href="https://app.freecurrencyapi.com/register">here</a>.', 'xprcheckout_gateway'),
'description' => __('We provide limited one. You can register yours for free <a target="_blank" style="text-decoration:underline" href="https://app.freecurrencyapi.com/register">here</a>.', 'xprcheckout_webauth_gateway'),
'desc_tip' => false,
),
);
Expand Down Expand Up @@ -337,7 +337,7 @@ public function generate_hidden_html($key, $data)

function xprcheckout_redirect_on_new_order($order) {

if(WC()->session->chosen_payment_method == 'xprcheckout_gateway'){
if(WC()->session->chosen_payment_method == 'xprcheckout_webauth_gateway'){
$this->xprcheckout_redirect_to_payment_page();

}
Expand Down
22 changes: 11 additions & 11 deletions xprcheckout.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

/*
* Plugin Name: XPRCheckout - WebAuth Gateway for Woocommerce
* Description: Allow user to pay securly with with multiple crypto currencies through Webauth
* Author: Rémy Chauveau AKA Rockerone
* Author URI: https://rockerone.io
* Plugin Name: XPRCheckout - WebAuth Gateway for e-commerce
* Description: Allow user to pay securely with with multiple crypto currencies through WebAuth
* Author: Metallicus Team
* Author URI: https://www.metallicus.com/
* Version: ##VERSION_TAG##
* slug: xprcheckout_gateway
* Text Domain: xprcheckout_gateway
* slug: xprcheckout-webauth-gateway
* Text Domain: xprcheckout_webauth_gateway
* Domain Path: /i18n/languages/
* License: GPLv2 or later
*/
Expand Down Expand Up @@ -83,7 +83,7 @@ function run_proton_wc_gateway()
function sample_admin_notice_success() {
?>
<div class="notice notice-error">
<p><b><?php esc_html_e( 'XPRCheckout - Webauth Gateway for Woocommerce require WooCommerce to work!', 'xprcheckout_gateway' ); ?></b></p>
<p><b><?php esc_html_e( 'XPRCheckout - Webauth Gateway for Woocommerce require WooCommerce to work!', 'xprcheckout_webauth_gateway' ); ?></b></p>
<a href="/wp-admin/plugin-install.php?s=woo&tab=search&type=term">Install Woocommerce </a>
<p></p>
</div>
Expand Down Expand Up @@ -163,13 +163,13 @@ function xprcheckout_redirect_to_payment (){

}
add_action( 'template_redirect', 'xprcheckout_redirect_to_payment' );
add_action( 'woocommerce_blocks_loaded', 'xprcheckout_gateway_block_support');
function xprcheckout_gateway_block_support(){
add_action( 'woocommerce_blocks_loaded', 'xprcheckout_webauth_gateway_block_support');
function xprcheckout_webauth_gateway_block_support(){
require_once XPRCHECKOUT_ROOT_DIR . 'includes/supports/block-support.php';
}

add_action( 'woocommerce_blocks_payment_method_type_registration', 'xprcheckout_gateway_block_method_type_registration');
function xprcheckout_gateway_block_method_type_registration ($payment_method_registry){
add_action( 'woocommerce_blocks_payment_method_type_registration', 'xprcheckout_webauth_gateway_block_method_type_registration');
function xprcheckout_webauth_gateway_block_method_type_registration ($payment_method_registry){
$payment_method_registry->register( new WC_XPRCheckoutBlocksSupport() );
}

Expand Down

0 comments on commit 11ddb32

Please sign in to comment.