From c18c8b8b1388b425f60baed9c0faef323f26a0a1 Mon Sep 17 00:00:00 2001 From: mdoellerer-fc Date: Tue, 15 Dec 2020 17:40:26 +0100 Subject: [PATCH 1/4] OX6-88 Transfer all changes, add changes in Wave theme. --- application/translations/de/fcPayOne_lang.php | 3 ++ application/translations/en/fcPayOne_lang.php | 3 ++ .../azure/fcpo_payment_creditcard_ajax.tpl | 21 +++++++++---- .../azure/fcpo_payment_creditcard_hosted.tpl | 23 +++++++++----- .../tpl/flow/fcpo_payment_creditcard_ajax.tpl | 20 ++++++++++--- .../flow/fcpo_payment_creditcard_hosted.tpl | 25 ++++++++++------ .../tpl/wave/fcpo_payment_creditcard_ajax.tpl | 18 +++++++++-- .../wave/fcpo_payment_creditcard_hosted.tpl | 21 ++++++++----- lib/fcporequest.php | 1 + out/src/js/fcPayOne.js | 30 +++++++++++++++++++ 10 files changed, 130 insertions(+), 35 deletions(-) diff --git a/application/translations/de/fcPayOne_lang.php b/application/translations/de/fcPayOne_lang.php index d417d550..dee5856e 100755 --- a/application/translations/de/fcPayOne_lang.php +++ b/application/translations/de/fcPayOne_lang.php @@ -34,6 +34,9 @@ 'FCPO_CC_NUMBER_INVALID' => 'Bitte geben Sie eine korrekte Kreditkarten-Nummer ein.', 'FCPO_CC_DATE_INVALID' => 'Bitte geben Sie ein korrektes Gültigkeits-Datum an.', 'FCPO_CC_CVC2_INVALID' => 'Bitte geben Sie eine korrekte Prüfziffer an.', + 'FCPO_CC_CARDHOLDER' => "Karteninhaber", + 'FCPO_CC_CARDHOLDER_HELPTEXT' => "Karteninhaber wie aufgedruckt", + 'FCPO_CC_CARDHOLDER_INVALID' => "Es sind nur A-Z, ÄÖÜ,ß und - erlaubt", 'fcpo_so_ktonr' => 'Kontonummer', 'fcpo_so_blz' => 'BLZ', 'FCPO_MANIPULATION' => 'Verdacht auf Manipulation', diff --git a/application/translations/en/fcPayOne_lang.php b/application/translations/en/fcPayOne_lang.php index 1d5c708e..0775f3fd 100755 --- a/application/translations/en/fcPayOne_lang.php +++ b/application/translations/en/fcPayOne_lang.php @@ -34,6 +34,9 @@ 'FCPO_CC_NUMBER_INVALID' => 'Please enter a valid credit card number.', 'FCPO_CC_DATE_INVALID' => 'Please enter a valid date of expiry.', 'FCPO_CC_CVC2_INVALID' => 'Please enter a valid check digit.', +'FCPO_CC_CARDHOLDER' => "Cardholder", +'FCPO_CC_CARDHOLDER_HELPTEXT' => "Cardholder as printed on card", +'FCPO_CC_CARDHOLDER_INVALID' => "Only A-Z, ÄÖÜ,ß and - are valid", 'fcpo_so_ktonr' => 'Bank account number', 'fcpo_so_blz' => 'Bank identification number', 'FCPO_BANK_GER_OLD' => 'or pay by using your usual bank account number and bank code
(only supported for german accounts).', diff --git a/application/views/frontend/tpl/azure/fcpo_payment_creditcard_ajax.tpl b/application/views/frontend/tpl/azure/fcpo_payment_creditcard_ajax.tpl index 0e9b02a2..734facd0 100644 --- a/application/views/frontend/tpl/azure/fcpo_payment_creditcard_ajax.tpl +++ b/application/views/frontend/tpl/azure/fcpo_payment_creditcard_ajax.tpl @@ -35,11 +35,22 @@

