Skip to content
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
70 changes: 70 additions & 0 deletions assets/js/paypal-setup-wizard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// PayPal setup wizard — test connection step.
//
// Pings the wu_paypal_setup_wizard_test AJAX endpoint and renders the
// status with Vue. Triggered from views/wizards/paypal-setup/test.php.
//
// @since 2.6.0

(function($) {
$( document ).ready( function () {
if ( typeof wu_paypal_setup_wizard === 'undefined' ) {
return;
}

var data = wu_paypal_setup_wizard;

new Vue( {
el: '#wu-paypal-setup-wizard-test',
data: {
loading: true,
success: false,
webhookStatus: 'not_attempted',
errorMessage: data.error_message,
rawResponse: data.waiting_message,
},
mounted: function () {
this.runTest();
},
methods: {
runTest: function () {
var that = this;
this.loading = true;
this.success = false;
this.rawResponse = data.waiting_message;

$.ajax( {
url: data.ajax_url,
method: 'POST',
data: {
action: 'wu_paypal_setup_wizard_test',
nonce: data.nonce,
sandbox_mode: data.sandbox_mode,
},
success: function ( response ) {
that.loading = false;
that.rawResponse = JSON.stringify( response, null, 2 );

if ( response.success ) {
that.success = true;
that.webhookStatus = response.data.webhook_status || 'not_attempted';
} else {
that.success = false;
that.errorMessage =
( response.data && response.data.message ) ||
data.error_message;
}
},
error: function ( xhr ) {
that.loading = false;
that.success = false;
that.errorMessage = data.error_message;
that.rawResponse =
( xhr.responseText && xhr.responseText.slice( 0, 1000 ) ) ||
data.error_message;
},
} );
},
},
} );
} );
} )( jQuery );
1 change: 1 addition & 0 deletions assets/js/paypal-setup-wizard.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,23 @@
if ( ! defined('WU_EXTERNAL_CRON_ENABLED')) {
define('WU_EXTERNAL_CRON_ENABLED', false);
}

/**
* Feature flag: Enable PayPal OAuth ("Connect with PayPal") onboarding.
*
* When set to true, enables the PayPal Partner Referrals one-click onboarding
* flow. This requires an active PayPal Commerce Platform partner agreement —
* `/v2/customer/partner-referrals`, partner-token minting via the proxy, and
* `PayPal-Auth-Assertion` impersonation only work for approved partners.
*
* Defaults to false. Without partner status, merchants set up PayPal via the
* guided manual-credentials wizard (developer.paypal.com REST app). When
* Ultimate Multisite is approved as a PayPal partner again, define
* WU_PAYPAL_OAUTH_ENABLED as true in wp-config.php to re-enable the
* one-click flow.
*
* @since 2.6.0
*/
if ( ! defined('WU_PAYPAL_OAUTH_ENABLED')) {
define('WU_PAYPAL_OAUTH_ENABLED', false);
}
Loading
Loading