Adyen / adyen-cse-web

[DEPRECATED] Client-side encryption on JavaScript
MIT License
15 stars 39 forks source link

BUG: Ensure expected globals are defined for Node.js. #80

Closed mastermatt closed 5 years ago

mastermatt commented 5 years ago

Allows for use in Node.js without the importer having to manually set variables on the global object.

The README states that the lib can be used in Node using this pattern:

var adyenEncrypt = require('adyen-cse-web');
var cseInstance = adyenEncrypt.createEncryption(key, options);

But when actually attempting the import in a Node environment, the result is an error

> process.version
'v10.13.0'
> var adyenEncrypt = require('adyen-cse-web');
ReferenceError: navigator is not defined
    at /Users/me/src/myapp/node_modules/adyen-cse-web/js/adyen.encrypt.nodom.js:153:840
    at Object.<anonymous> (/Users/me/src/myapp/node_modules/adyen-cse-web/js/adyen.encrypt.nodom.js:658:4)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
rikterbeek commented 5 years ago

Hi @mastermatt,

This package is deprecated. Please use Secure fields instead. https://docs.adyen.com/developers/checkout/api-integration#encryptcreditcarddetails

Regards, Rik Adyen