-
  • - - -
    -
    [{oxmultilang ident="FCPO_IF_DEFERENT_FROM_BILLING_ADDRESS"}]
    +
  • + + +

    [{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}]

    +
    + +
      +
    • [{oxmultilang ident="FCPO_CC_CARDHOLDER_INVALID"}]
    • +
    +
    +
  • diff --git a/application/views/frontend/tpl/azure/fcpo_payment_creditcard_hosted.tpl b/application/views/frontend/tpl/azure/fcpo_payment_creditcard_hosted.tpl index 27f97eea..e1f28009 100644 --- a/application/views/frontend/tpl/azure/fcpo_payment_creditcard_hosted.tpl +++ b/application/views/frontend/tpl/azure/fcpo_payment_creditcard_hosted.tpl @@ -41,13 +41,22 @@
  • -
  • - - -
  • -
  • - - +
  • + + +

    [{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}]

    +
    + +
      +
    • [{oxmultilang ident="FCPO_CC_CARDHOLDER_INVALID"}]
    • +
    +
    +
  • diff --git a/application/views/frontend/tpl/flow/fcpo_payment_creditcard_ajax.tpl b/application/views/frontend/tpl/flow/fcpo_payment_creditcard_ajax.tpl index 64c9d6a7..43c5c1ab 100644 --- a/application/views/frontend/tpl/flow/fcpo_payment_creditcard_ajax.tpl +++ b/application/views/frontend/tpl/flow/fcpo_payment_creditcard_ajax.tpl @@ -46,11 +46,23 @@ -
    - +
    +
    - - [{oxmultilang ident="FCPO_IF_DEFERENT_FROM_BILLING_ADDRESS"}] + + [{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}] +
    + + + +
    diff --git a/application/views/frontend/tpl/flow/fcpo_payment_creditcard_hosted.tpl b/application/views/frontend/tpl/flow/fcpo_payment_creditcard_hosted.tpl index 771f6056..3f2f0b5b 100644 --- a/application/views/frontend/tpl/flow/fcpo_payment_creditcard_hosted.tpl +++ b/application/views/frontend/tpl/flow/fcpo_payment_creditcard_hosted.tpl @@ -50,16 +50,23 @@
    -
    - +
    +
    - -
    -
    -
    - -
    - + + [{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}] +
    + + + +
    diff --git a/application/views/frontend/tpl/wave/fcpo_payment_creditcard_ajax.tpl b/application/views/frontend/tpl/wave/fcpo_payment_creditcard_ajax.tpl index 963ba074..315e9edc 100644 --- a/application/views/frontend/tpl/wave/fcpo_payment_creditcard_ajax.tpl +++ b/application/views/frontend/tpl/wave/fcpo_payment_creditcard_ajax.tpl @@ -47,10 +47,22 @@
    - +
    - - [{oxmultilang ident="FCPO_IF_DEFERENT_FROM_BILLING_ADDRESS"}] + + [{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}] +
    + + + +
    diff --git a/application/views/frontend/tpl/wave/fcpo_payment_creditcard_hosted.tpl b/application/views/frontend/tpl/wave/fcpo_payment_creditcard_hosted.tpl index b6506dbf..f1c6aa00 100644 --- a/application/views/frontend/tpl/wave/fcpo_payment_creditcard_hosted.tpl +++ b/application/views/frontend/tpl/wave/fcpo_payment_creditcard_hosted.tpl @@ -51,16 +51,23 @@
    - +
    - +
    -
    - -
    - -
    + [{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}] +
    + + +
    diff --git a/lib/fcporequest.php b/lib/fcporequest.php index 547d10ef..01b51638 100755 --- a/lib/fcporequest.php +++ b/lib/fcporequest.php @@ -338,6 +338,7 @@ protected function _setPaymentParamsCC($aDynvalue) $this->addParameter('pseudocardpan', $aDynvalue['fcpo_pseudocardpan']); // Override mode for creditcard-type $this->addParameter('mode', $aDynvalue['fcpo_ccmode']); + $this->addParameter('cardholder', $aDynvalue['fcpo_kkcardholder']); return true; } diff --git a/out/src/js/fcPayOne.js b/out/src/js/fcPayOne.js index 07b694ed..5d1578f4 100755 --- a/out/src/js/fcPayOne.js +++ b/out/src/js/fcPayOne.js @@ -84,6 +84,9 @@ function resetErrorContainers() { if(document.getElementById('fcpo_cc_cvc2_invalid')) { document.getElementById('fcpo_cc_cvc2_invalid').style.display = ''; } + if(document.getElementById('fcpo_cc_cardholder_invalid')) { + document.getElementById('fcpo_cc_cardholder_invalid').style.display = ''; + } if(document.getElementById('fcpo_cc_error')) { document.getElementById('fcpo_cc_error').style.display = ''; } @@ -243,6 +246,24 @@ function startCCRequest() { return false; } +function validateCardholder(e) { + var error = false; + var cardholder = document.getElementById('fcpo_cc_cardholder').value; + var cardholderLabel = document.getElementById('fcpo_cc_cardholder_label'); + var cardholderReg = new RegExp(/^[A-Za-z \-äöüÄÖÜß]{1,50}$/); + if (cardholderReg.test(cardholder)) { + document.getElementById('fcpo_cc_cardholder_invalid').style.display = ''; + cardholderLabel.classList.remove("text-danger"); + cardholderLabel.classList.remove("cardholder-error"); + } else { + error = true; + document.getElementById('fcpo_cc_cardholder_invalid').style.display = 'block'; + cardholderLabel.classList.add("text-danger"); + cardholderLabel.classList.add("cardholder-error"); + } + return error; +} + function getCleanedNumber(dirtyNumber) { var cleanedNumber = ''; var tmpChar; @@ -470,6 +491,10 @@ function processPayoneResponseELV(response) { } function processPayoneResponseCC(response) { + var cardholderError = validateCardholder(); + if (cardholderError) { + return false; + } if(response.get('status') == 'VALID') { var oForm = getPaymentForm(); oForm["dynvalue[fcpo_pseudocardpan]"].value = response.get('pseudocardpan'); @@ -959,6 +984,11 @@ function validateInputCCHosted(e) { if(paymentId == 'fcpocreditcard' && oForm.fcpo_cc_type.value == 'hosted' && cardType != 'none') { $validateResult = validateCCHostedInputs(); + var cardholderError = validateCardholder(e); + if (cardholderError) { + e.preventDefault(); + return; + } if($validateResult == 0) { e.preventDefault(); $('#errorIncomplete').show(); From 3c9fb15ee205411d560cac2b9db8e66d54e4306c Mon Sep 17 00:00:00 2001 From: mdoellerer-fc Date: Tue, 15 Dec 2020 23:42:40 +0100 Subject: [PATCH 2/4] OX6-88 Transfer all changes, add changes in Wave theme. --- .../views/frontend/tpl/wave/fcpo_payment_creditcard_hosted.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/frontend/tpl/wave/fcpo_payment_creditcard_hosted.tpl b/application/views/frontend/tpl/wave/fcpo_payment_creditcard_hosted.tpl index f1c6aa00..ac394af5 100644 --- a/application/views/frontend/tpl/wave/fcpo_payment_creditcard_hosted.tpl +++ b/application/views/frontend/tpl/wave/fcpo_payment_creditcard_hosted.tpl @@ -50,7 +50,7 @@
    -
    +
    Date: Mon, 11 Jan 2021 20:43:23 +0100 Subject: [PATCH 3/4] OX6-88 fix Cardholder field, now it has the "required" class. Also fix the position of it help text in the wave theme --- .../tpl/azure/fcpo_payment_creditcard_ajax.tpl | 2 +- .../tpl/azure/fcpo_payment_creditcard_hosted.tpl | 2 +- .../tpl/flow/fcpo_payment_creditcard_ajax.tpl | 4 ++-- .../tpl/flow/fcpo_payment_creditcard_hosted.tpl | 2 +- .../tpl/wave/fcpo_payment_creditcard_ajax.tpl | 4 ++-- .../tpl/wave/fcpo_payment_creditcard_hosted.tpl | 14 +++++++------- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/application/views/frontend/tpl/azure/fcpo_payment_creditcard_ajax.tpl b/application/views/frontend/tpl/azure/fcpo_payment_creditcard_ajax.tpl index 734facd0..da0edaae 100644 --- a/application/views/frontend/tpl/azure/fcpo_payment_creditcard_ajax.tpl +++ b/application/views/frontend/tpl/azure/fcpo_payment_creditcard_ajax.tpl @@ -36,7 +36,7 @@
  • - +
  • - +
    - +
    -
    - +
    - +
    - [{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}] + [{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}]
    - +
    + [{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}]
    - [{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}]
    - - - + + +
    From 3ca55b068af4c7ff3fa9ae13c4e2e94e49f682ee Mon Sep 17 00:00:00 2001 From: mdoellerer-fc Date: Mon, 18 Jan 2021 16:49:06 +0100 Subject: [PATCH 4/4] OX6-88 Flow theme: missing id attribute in Cardholder label fixed, this was causing the cardholder validation to crash. --- .../views/frontend/tpl/flow/fcpo_payment_creditcard_ajax.tpl | 2 +- .../views/frontend/tpl/flow/fcpo_payment_creditcard_hosted.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/views/frontend/tpl/flow/fcpo_payment_creditcard_ajax.tpl b/application/views/frontend/tpl/flow/fcpo_payment_creditcard_ajax.tpl index effc9b3d..afe55ca3 100644 --- a/application/views/frontend/tpl/flow/fcpo_payment_creditcard_ajax.tpl +++ b/application/views/frontend/tpl/flow/fcpo_payment_creditcard_ajax.tpl @@ -47,7 +47,7 @@
    - +
    - +