Skip to content

Commit

Permalink
MAG2-301 - Changed validation, added missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
FatchipRobert committed Mar 13, 2024
1 parent c70d039 commit 8d00d0a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions i18n/de_DE.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,8 @@
"Show IBAN/BIC fields","IBAN/BIC Felder anzeigen"

"You have to be at least 18 years old to use this payment type!","Sie müssen mindestens 18 Jahre alt sein um diese Zahlart nutzen zu können!"
"An error occured. Please check the supplied data.","Ein Fehler ist aufgetreten. Bitte überprüfen Sie Ihre Angaben."
"Please enter a valid birthdate.","Bitte geben Sie ein gültiges Geburtsdatum ein."

"I agree with the transmission of the necessary data to Unzer which is needed for processing the purchase, the identity-check and the credit rating.","Mit der Übermittlung der für die Abwicklung des Rechnungskaufes und einer Identitätsprüfung und Bonitätsprüfung erforderlicher Daten an Unzer bin ich einverstanden."
"I agree with the transmission of the necessary data to Klarna which is needed for processing the purchase, the identity-check and the credit rating.","Mit der Übermittlung der für die Abwicklung des Rechnungskaufes und einer Identitätsprüfung und Bonitätsprüfung erforderlicher Daten an Klarna bin ich einverstanden."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ define(
},
isCustomerTooOld: function () {
var oBirthDate = new Date(this.getBirthDate());
var oMinDate = new Date(new Date().setYear(new Date().getFullYear() - 126)); // max 125 years old
var oMinDate = new Date(new Date().setYear(new Date().getFullYear() - 125)); // max 125 years
if(oBirthDate > oMinDate) {
return false;
}
Expand All @@ -91,17 +91,29 @@ define(
}
return false;
},
isDateInvalid: function () {
if (!this.birthyear() || isNaN(this.birthyear()) || this.birthyear().length != 4) {
return true;
}
if (!this.birthmonth() || isNaN(this.birthmonth()) || parseInt(this.birthmonth()) < 1 || parseInt(this.birthmonth()) > 12) {
return true;
}
if (!this.birthday() || isNaN(this.birthday()) || parseInt(this.birthday()) < 1 || parseInt(this.birthday()) > 31) {
return true;
}
return false;
},
validate: function () {
if (!this.isB2bMode() && this.isDateInFuture()) {
this.messageContainer.addErrorMessage({'message': $t('Please enter a valid birthday.')});
if (!this.isB2bMode() && (this.isDateInvalid() || this.isDateInFuture())) {
this.messageContainer.addErrorMessage({'message': $t('Please enter a valid birthdate.')});
return false;
}
if (!this.isB2bMode() && this.isCustomerTooYoung()) {
this.messageContainer.addErrorMessage({'message': $t('You have to be at least 18 years old to use this payment type!')});
return false;
}
if (!this.isB2bMode() && this.isCustomerTooOld()) {
this.messageContainer.addErrorMessage({'message': $t('You can not be older than 125 years to use this payment type!')});
this.messageContainer.addErrorMessage({'message': $t('An error occured. Please check the supplied data.')});
return false;
}
return true;
Expand Down

0 comments on commit 8d00d0a

Please sign in to comment.