Skip to content
Draft
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
11 changes: 8 additions & 3 deletions stripe/helpers/FrmStrpLiteConnectHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,19 @@ private static function set_stripe_details_as_submitted( $mode ) {
* @return void
*/
private static function handle_oauth() {
$redirect_url = self::get_oauth_redirect_url();
if ( is_array( $redirect_url ) ) {
wp_send_json_error( $redirect_url['error'] );
}

$response_data = array(
'redirect_url' => self::get_oauth_redirect_url(),
'redirect_url' => $redirect_url,
);
wp_send_json_success( $response_data );
}

/**
* @return string|false
* @return array|string|false
*/
private static function get_oauth_redirect_url() {
$mode = self::get_mode_value_from_post();
Expand All @@ -437,7 +442,7 @@ private static function get_oauth_redirect_url() {
$data = self::post_to_connect_server( 'oauth_request', $additional_body );

if ( is_string( $data ) ) {
return false;
return array( 'error' => $data );
}

if ( ! empty( $data->password ) ) {
Expand Down
14 changes: 10 additions & 4 deletions stripe/js/connect_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,24 @@
renderStripeConnectSettingsButton();
}
},
isTriggerInTestMode( trigger )
isTriggerInTestMode( trigger ),
function( data ) {
alert( data );
renderStripeConnectSettingsButton();
}
);
}

function strpSettingsAjaxRequest( action, success, testMode ) {
function strpSettingsAjaxRequest( action, success, testMode, error ) {
var data = {
action: action,
testMode: testMode,
nonce: frmGlobal.nonce
};
postAjax( data, success );
postAjax( data, success, error );
}

function postAjax( data, success ) {
function postAjax( data, success, error ) {
var xmlHttp, params;

xmlHttp = new XMLHttpRequest();
Expand All @@ -103,6 +107,8 @@
response.data = {};
}
success( response.data );
} else if ( 'function' === typeof error ) {
error( response.data );
}
}
}
Expand Down