From 1196c7cce92a8fd2e5bd10ec8241b427b824ebe3 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Tue, 17 Sep 2024 00:11:54 +0530 Subject: [PATCH] try rendering w/required resources --- includes/Framework/PaymentGateway/Payment_Gateway.php | 1 + includes/Gateway/Digital_Wallet.php | 3 ++- src/blocks/digital-wallets/index.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/Framework/PaymentGateway/Payment_Gateway.php b/includes/Framework/PaymentGateway/Payment_Gateway.php index f6a15cf6..8ba64c19 100644 --- a/includes/Framework/PaymentGateway/Payment_Gateway.php +++ b/includes/Framework/PaymentGateway/Payment_Gateway.php @@ -380,6 +380,7 @@ public function __construct( $id, $plugin, $args ) { // Enqueue the necessary scripts & styles add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); // <=-- <=-- // add API request logging $this->add_api_request_logging(); diff --git a/includes/Gateway/Digital_Wallet.php b/includes/Gateway/Digital_Wallet.php index 34306d3e..878cfeae 100644 --- a/includes/Gateway/Digital_Wallet.php +++ b/includes/Gateway/Digital_Wallet.php @@ -60,6 +60,7 @@ public function __construct( $gateway ) { if ( 'yes' === $gateway->get_option( 'enabled', 'no' ) && $this->is_digital_wallet_enabled() ) { add_action( 'wp', array( $this, 'init' ) ); + add_action( 'admin_init', array( $this, 'init' ) ); add_action( 'admin_notices', array( $this, 'admin_notices' ) ); } @@ -125,7 +126,7 @@ public function init() { add_action( 'before_woocommerce_pay', array( $this, 'render_button' ) ); } - $page = $this->get_current_page(); + $page = is_admin() ? 'checkout' : $this->get_current_page(); $payment_request = false; try { diff --git a/src/blocks/digital-wallets/index.js b/src/blocks/digital-wallets/index.js index 1ef382d5..899542e8 100644 --- a/src/blocks/digital-wallets/index.js +++ b/src/blocks/digital-wallets/index.js @@ -9,7 +9,7 @@ const squareDigitalWalletsMethod = { name: 'square-credit-card', paymentMethodId: 'square_credit_card', content: , - edit: , + edit: , canMakePayment: () => { const isSquareConnected = getSquareServerData().applicationId &&