Skip to content

Commit

Permalink
Merge pull request #203 from mdoellerer-fc/OX6-88_cardholder_for_3DS2
Browse files Browse the repository at this point in the history
OX6-88 cardholder field for 3ds2
  • Loading branch information
Florian Bender authored Jan 22, 2021
2 parents a72f3f1 + 3ca55b0 commit ce22b74
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 36 deletions.
3 changes: 3 additions & 0 deletions application/translations/de/fcPayOne_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 3 additions & 0 deletions application/translations/en/fcPayOne_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<br>(only supported for german accounts).',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,22 @@
</p>
</div>
</li>
<li>
<label>[{oxmultilang ident="FCPO_BANK_ACCOUNT_HOLDER_2"}]:</label>
<input placeholder="[{oxmultilang ident="FCPO_BANK_ACCOUNT_HOLDER_2"}]" autocomplete="off" type="text" size="20" maxlength="64" name="dynvalue[fcpo_kkname]" value="[{if $dynvalue.fcpo_kkname}][{$dynvalue.fcpo_kkname}][{else}][{$oxcmp_user->oxuser__oxfname->value}] [{$oxcmp_user->oxuser__oxlname->value}][{/if}]">
<br>
<div class="note">[{oxmultilang ident="FCPO_IF_DEFERENT_FROM_BILLING_ADDRESS"}]</div>
<li class="form-group">
<label id="fcpo_cc_cardholder_label" class="req control-label col-lg-3">[{oxmultilang ident="FCPO_CC_CARDHOLDER"}]:</label>
<input autocomplete="off" type="text"
class="form-control"
size="20" maxlength="50" id="fcpo_cc_cardholder" name="dynvalue[fcpo_kkcardholder]"
value="[{$dynvalue.fcpo_kkcardholder}]"
onkeyup="validateCardholder()"
>
<p style="display: block; padding: 5px 0 5px 150px">[{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}]</p>
<div id="fcpo_cc_cardholder_invalid" class="fcpo_check_error">
<span class="help-block">
<ul class="oxValidateError" style="display: block;">
<li>[{oxmultilang ident="FCPO_CC_CARDHOLDER_INVALID"}]</li>
</ul>
</span>
</div>
</li>
<li>
<label>[{oxmultilang ident="FCPO_VALID_UNTIL"}]:</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,22 @@
<span id="cardexpireyear"></span>
</span>
</li>
<li>
<label for="firstname">[{oxmultilang ident="FCPO_FIRSTNAME"}]:</label>
<input placeholder="[{oxmultilang ident="FCPO_FIRSTNAME"}]" autocomplete="off" id="firstname" type="text" name="firstname" value="">
</li>
<li>
<label for="lastname">[{oxmultilang ident="FCPO_LASTNAME"}]:</label>
<input placeholder="[{oxmultilang ident="FCPO_LASTNAME"}]" autocomplete="off" id="lastname" type="text" name="lastname" value="">
<li class="form-group">
<label id="fcpo_cc_cardholder_label" class="req control-label col-lg-3">[{oxmultilang ident="FCPO_CC_CARDHOLDER"}]:</label>
<input autocomplete="off" type="text"
class="form-control"
size="20" maxlength="50" id="fcpo_cc_cardholder" name="dynvalue[fcpo_kkcardholder]"
value="[{$dynvalue.fcpo_kkcardholder}]"
onkeyup="validateCardholder()"
>
<p style="display: block; padding: 5px 0 5px 150px">[{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}]</p>
<div id="fcpo_cc_cardholder_invalid" class="fcpo_check_error">
<span class="help-block">
<ul class="oxValidateError" style="display: block;">
<li>[{oxmultilang ident="FCPO_CC_CARDHOLDER_INVALID"}]</li>
</ul>
</span>
</div>
</li>
<li>
<div id="errorOutput"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,23 @@
</div>
</div>

