Skip to content

Commit

Permalink
INGA-111: User sees extra fields "Card number" and "Expiry date" for …
Browse files Browse the repository at this point in the history
…saved card (#27207)

 - remove saved validation riles in case of initialization
  • Loading branch information
aivus authored Mar 12, 2020
1 parent 2ac6825 commit 68fe85a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Method/Handler/SepaPaymentProductHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private function createToken(
Iban::NAME => $this->getAdditionalDataFieldByKey($paymentTransaction, self::IBAN_OPTION_KEY),
PaymentProductId::NAME => EnabledProductsDataProvider::SEPA_ID,
MandateApproval\MandateSignatureDate::NAME => $currentDateTime->format('Ymd'),
],
]
);

return TokenResponse::create($response->toArray());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ define(function(require) {
connectSdk: null,

/**
* Contains saved original validation rules from the SDK in case of using tokenization
* This validation rules will be restored to SDK in case customer doesn't want to use saved (tokenized) card
*
* @property {Object}
*/
_requiredFields: {},
Expand Down Expand Up @@ -423,6 +426,8 @@ define(function(require) {
paymentProductFieldsHolder.find('select').inputWidget('create', 'select2');

if (this.isTokenizationApplicable()) {
// Clean up saved required fields validation rules on initialization
delete this._requiredFields[this.currentPaymentProduct.id];
this.$el.on('change.' + this.cid, this.getTokenFieldSelector(), this.onTokenChange.bind(this));
}

Expand Down Expand Up @@ -638,6 +643,9 @@ define(function(require) {
},

_saveRequiredFieldsList: function() {
// Skip if current payment product is not defined
// or we already saved original validation rules from the SDK
// (in case customer changed from one tokenized card to another)
if (!this.currentPaymentProduct || this._requiredFields[this.currentPaymentProduct.id]) {
return;
}
Expand Down

0 comments on commit 68fe85a

Please sign in to comment.