Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
Version 0_1_19
Browse files Browse the repository at this point in the history
* Fix reference to `window` in nodom implementation

* Capture referrer page as part of the encrypted blob

* Fix installation problem after relocations ( issue #33 ) because of
wrong naming in bower.json

* Generation time will now be validated

* Fix card type detection on China Union Pay vs Maestro
  • Loading branch information
Arnoud ten Hoedt committed Oct 13, 2016
1 parent 15715ed commit d1a266c
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 70 deletions.
6 changes: 3 additions & 3 deletions Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The `createEncryption ( key , `*`options`*` )` and `createEncryptedForm ( form,

* **string `[fieldNameAttribute = 'data-encrypted-name']`** - *since version: 0_1_10*

Configure the attribute to identify fields to be encrypted. Useful when you have multiple payment options within the same form, and want to bind each set to its own CSE handler.
Configure the attribute to identify fields to be encrypted. Useful when you have multiple payment options within the same form, and want to bind each set to it's own CSE handler.

* **boolean `[enableValidations = true] `**

Expand All @@ -32,13 +32,13 @@ The `createEncryption ( key , `*`options`*` )` and `createEncryptedForm ( form,

Custom handler to be called on submit of the form.

The callback function will be executed after encryption has taken place, and will receive the original submit event as its first argument.
The callback function will be executed after encryption has taken place, and will receive the original submit event as it's first argument.

* **function `[onvalidate]`**

Handler to be called after on validation of the form.

The callback function will be executed after the validation routine of the CSE form has been completed and will receive the validity status of the form as its first argument.
The callback function will be execyted after the validation routine of the CSE form has been completed and will receive the validaty status of the form as it's first argument.

* **HTMLElement `[cardTypeElement]`**

Expand Down
54 changes: 33 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The library currently offers two integration methods:
The library currently has three inclusion / loading styling:
- Download `adyen.encrypt.min.js` and host it yourself. Both HTML based as JavaScript only integration is supported.
- Download `adyen.encrypt.nodom.min.js` and host it yourself. Only supports JavaScript only integration.
- Adyen Hosted version in which the public key is embedded in the JavaScript. This integration makes sure you always have the latest security patches, and don't have to keep your public key in sync with the Adyen servers manually. See [Adyen Hosted Form Based Integration](HostedCSE.md) for more details.
- Adyen Hosted version in which the public key is embedded in the JavaScript. This integration makes sure you always have the latest security patches, and don't have to keep your public key in sync with the Adyen servers manually. See [Adyen Hosted Form Based Integration](HostedCSE.md) for more details.


## HTML based integration
Expand Down Expand Up @@ -49,7 +49,7 @@ Enricht a form in your page with the CSE onSubmit and (optionally) validation be
// The form element to encrypt
var form = document.getElementById('adyen-encrypted-form');
// The public key
var key = "your key as retrieved from the Adyen Customer Area Web Service User page";
var key = "your key as retrieved from the Adyen Customer Area Web Service User page";
// Form and encryption options. See adyen.encrypt.simple.html for details
var options = {};
// Bind encryption to the form
Expand Down Expand Up @@ -80,7 +80,7 @@ require(['adyen/encrypt'], function(adyenEncrypt) {
// The form element to encrypt
var form = document.getElementById('adyen-encrypted-form');
// The public key
var key = "your key as retrieved from the Adyen Customer Area Web Service User page";
var key = "your key as retrieved from the Adyen Customer Area Web Service User page";
// Form and encryption options. See adyen.encrypt.simple.html for details
var options = {};
// Bind encryption to the form
Expand All @@ -99,15 +99,15 @@ In case the HTML integration is troublesome in your setup, the library has been
<script type="text/javascript" src="js/adyen.encrypt.nodom.min.js"></script>
<script type="text/javascript">
(function() {
var key = "your key as retrieved from the Adyen Customer Area Web Service User page";
var key = "your key as retrieved from the Adyen Customer Area Web Service User page";
var options = {}; // See adyen.encrypt.nodom.html for details
var cseInstance = adyen.encrypt.createEncryption(key, options);
function encryptMyData() {
var postData = {};
var cardData = {
number : cardNumber,
cvc : cvc,
Expand All @@ -116,12 +116,12 @@ In case the HTML integration is troublesome in your setup, the library has been
expiryYear : expiryYear,
generationtime : generationtime
};
postData['adyen-encrypted-data'] = cseInstance.encrypt(cardData);
// Ajax Call or different handling of the post data
}
})();
</script>
````
Expand All @@ -140,7 +140,7 @@ Add to your `package.json`:
For the current latest release use the following dependency:
```
"dependencies": {
"adyen-cse-web": "git+https://github.com/Adyen/adyen-cse-web.git#v0.1.18"
"adyen-cse-web": "git+https://github.com/Adyen/adyen-cse-web.git#v0.1.19"
}
```

Expand All @@ -152,10 +152,22 @@ Now you can use adyen as a regular npm package:
var adyenEncrypt = require('adyen-cse-web');

var cseInstance = adyenEncrypt.createEncryption(key, options);
```

# Version History

JavaScript version 0_1_19
-------

* Fix reference to `window` in nodom implementation

* Capture referrer page as part of the encrypted blob

* Fix installation problem after relocations ( issue #33 ) because of wrong naming in bower.json

* Generation time will now be validated

* Fix card type detection on China Union Pay vs Maestro

JavaScript version 0_1_18
-------

Expand All @@ -182,7 +194,7 @@ JavaScript version 0_1_16
JavaScript version 0_1_15
-------

* Add cardtype detection for three new card types
* Add cardtype detection for three new card types

* Improve card type detection for dual branded cards (ELO)

Expand All @@ -193,7 +205,7 @@ JavaScript version 0_1_15
JavaScript version 0_1_14
-------

* Clean up inconsistencies between the nodom Encryption and the UI engine
* Clean up inconsistencies between the nodom Encryption and the UI engine

* Only validate fields that are only there. Removing CVC from the HTML (in case of mister cash) no longer fails validation.

Expand Down Expand Up @@ -261,7 +273,7 @@ JavaScript version 0_1_5
---
The 0_1_5 version of the JavaScript client-side encryption library upgrades the random number generator and the JSBN implementation.

JavaScript version 0_1_4
---
Expand All @@ -270,7 +282,7 @@ JavaScript version 0_1_4
All properties are configurable through the options object:
* ```options.enableValidations // default: true```

Enable basic field validation (default is true)
The submit button will be disabled when fields proof to be invalid. The form submission will be prevented as well.
Expand All @@ -279,16 +291,16 @@ JavaScript version 0_1_4
options.enableValidations = true;
```
* ```options.submitButtonAlwaysEnabled // default: false```

Always have the submit button enabled, even in case of validation errors.

```javascript
options.submitButtonAlwaysEnabled = false;
```
* ```options.numberIgnoreNonNumeric // default: true```

The payment handling ignores non-numeric characters for the card field.

By default non-numeric characters will also be ignored while validating
the card number field. This can be disabled for UX reasons.
Expand All @@ -297,7 +309,7 @@ JavaScript version 0_1_4
```
Patches

* 0_1_4p1

Remove unnecessary ```document.title``` assignment.
36 changes: 19 additions & 17 deletions js/addOns/adyen.cardtype.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,37 +64,39 @@

var currentCardType = null, currentMatchSize = 0;

console.log("Determining card type for " + variant);
console.log("Variants", availableTypes);

for ( var i = Cards.size; i-- > 0; ) {
var card = Cards[i];

if (!contains(availableTypes, card.cardtype)) {
console.log(" CardType Skipped", card.cardtype);
continue;
}

if (card.setCardNumber(variant).isCardNumber()) {
for (var c = 0; c < card.rules.size; c++) {
var len = Math.min(variant.length, card.rules[c].length);

for (var c = 0; c < card.rules.size; c++) {
var len = Math.min(variant.length, card.rules[c].length);

if (len < 3) {
// Minimum length included because of collissions
continue;
}

if (variant.substring(0, len) === card.rules[c].substring(0, len)) {
if (len > currentMatchSize) {
currentCardType = card;
currentMatchSize = len;
}
}
if (len <= 1 || variant.length < card.rules[c].length) {
// Minimum length included because of collissions on single number cardtypes
continue;
}


if (variant.substring(0, len) === card.rules[c].substring(0, len)) {
if (len > currentMatchSize) {
console.log("Setting card type to ", card);
currentCardType = card;
currentMatchSize = len;
}
}
}

card.setCardNumber(null);
}

if (currentCardType === null) {
console.log("Could not determine card type, so falling back to HPP implementation: " + variant)
currentCardType = getBaseCard( variant, availableTypes );
}

Expand Down Expand Up @@ -133,7 +135,7 @@
};

adyen.CardTypeDetection = {
version : '0_1_18',
version : '0_1_19',
getHandler : function ( cardTypeElement ) {
return function ( ev ) {

Expand Down
2 changes: 1 addition & 1 deletion js/addOns/adyen.cardtype.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit d1a266c

Please sign in to comment.