Ingenico-ePayments / connect-sdk-client-js

Ingenico Connect JavaScript Client SDK
https://docs.connect.worldline-solutions.com/documentation/sdk/mobile/javascript/
Other
26 stars 15 forks source link

Ingenico Connect JavaScript SDK

This SDK has been rebranded to Worldline. As part of the rebranding the SDK has moved to https://github.com/Worldline-Global-Collect/connect-sdk-client-js.

Introduction

The JavaScript SDK helps you to communicate with the Ingenico Connect Client API. Its primary features are:

See the Ingenico ePayments Developer Hub for more information on how to use the SDK.

Examples

⚠ Please note that all examples have been moved to their own repository.

Structure of this repository

This repository consists out of one main component:

  1. The source code of the SDK itself: /src/

Building the repository

This repository uses gulp to build. Assuming you have npm and gulp installed, building is straightforward:

  1. If it exists, remove the dist folder.
  2. From the root of the project install all dependencies: npm install
  3. From the same location run gulp: npm run build
  4. The result of the build will have been written to the dist folder. This folder will contain the following files:
    • /dist/index.js - The result of compiling the TypeScript source code to AMD modules, as a single file
    • /dist/index.d.ts - TypeScript definitions for index.js
    • /dist/connectsdk.js - The compiled TypeScript AMD modules plus bundled encryption components and support for loading directly in the browser
    • /dist/connectsdk.min.js - The minified version of connectsdk.js
    • /dist/connectsdk.noEncrypt.js - The compiled TypeScript AMD modules plus support for loading directly in the browser, but without the encryption components
    • /dist/connectsdk.noEncrypt.min.js - The minified version of connectsdk.noEncrypt.js

Installation

From the folder where your package.json is located, run the following command to install the SDK:

npm i connect-sdk-client-js

Inside the node_modules folder, the SDK will contain a dist folder that contains the files created by building the repository (see above). From these files, you should use dist/index.js if your module loader or module bundler supports AMD. Otherwise, use dist/connectsdk.js, dist/connectsdk.noEncrypt.js or their minified versions.

⚠ When using a module loader or module bundler that supports AMD, the SDK has a dependency on node-forge, even if encryption is not needed. You need to provide a node-forge module if it is not yet available. This may return an empty object. For instance:

define('node-forge], [], function () {
  return {};
});

Or, to provide node-forge itself if it's only available as a global variable forge:

define('node-forge], [], function () {
  return forge;
});