<div class="form-group fcpo_kkname">
<label class="req control-label col-lg-3">[{oxmultilang ident="FCPO_BANK_ACCOUNT_HOLDER_2"}]:</label>
<div class="form-group fcpo_kkcardholder">
<label id="fcpo_cc_cardholder_label" id="fcpo_cc_cardholder_label" class="req control-label col-lg-3">[{oxmultilang ident="FCPO_CC_CARDHOLDER"}]:</label>
<div class="col-lg-9">
<input placeholder="[{oxmultilang ident="FCPO_BANK_ACCOUNT_HOLDER_2"}]" autocomplete="off" type="text" class="form-control js-oxValidate js-oxValidate_notEmpty" size="20" maxlength="64" name="dynvalue[fcpo_kkname]" value="[{if $dynvalue.fcpo_kkname}][{$dynvalue.fcpo_kkname}][{else}][{$oxcmp_user->oxuser__oxfname->value}] [{$oxcmp_user->oxuser__oxlname->value}][{/if}]" required="required">
<span class="help-block">[{oxmultilang ident="FCPO_IF_DEFERENT_FROM_BILLING_ADDRESS"}]</span>
<input for="fcpo_cc_cardholder" autocomplete="off" type="text"
class="form-control"
size="20" maxlength="50" id="fcpo_cc_cardholder" name="dynvalue[fcpo_kkcardholder]"
value="[{$dynvalue.fcpo_kkcardholder}]"
onkeyup="validateCardholder()"
>
<span class="help-block">[{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}]</span>
<div id="fcpo_cc_cardholder_invalid" class="fcpo_check_error">
<span class="help-block">
<ul role="alert" class="list-unstyled text-danger">
<li>[{oxmultilang ident="FCPO_CC_CARDHOLDER_INVALID"}]</li>
</ul>
</span>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,23 @@
</span>
</div>
</div>
<div class="form-group fcpo_kkfirstname">
<label for="firstname" class="req control-label col-lg-3">[{oxmultilang ident="FCPO_FIRSTNAME"}]:</label>
<div class="form-group fcpo_kkcardholder">
<label for="fcpo_cc_cardholder" id="fcpo_cc_cardholder_label" class="req control-label col-lg-3">[{oxmultilang ident="FCPO_CC_CARDHOLDER"}]:</label>
<div class="col-lg-9">
<input placeholder="[{oxmultilang ident="FCPO_FIRSTNAME"}]" class="form-control" autocomplete="off" id="firstname" type="text" name="firstname" value="">
</div>
</div>
<div class="form-group fcpo_kklastname">
<label for="lastname" class="req control-label col-lg-3">[{oxmultilang ident="FCPO_LASTNAME"}]:</label>
<div class="col-lg-9">
<input placeholder="[{oxmultilang ident="FCPO_LASTNAME"}]" class="form-control" autocomplete="off" id="lastname" type="text" name="lastname" value="">
<input autocomplete="off" type="text"
class="form-control"
size="20" maxlength="50" id="fcpo_cc_cardholder" name="dynvalue[fcpo_kkcardholder]"
value="[{$dynvalue.fcpo_kkcardholder}]"
onkeyup="validateCardholder()"
>
<span class="help-block">[{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}]</span>
<div id="fcpo_cc_cardholder_invalid" class="fcpo_check_error">
<span class="help-block">
<ul role="alert" class="list-unstyled text-danger">
<li>[{oxmultilang ident="FCPO_CC_CARDHOLDER_INVALID"}]</li>
</ul>
</span>
</div>
</div>
</div>
<div class="form-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,22 @@
</div>

<div class="form-group fcpo_kkname">
<label class="req control-label col-lg-3">[{oxmultilang ident="FCPO_BANK_ACCOUNT_HOLDER_2"}]:</label>
<label for="fcpo_cc_cardholder" id="fcpo_cc_cardholder_label" class="req control-label col-lg-3">[{oxmultilang ident="FCPO_CC_CARDHOLDER"}]:</label>
<div class="col-lg-9">
<input placeholder="[{oxmultilang ident="FCPO_BANK_ACCOUNT_HOLDER_2"}]" autocomplete="off" type="text" class="form-control js-oxValidate js-oxValidate_notEmpty" size="20" maxlength="64" name="dynvalue[fcpo_kkname]" value="[{if $dynvalue.fcpo_kkname}][{$dynvalue.fcpo_kkname}][{else}][{$oxcmp_user->oxuser__oxfname->value}] [{$oxcmp_user->oxuser__oxlname->value}][{/if}]" required="required">
<span class="help-block">[{oxmultilang ident="FCPO_IF_DEFERENT_FROM_BILLING_ADDRESS"}]</span>
<input autocomplete="off" type="text"
class="form-control"
size="20" maxlength="50" id="fcpo_cc_cardholder" name="dynvalue[fcpo_kkcardholder]"
value="[{$dynvalue.fcpo_kkcardholder}]"
onkeyup="validateCardholder()"
>
<span class="help-block form-group">[{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}]</span>
<div id="fcpo_cc_cardholder_invalid" class="fcpo_check_error">
<span class="help-block">
<ul role="alert" class="list-unstyled text-danger">
<li>[{oxmultilang ident="FCPO_CC_CARDHOLDER_INVALID"}]</li>
</ul>
</span>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,24 @@
</span>
</div>
</div>
<div class="form-group fcpo_kkfirstname">
<label for="firstname" class="req control-label col-lg-3">[{oxmultilang ident="FCPO_FIRSTNAME"}]:</label>
<div class="form-group fcpo_kkcardholder">
<label for="fcpo_cc_cardholder" id="fcpo_cc_cardholder_label" class="req control-label col-lg-3">[{oxmultilang ident="FCPO_CC_CARDHOLDER"}]:</label>
<div class="col-lg-9">
<input placeholder="[{oxmultilang ident="FCPO_FIRSTNAME"}]" class="form-control" autocomplete="off" id="firstname" type="text" name="firstname" value="">
<input autocomplete="off" type="text"
class="form-control"
size="20" maxlength="50" id="fcpo_cc_cardholder" name="dynvalue[fcpo_kkcardholder]"
value="[{$dynvalue.fcpo_kkcardholder}]"
onkeyup="validateCardholder()"
>
<span class="help-block form-group">[{oxmultilang ident="FCPO_CC_CARDHOLDER_HELPTEXT"}]</span>
</div>
</div>
<div class="form-group fcpo_kklastname">
<label for="lastname" class="req control-label col-lg-3">[{oxmultilang ident="FCPO_LASTNAME"}]:</label>
<div class="col-lg-9">
<input placeholder="[{oxmultilang ident="FCPO_LASTNAME"}]" class="form-control" autocomplete="off" id="lastname" type="text" name="lastname" value="">
</div>
<div id="fcpo_cc_cardholder_invalid" class="fcpo_check_error">
<span class="help-block">
<ul role="alert" class="list-unstyled text-danger">
<li>[{oxmultilang ident="FCPO_CC_CARDHOLDER_INVALID"}]</li>
</ul>
</span>
</div>
<div class="form-group">
<div class="col-lg-9 col-lg-push-3">
Expand Down
1 change: 1 addition & 0 deletions lib/fcporequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
30 changes: 30 additions & 0 deletions out/src/js/fcPayOne.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ce22b74

Please sign in to comment.