From 25fd6b2346e97c2528c97c61342dea01d6d8bbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Wed, 14 Jul 2021 13:05:29 +0200 Subject: [PATCH] Replace whitespace within input fields: wepay-credit-card.js --- .../js/clients/payments/wepay-credit-card.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/resources/js/clients/payments/wepay-credit-card.js b/resources/js/clients/payments/wepay-credit-card.js index 39829c888bf9..09a10fb483be 100644 --- a/resources/js/clients/payments/wepay-credit-card.js +++ b/resources/js/clients/payments/wepay-credit-card.js @@ -33,25 +33,25 @@ class WePayCreditCard { this.errors.hidden = false; return; - } else if (this.myCard.CardJs('cardNumber') === "") { + } else if (this.myCard.CardJs('cardNumber').replace(/[^\d]/g, '') === "") { document.getElementById('card_number').focus(); this.errors.textContent = "Card number required."; this.errors.hidden = false; return; - } else if (this.myCard.CardJs('cvc') === "") { + } else if (this.myCard.CardJs('cvc').replace(/[^\d]/g, '') === "") { document.getElementById('cvv').focus(); this.errors.textContent = "CVV number required."; this.errors.hidden = false; return; - } else if (this.myCard.CardJs('expiryMonth') === "") { + } else if (this.myCard.CardJs('expiryMonth').replace(/[^\d]/g, '') === "") { // document.getElementById('expiry_month').focus(); this.errors.textContent = "Expiry Month number required."; this.errors.hidden = false; return; - } else if (this.myCard.CardJs('expiryYear') === "") { + } else if (this.myCard.CardJs('expiryYear').replace(/[^\d]/g, '') === "") { // document.getElementById('expiry_year').focus(); this.errors.textContent = "Expiry Year number required."; this.errors.hidden = false; @@ -77,10 +77,10 @@ class WePayCreditCard { client_id: document.querySelector('meta[name=wepay-client-id]').content, user_name: document.getElementById('cardholder_name').value, email: document.querySelector('meta[name=contact-email]').content, - cc_number: this.myCard.CardJs('cardNumber'), - cvv: this.myCard.CardJs('cvc'), - expiration_month: this.myCard.CardJs('expiryMonth'), - expiration_year: this.myCard.CardJs('expiryYear'), + cc_number: this.myCard.CardJs('cardNumber').replace(/[^\d]/g, ''), + cvv: this.myCard.CardJs('cvc').replace(/[^\d]/g, ''), + expiration_month: this.myCard.CardJs('expiryMonth').replace(/[^\d]/g, ''), + expiration_year: this.myCard.CardJs('expiryYear').replace(/[^\d]/g, ''), address: { postal_code: document.querySelector(['meta[name=client-postal-code']).content, } @@ -116,10 +116,10 @@ class WePayCreditCard { client_id: document.querySelector('meta[name=wepay-client-id]').content, user_name: document.getElementById('cardholder_name').value, email: document.querySelector('meta[name=contact-email]').content, - cc_number: this.myCard.CardJs('cardNumber'), - cvv: this.myCard.CardJs('cvc'), - expiration_month: this.myCard.CardJs('expiryMonth'), - expiration_year: this.myCard.CardJs('expiryYear'), + cc_number: this.myCard.CardJs('cardNumber').replace(/[^\d]/g, ''), + cvv: this.myCard.CardJs('cvc').replace(/[^\d]/g, ''), + expiration_month: this.myCard.CardJs('expiryMonth').replace(/[^\d]/g, ''), + expiration_year: this.myCard.CardJs('expiryYear').replace(/[^\d]/g, ''), address: { postal_code: document.querySelector(['meta[name=client-postal-code']).content, }