Skip to content

Commit

Permalink
Latest cafe changes 5.0.16.p
Browse files Browse the repository at this point in the history
  • Loading branch information
Pebblo committed Jan 29, 2024
1 parent 341b5a4 commit 0404eba
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 29 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand Down
20 changes: 10 additions & 10 deletions PaymentMethods/PayPalCommerce/assets/js/eea-paypal-onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down
9 changes: 7 additions & 2 deletions PaymentMethods/PayPalCommerce/domain/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 3 additions & 14 deletions PaymentMethods/PayPalCommerce/modules/EED_PayPalOnboard.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
}
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion core/admin/assets/ee-admin-page.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions espresso.php
Original file line number Diff line number Diff line change
Expand Up @@ -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. | <a href="https://eventespresso.com/add-ons/?utm_source=plugin_activation_screen&utm_medium=link&utm_campaign=plugin_description">Extensions</a> | <a href="https://eventespresso.com/pricing/?utm_source=plugin_activation_screen&utm_medium=link&utm_campaign=plugin_description">Sales</a> | <a href="admin.php?page=espresso_support">Support</a>
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
Expand Down Expand Up @@ -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');
}

/**
Expand Down

0 comments on commit 0404eba

Please sign in to comment.