diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ee591e06e..33333bded2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Releases +### [5.0.16] + +#### Added + - NEW + +#### Fixed + - [PPC. Fix onboarding validation (#1085)](https://github.com/eventespresso/cafe/pull/1085) + - [ES. Fix onboarding in Live mode (#1087)](https://github.com/eventespresso/cafe/pull/1087) + - [Fix text wrapping in the event editor (#1078)](https://github.com/eventespresso/cafe/pull/1078) + - FIX + +#### Changed + - [Mod/core/bm changes 5 0 15 (#1075)](https://github.com/eventespresso/cafe/pull/1075) + - MOD + +#### Deprecated + - DEP + +#### Removed + - RMV + +#### Security + - SEC + + + ### [5.0.15] #### Fixed diff --git a/PaymentMethods/PayPalCommerce/api/partners/TrackSellerOnboarding.php b/PaymentMethods/PayPalCommerce/api/partners/TrackSellerOnboarding.php index 60a633ae94..c59d9cba64 100644 --- a/PaymentMethods/PayPalCommerce/api/partners/TrackSellerOnboarding.php +++ b/PaymentMethods/PayPalCommerce/api/partners/TrackSellerOnboarding.php @@ -85,6 +85,7 @@ public function validateStatus(array $response): array empty($response[ Domain::API_PARAM_TRACK_MERCHANT_ID ]) || ! isset($response[ Domain::API_PARAM_PAYMENTS_RECEIVABLE ]) || ! isset($response[ Domain::API_PARAM_PRIM_EMAIL_CONFIRMED ]) + || ! isset($response[ Domain::API_PARAM_OAUTH_INTEGRATIONS ]) ) { $err_msg = esc_html__('Missing required data for validating the onboarding status.', 'event_espresso'); PayPalLogger::errorLog($err_msg, $response); @@ -104,6 +105,24 @@ public function validateStatus(array $response): array PayPalLogger::errorLog($err_msg, $response); return ['error' => 'ONBOARDING_CONFIRM_EMAIL', 'message' => $err_msg]; } + if (empty($response[ Domain::API_PARAM_OAUTH_INTEGRATIONS ])) { + $permissions_valid = false; + // Look for the granted permissions. + foreach ($response[ Domain::API_PARAM_OAUTH_INTEGRATIONS ] as $integration_type) { + if (! empty($integration_type[ Domain::API_PARAM_PERMISSIONS_GRANTED ])) { + $permissions_valid = true; + } + } + // Did we find any ? If no - oauth not valid. + if (! $permissions_valid) { + $err_msg = esc_html__( + 'Not all required permissions were granted. Please allow all permissions while onboarding.', + 'event_espresso' + ); + PayPalLogger::errorLog($err_msg, $response); + return ['error' => 'ONBOARDING_PERMISSIONS_NOT_GRANTED', 'message' => $err_msg]; + } + } return [ 'valid' => true, 'response' => $response, diff --git a/PaymentMethods/PayPalCommerce/assets/js/eea-paypal-onboarding.js b/PaymentMethods/PayPalCommerce/assets/js/eea-paypal-onboarding.js index 0c27d13e79..5c889982e2 100644 --- a/PaymentMethods/PayPalCommerce/assets/js/eea-paypal-onboarding.js +++ b/PaymentMethods/PayPalCommerce/assets/js/eea-paypal-onboarding.js @@ -352,13 +352,13 @@ jQuery(document).ready(function ($) { }, success: function (response) { ppc_onboarding_processing = false; - const is_valid = this_pm.checkForErrors(response, request_action === 'eeaPpGetOnboardingUrl'); + const is_valid = this_pm.checkForErrors(this_pm, response, request_action === 'eeaPpGetOnboardingUrl'); if (is_valid && typeof callback !== 'undefined' && callback) { // Run the callback if there are no errors. callback(this_pm, response); } if (update_ui) { - this_pm.updateOnboardingUI(false); + this_pm.updateOnboardingUI(this_pm, false); } }, error: function (jqXHR, details, error) { @@ -434,22 +434,23 @@ jQuery(document).ready(function ($) { /** * Check for errors in the response. + * @param this_pm * @param response * @param close_window * @return {boolean} */ - this.checkForErrors = function (response, close_window) { + this.checkForErrors = function (this_pm, response, close_window) { if (response === null || response.error) { if (close_window) { - this.onboard_window.close(); + this_pm.onboard_window.close(); } let error = eeaPPOnboardParameters.request_error; if (response !== null && response.message) { error = response.message; } console.error(error); - this.showAlert(error); - this.processing_icon.fadeOut('fast'); + this_pm.showAlert(error); + this_pm.processing_icon.fadeOut('fast'); return false; } return true; @@ -460,17 +461,16 @@ jQuery(document).ready(function ($) { * Updates the UI to show if we've managed to get onboard. * @function */ - this.updateOnboardingUI = function (check_status) { + this.updateOnboardingUI = function (this_pm, check_status) { window.do_before_admin_page_ajax(); let request_data = { action: 'eeaPpGetOnboardStatus', - payment_method: this.slug, - sandbox_mode: this.sandbox_mode + payment_method: this_pm.slug, + sandbox_mode: this_pm.sandbox_mode }; if (check_status) { request_data.check_status = check_status; } - const this_pm = this; $.ajax({ type: 'POST', url: eei18n.ajax_url, diff --git a/PaymentMethods/PayPalCommerce/domain/Domain.php b/PaymentMethods/PayPalCommerce/domain/Domain.php index f2755ef6e8..2ac1955034 100644 --- a/PaymentMethods/PayPalCommerce/domain/Domain.php +++ b/PaymentMethods/PayPalCommerce/domain/Domain.php @@ -120,9 +120,14 @@ class Domain public const API_KEY_EXPIRES_IN = 'expires_in'; /** - * Name of the PayPal API parameter that holds the bool of if permissions were granted. + * Name of the PayPal API parameter that holds the list of oAuth integrations related to the merchant. */ - public const API_PARAM_PERMISSIONS_GRANTED = 'permissionsGranted'; + public const API_PARAM_OAUTH_INTEGRATIONS = 'oauth_integrations'; + + /** + * Name of the PayPal API parameter that holds the list of third party permissions that were granted. + */ + public const API_PARAM_PERMISSIONS_GRANTED = 'oauth_third_party'; /** * Name of the PayPal API parameter that holds the bool of if the primary email was confirmed. diff --git a/PaymentMethods/PayPalCommerce/modules/EED_PayPalOnboard.module.php b/PaymentMethods/PayPalCommerce/modules/EED_PayPalOnboard.module.php index 36521c1017..1047e6a693 100644 --- a/PaymentMethods/PayPalCommerce/modules/EED_PayPalOnboard.module.php +++ b/PaymentMethods/PayPalCommerce/modules/EED_PayPalOnboard.module.php @@ -227,7 +227,7 @@ public static function getReturnUrl(EE_Payment_Method $paypal_pm): string return add_query_arg( [ 'page' => 'espresso_payment_settings', - 'webhook_action' => 'eea_pp_commerce_merchant_onboard', + 'webhook_action' => 'eepPpcMerchantOnboard', 'payment_method' => $paypal_pm->slug(), '_wpnonce' => $wp_nonce, 'nonce' => $nonce, @@ -275,7 +275,7 @@ public static function updateOnboardingStatus(): void { // Check if this is the webhook from PayPal. if (! isset($_GET['webhook_action'], $_GET['nonce']) - || $_GET['webhook_action'] !== 'eea_pp_commerce_merchant_onboard' + || $_GET['webhook_action'] !== 'eepPpcMerchantOnboard' ) { return; // Ignore. } @@ -293,16 +293,6 @@ public static function updateOnboardingStatus(): void EED_PayPalOnboard::redirectToPmSettingsHome(); return; } - // Were the requested permissions granted ? - if (empty($get_params[ Domain::API_PARAM_PERMISSIONS_GRANTED ])) { - $error_message = esc_html__( - 'Permissions not granted by merchant or email not confirmed.', - 'event_espresso' - ); - PayPalLogger::errorLog($error_message, $get_params, $paypal_pm); - EED_PayPalOnboard::redirectToPmSettingsHome(); - return; - } // Check on the onboarding status (recommended by PP). $onboarding_status = EED_PayPalOnboard::trackSellerOnboarding( $paypal_pm, @@ -342,7 +332,6 @@ public static function onboardingStatusResponseValid(array $data, $paypal_pm): b && wp_verify_nonce($data['nonce'], Domain::NONCE_NAME_ONBOARDING_RETURN) && ! empty($data[ Domain::API_PARAM_PARTNER_ID ]) && ! empty($data[ Domain::META_KEY_SELLER_MERCHANT_ID ]) - && isset($data[ Domain::API_PARAM_PERMISSIONS_GRANTED ]) && isset($data[ Domain::API_PARAM_EMAIL_CONFIRMED ]) ) { return true; @@ -668,7 +657,7 @@ public static function reConnectNotice() $pm_page = add_query_arg( [ 'page' => 'espresso_payment_settings', - 'webhook_action' => 'eea_pp_commerce_merchant_onboard', + 'webhook_action' => 'eepPpcMerchantOnboard', 'payment_method' => $pp_commerce->slug(), ], admin_url('admin.php') diff --git a/core/admin/assets/ee-admin-page.css b/core/admin/assets/ee-admin-page.css index fb62686d70..0cebc64d41 100644 --- a/core/admin/assets/ee-admin-page.css +++ b/core/admin/assets/ee-admin-page.css @@ -4496,7 +4496,7 @@ body.espresso-admin #contextual-help-wrap strong { } .espresso-admin .wp-editor-container .wp-editor-area { - white-space: pre; + white-space: pre-wrap; } .espresso-admin.wp-core-ui:not(.event-espresso_page_espresso_messages) .tmce-active .quicktags-toolbar { diff --git a/espresso.php b/espresso.php index 97ed034392..5eab86b7c4 100644 --- a/espresso.php +++ b/espresso.php @@ -3,7 +3,7 @@ Plugin Name:Event Espresso Plugin URI: https://eventespresso.com/pricing/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=wordpress_plugins_page&utm_content=support_link Description: Manage events, sell tickets, and receive payments from your WordPress website. Reduce event administration time, cut-out ticketing fees, and own your customer data. | Extensions | Sales | Support - Version: 5.0.16.rc.000 + Version: 5.0.16.rc.004 Author: Event Espresso Author URI: http://eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=wordpress_plugins_page&utm_content=support_link License: GPLv3 @@ -104,7 +104,7 @@ function espresso_minimum_php_version_error() */ function espresso_version(): string { - return apply_filters('FHEE__espresso__espresso_version', '5.0.14.rc.005'); + return apply_filters('FHEE__espresso__espresso_version', '5.0.16.rc.004'); } /**