mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Fix AXO Ryan flow submission.
This commit is contained in:
parent
80f8edb594
commit
0fd27144ae
2 changed files with 16 additions and 4 deletions
|
@ -82,7 +82,7 @@ class AxoManager {
|
|||
|
||||
registerEventHandlers() {
|
||||
|
||||
jQuery(document).on('change', 'input[name=payment_method]', (ev) => {
|
||||
this.$(document).on('change', 'input[name=payment_method]', (ev) => {
|
||||
const map = {
|
||||
'ppcp-axo-gateway': 'card',
|
||||
'ppcp-gateway': 'paypal',
|
||||
|
@ -598,7 +598,7 @@ class AxoManager {
|
|||
if (this.data.card) { // Ryan flow
|
||||
log('Ryan flow.');
|
||||
|
||||
jQuery('#ship-to-different-address-checkbox').prop('checked', 'checked');
|
||||
this.$('#ship-to-different-address-checkbox').prop('checked', 'checked');
|
||||
|
||||
let data = {};
|
||||
this.billingView.toSubmitData(data);
|
||||
|
@ -684,6 +684,18 @@ class AxoManager {
|
|||
})
|
||||
.then(response => response.json())
|
||||
.then(responseData => {
|
||||
if (responseData.result === 'failure') {
|
||||
if (responseData.messages) {
|
||||
const $notices = this.$('.woocommerce-notices-wrapper').eq(0);
|
||||
$notices.html(responseData.messages);
|
||||
this.$('html, body').animate({
|
||||
scrollTop: $notices.offset().top
|
||||
}, 500);
|
||||
}
|
||||
console.error('Failure:', responseData);
|
||||
enable(submitContainerSelector);
|
||||
return;
|
||||
}
|
||||
if (responseData.redirect) {
|
||||
window.location.href = responseData.redirect;
|
||||
}
|
||||
|
|
|
@ -95,8 +95,8 @@ class CardView {
|
|||
const name = this.group.dataValue('name');
|
||||
const { firstName, lastName } = this.splitName(name);
|
||||
|
||||
data['firstName'] = firstName;
|
||||
data['lastName'] = lastName;
|
||||
data['billing_first_name'] = firstName;
|
||||
data['billing_last_name'] = lastName ? lastName : firstName;
|
||||
|
||||
return this.group.toSubmitData(data);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue