From fdbd0df172c589022100a716bf1163ed6d5966ff Mon Sep 17 00:00:00 2001 From: shewa12 Date: Tue, 1 Oct 2024 12:12:21 +0600 Subject: [PATCH 1/5] Workflow updated for authenticating --- .github/workflows/staging-build-and-deploy.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/staging-build-and-deploy.yml b/.github/workflows/staging-build-and-deploy.yml index 0512586eac..29b5cd7239 100644 --- a/.github/workflows/staging-build-and-deploy.yml +++ b/.github/workflows/staging-build-and-deploy.yml @@ -23,6 +23,17 @@ jobs: - name: Install Composer run: sudo apt-get update && sudo apt-get install -y composer + - name: Install Composer Dependencies in Paypal Directory + run: composer install --no-dev --working-dir=./ecommerce/PaymentGateways/Paypal + + - name: Clone tutor-droip repository + run: | + if [ ! -d "tutor-droip" ]; then + git clone https://github.com/jshossen/tutor-droip.git tutor-droip + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Extract version number id: get_version run: | @@ -56,4 +67,4 @@ jobs: ssh shewa@45.79.123.135 << 'EOF' rm -rf /var/www/html/subdomains/tutor-lms/wp-content/plugins/tutor unzip -o /var/www/html/subdomains/tutor-lms/wp-content/plugins/tutor-${{ env.VERSION_NUMBER }}.zip -d /var/www/html/subdomains/tutor-lms/wp-content/plugins - EOF \ No newline at end of file + EOF From 3eb38b0abe80a604831caf1204786ca988a440ae Mon Sep 17 00:00:00 2001 From: shewa12 Date: Tue, 1 Oct 2024 12:12:48 +0600 Subject: [PATCH 2/5] Run workflow on push ecommerce-backend --- .github/workflows/staging-build-and-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/staging-build-and-deploy.yml b/.github/workflows/staging-build-and-deploy.yml index 29b5cd7239..c20a770035 100644 --- a/.github/workflows/staging-build-and-deploy.yml +++ b/.github/workflows/staging-build-and-deploy.yml @@ -3,7 +3,7 @@ name: Staging Build and Deploy on: push: branches: - - dev + - ecommerce-backend jobs: build: runs-on: ubuntu-latest From a30a49d7f2ae4f236e1b2493012bf89c6af68d53 Mon Sep 17 00:00:00 2001 From: shewa12 Date: Wed, 2 Oct 2024 15:12:04 +0600 Subject: [PATCH 3/5] Payment Method: Payment method enable desc removed, stripe config keys removed --- ecommerce/Settings.php | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/ecommerce/Settings.php b/ecommerce/Settings.php index e424cb20b4..bf158f551f 100644 --- a/ecommerce/Settings.php +++ b/ecommerce/Settings.php @@ -452,7 +452,6 @@ public static function add_payment_gateway_settings( $settings ): array { 'label' => $gateway['label'], 'label_title' => '', 'default' => 'off', - 'desc' => sprintf( __( 'Enable %s payment', 'tutor-pro' ), $gateway['label'] ), 'toggle_fields' => implode( ',', array_keys( self::$config_keys_method() ) ), ), ); @@ -600,23 +599,6 @@ public static function get_paypal_config_keys() { ); } - /** - * Get stripe config keys - * - * @since 3.0.0 - * - * @return array - */ - public static function get_stripe_config_keys() { - return array( - 'stripe_environment' => 'environment', - 'stripe_secret_key' => 'password', - 'stripe_public_key' => 'password', - 'stripe_webhook_signature_key' => 'password', - 'stripe_webhook_url' => 'webhook_url', - ); - } - /** * Get payment environments * From 4bc2d9fc829f4e123f71e5e4d01fc1cfa61cd693 Mon Sep 17 00:00:00 2001 From: shewa12 Date: Wed, 2 Oct 2024 17:15:16 +0600 Subject: [PATCH 4/5] Stripe config file removed --- ecommerce/Ecommerce.php | 4 - .../PaymentGateways/Configs/StripeConfig.php | 96 ------------------- 2 files changed, 100 deletions(-) delete mode 100644 ecommerce/PaymentGateways/Configs/StripeConfig.php diff --git a/ecommerce/Ecommerce.php b/ecommerce/Ecommerce.php index 28af3025de..28ab6e64e4 100644 --- a/ecommerce/Ecommerce.php +++ b/ecommerce/Ecommerce.php @@ -152,10 +152,6 @@ public static function get_payment_gateway_object( string $gateway ) { */ public static function payment_gateways_with_ref( $gateway = null ) { $arr = array( - 'stripe' => array( - 'gateway_class' => StripeGateway::class, - 'config_class' => StripeConfig::class, - ), 'paypal' => array( 'gateway_class' => PaypalGateway::class, 'config_class' => PaypalConfig::class, diff --git a/ecommerce/PaymentGateways/Configs/StripeConfig.php b/ecommerce/PaymentGateways/Configs/StripeConfig.php deleted file mode 100644 index 2f622794c4..0000000000 --- a/ecommerce/PaymentGateways/Configs/StripeConfig.php +++ /dev/null @@ -1,96 +0,0 @@ -get_option( self::ENV_KEY, 'test' ); - } - - /** - * Retrieves the secret key for the Stripe payment gateway. - * - * @since 3.0.0 - * - * @return string The secret key. - */ - public function getSecretKey(): string { - return tutor_utils()->get_option( self::SECRET_KEY ); - } - - /** - * Retrieves the public key for the Stripe payment gateway. - * - * @since 3.0.0 - * - * @return string The public key. - */ - public function getPublicKey(): string { - return tutor_utils()->get_option( self::PUBLIC_KEY ); - } - - /** - * Retrieves the webhook key for the Stripe payment gateway. - * - * @since 3.0.0 - * - * @return string The public key. - */ - public function getWebhookSecretKey(): string { - return tutor_utils()->get_option( self::WEBHOOK_SIGNATURE_KEY ); - } - -} From 9d2678ac7113f98c604ea3f9a5f7d43fd4f9cb93 Mon Sep 17 00:00:00 2001 From: shewa12 Date: Wed, 2 Oct 2024 17:45:23 +0600 Subject: [PATCH 5/5] Refactor ecommerce payment settings filter --- ecommerce/Settings.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ecommerce/Settings.php b/ecommerce/Settings.php index 9093b3883b..33ff6a8db7 100644 --- a/ecommerce/Settings.php +++ b/ecommerce/Settings.php @@ -208,9 +208,10 @@ public static function add_ecommerce_settings( $fields ) { ), ); + $arr = apply_filters( 'tutor_after_ecommerce_settings', $arr ); $fields['monetization']['submenu'] = $arr; - return apply_filters( 'tutor_after_ecommerce_settings', $fields ); + return $fields; } /** @@ -414,7 +415,7 @@ function( $method ) use ( $method_id ) { * * @since 3.0.0 * - * @param array $settings Tutor settings. + * @param array $settings Ecommerce payment settings. * * @return array */ @@ -426,7 +427,7 @@ public static function add_payment_gateway_settings( $settings ): array { 'fields' => array(), ); - array_push( $settings['monetization']['submenu']['ecommerce_payment']['blocks'], $payment_gateway ); + array_push( $settings['ecommerce_payment']['blocks'], $payment_gateway ); foreach ( self::get_default_automate_payment_gateways() as $key => $gateway ) { @@ -456,7 +457,7 @@ public static function add_payment_gateway_settings( $settings ): array { $new_gateway['fields'] = $fields; // Append new gateways inside ecommerce payment. - $settings['monetization']['submenu']['ecommerce_payment']['blocks'][] = $new_gateway; + $settings['ecommerce_payment']['blocks'][] = $new_gateway; } $settings = apply_filters( 'tutor_ecommerce_payment_settings', $settings ); @@ -466,7 +467,7 @@ public static function add_payment_gateway_settings( $settings ): array { 'action' => 'add_more_automate_payment_gateway', ); - array_push( $settings['monetization']['submenu']['ecommerce_payment']['blocks'], $add_more_gateway ); + array_push( $settings['ecommerce_payment']['blocks'], $add_more_gateway ); // Manual Payments. $manual_gateways = array( @@ -476,12 +477,12 @@ public static function add_payment_gateway_settings( $settings ): array { 'fields' => array(), ); - array_push( $settings['monetization']['submenu']['ecommerce_payment']['blocks'], $manual_gateways ); + array_push( $settings['ecommerce_payment']['blocks'], $manual_gateways ); $manual_gateways = self::get_manual_payment_setting_fields(); foreach ( $manual_gateways as $gateway ) { - array_push( $settings['monetization']['submenu']['ecommerce_payment']['blocks'], $gateway ); + array_push( $settings['ecommerce_payment']['blocks'], $gateway ); } $add_btn = array( @@ -489,7 +490,7 @@ public static function add_payment_gateway_settings( $settings ): array { 'action' => 'add_manual_payment_btn', ); - array_push( $settings['monetization']['submenu']['ecommerce_payment']['blocks'], $add_btn ); + array_push( $settings['ecommerce_payment']['blocks'], $add_btn ); return $settings; }