mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
Prevent sending checkout form by pressing enter key and triggers customer lookup
This commit is contained in:
parent
84c9d549d0
commit
7f3daf1d46
1 changed files with 13 additions and 0 deletions
|
@ -6,6 +6,7 @@ import BillingView from "./Views/BillingView";
|
||||||
import CardView from "./Views/CardView";
|
import CardView from "./Views/CardView";
|
||||||
import PayPalInsights from "./Insights/PayPalInsights";
|
import PayPalInsights from "./Insights/PayPalInsights";
|
||||||
import {disable,enable} from "../../../ppcp-button/resources/js/modules/Helper/ButtonDisabler";
|
import {disable,enable} from "../../../ppcp-button/resources/js/modules/Helper/ButtonDisabler";
|
||||||
|
import {getCurrentPaymentMethod} from "../../../ppcp-button/resources/js/modules/Helper/CheckoutMethodState";
|
||||||
|
|
||||||
class AxoManager {
|
class AxoManager {
|
||||||
|
|
||||||
|
@ -154,6 +155,14 @@ class AxoManager {
|
||||||
this.cardView.refresh();
|
this.cardView.refresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Prevents sending checkout form when pressing Enter key on input field
|
||||||
|
// and triggers customer lookup
|
||||||
|
this.$('form.woocommerce-checkout input').on('keydown', async (ev) => {
|
||||||
|
if(ev.key === 'Enter' && getCurrentPaymentMethod() === 'ppcp-axo-gateway' ) {
|
||||||
|
ev.preventDefault();
|
||||||
|
await this.lookupCustomerByEmail();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
rerender() {
|
rerender() {
|
||||||
|
@ -520,6 +529,10 @@ class AxoManager {
|
||||||
page_type: 'checkout'
|
page_type: 'checkout'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await this.lookupCustomerByEmail();
|
||||||
|
}
|
||||||
|
|
||||||
|
async lookupCustomerByEmail() {
|
||||||
const lookupResponse = await this.fastlane.identity.lookupCustomerByEmail(this.emailInput.value);
|
const lookupResponse = await this.fastlane.identity.lookupCustomerByEmail(this.emailInput.value);
|
||||||
|
|
||||||
if (lookupResponse.customerContextId) {
|
if (lookupResponse.customerContextId) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue