Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe Configuration Removed & Settings Refactored #1179

Merged
merged 7 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/staging-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Staging Build and Deploy
on:
push:
branches:
- dev
- ecommerce-backend
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -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: |
Expand Down Expand Up @@ -56,4 +67,4 @@ jobs:
ssh [email protected] << '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
EOF
4 changes: 0 additions & 4 deletions ecommerce/Ecommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
96 changes: 0 additions & 96 deletions ecommerce/PaymentGateways/Configs/StripeConfig.php

This file was deleted.

35 changes: 9 additions & 26 deletions ecommerce/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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
*/
Expand All @@ -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 ) {

Expand All @@ -446,7 +447,6 @@ public static function add_payment_gateway_settings( $settings ): array {
'label_title' => '',
'default' => 'off',
/* translators: %s: gateway name */
'desc' => sprintf( __( 'Enable %s payment', 'tutor' ), $gateway['label'] ),
'toggle_fields' => implode( ',', array_keys( self::$config_keys_method() ) ),
),
);
Expand All @@ -457,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 );
Expand All @@ -467,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(
Expand All @@ -477,20 +477,20 @@ 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(
'block_type' => 'action_placeholder',
'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;
}
Expand Down Expand Up @@ -595,23 +595,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
*
Expand Down
Loading