Skip to content

Releases: Worldline-Global-Collect/connect-sdk-nodejs

5.1.0

25 Mar 12:35
Compare
Choose a tag to compare
  • Added:
    • Added support for custom HTTP agents through initialization property connectionOptions.agent. In combination with https-proxy-agent this allows for proxying using the HTTP CONNECT method.
  • Fixed:
    • dateformat is a proper dependency again instead of a development dependency.
    • The order of overloads for connectSdk.assertSuccess has been switched, so if an SdkBinaryResponse is given the output will be an SdkBinarySuccessResponse and not an SdkSuccessResponse<Readable>.

5.0.0

19 Mar 08:37
Compare
Choose a tag to compare

This SDK is a rebranded and updated version of the SDK that was previously published under the Ingenico name. Next to renaming to Worldline, the SDK has been restructured to better support future improvements like multiple API versions and different authentication mechanisms. You can use the migration guide to upgrade from the previous version. Previous versions and release notes of this SDK can be found here.

The following is an overview of changes, where connectSdk is the SDK's main module, as imported using import * as connectSdk from "connect-sdk-nodejs" or const connectSdk = require("connect-sdk-nodejs"):

  • Added:
    • Added function connectSdk.assertSuccess that takes an SdkResponse or SdkBinaryResponse and returns it as-is if it's successful, or throws an error otherwise.
  • Changed:
    • Changed the minimum Node.js version from Node.js 8 to Node.js 12.
    • Each API version now has its own module structure that contains all interfaces (and implementations) specific for that version, including interfaces like APIError and WebhooksHelper.
    • Moved all JSON schemas to folder schemas/v1.
    • The SDK no longer has a singleton client. The init method now returns a new object that implements new interface Client every time it is called.
    • Replaced callbacks with promises. Only functions from module connect-sdk-nodejs/lib/utils/connection still use callbacks for technical reasons.
    • Made type SdkResponse generic to indicate the body types for successful and unsuccessful responses. This removes the need for casting the body.
    • Moved property file from type SdkResponse to new type SdkBinaryResponse, and made it required.
    • Moved type ConnectionCallback from module connect-sdk-nodejs/lib/models/types to module connect-sdk-nodejs/lib/utils/connection.
    • Moved API endpoint properties like connectSdk.payments to new interface V1Client. Implementations of this interface are available through property v1 of interface Client.
    • Moved property connectSdk.context to new interface Client.
    • Renamed interface Context to Configuration.
    • Renamed interface IdemPotence to Idempotence.
    • Renamed property idemPotence of interface PaymentContext to idempotence.
    • Replaced method getContext of interface SdkContext with methods getEndpoint, getProxy and getObfuscationRules.
    • Replaced method getSignature of interface SdkContext with method getAuthenticator.
    • Replaced methods getIdempotenceRequestTimestamp and setIdempotenceRequestTimestamp of interface SdkContext with property requestTimestamp of interface Idempotence.
    • Changed the export of module connect-sdk-nodejs/lib/utils/context from a singleton SdkContext instance to function newSdkContext.
    • Functions json and multipart of module connect-sdk-nodejs/lib/utils/communicator now require an additional argument of type SdkContext.
    • Made the SdkContext parameter of function getObfuscated of module connect-sdk-nodejs/lib/utils/obfuscate required.
    • Moved method connectSdk.webhooks.init to new interface V1WebhooksFactory. An object that implements this interface is available through property connectSdk.webhooks.v1.
    • The SDK no longer has a singleton webhooks helper. The init mehod now returns a new object that implements interface WebhooksHelper every time it is called.
    • Changed the type of connectSdk.webhooks from WebhooksHelper to new interface Webhooks.
    • Moved property inMemorySecretKeyStore of interface WebhooksHelper to new interface Webhooks. It remain available using connectSdk.webhooks.inMemorySecretKeyStore.
    • Changed the export of module connect-sdk-nodejs/lib/webhooks/validation from a singleton SignatureValidator instance to function newSignatureValidator.
    • Changed the export of modules for API clients and calls like connect-sdk-nodejs/lib/payments or connect-sdk-nodejs/lib/payments/create to functions that take an SdkContext argument and return what was exported previously.
  • Removed:
    • Removed module connect-sdk-nodejs/lib/utils/versions with constant apiVersion.
    • Removed interface ConnectSdk that represented the SDK's main module.
    • Removed property httpOptions of interface Context/Configuration.
    • Removed methods setContext, setIntegrator and setShoppingCartExtension of interface SdkContext.
    • Removed types SdkCallback, SecretKeyCallback, UnmarshalCallback and ValidateCallback.
    • Removed property cb of interface SdkRequest.
    • Removed method init of interface SignatureValidator.
    • Removed method validate of interface WebhooksHelper.