send message when onboarding fails for some reason

This commit is contained in:
David Remer 2020-07-10 09:32:34 +03:00
parent 792fce5b3a
commit 50aadf2507
2 changed files with 12 additions and 1 deletions

View file

@ -9,5 +9,12 @@ function onboardingCallback(authCode, sharedId) {
sharedId: sharedId,
nonce: PayPalCommerceGatewayOnboarding.nonce
})
});
})
.then(response => response.json())
.then((data) => {
if (data.success) {
return;
}
alert(PayPalCommerceGatewayOnboarding.error)
});
}

View file

@ -46,6 +46,10 @@ class OnboardingAssets
[
'endpoint' => home_url(\WC_AJAX::get_endpoint(LoginSellerEndpoint::ENDPOINT)),
'nonce' => wp_create_nonce($this->loginSellerEndpoint::nonce()),
'error' => __(
'We could not properly onboard you. Please reload and try again.',
'woocommerce-paypal-commerce-gateway'
)
]
);