I've been following method 2 from this guide: https://docs.clover.com/docs/cloud-sdk-v3
But on cloverConnector getting postData null error.
Here is the code we are using;
const cloudConfigurationBuilder = new clover.WebSocketCloudCloverDeviceConfigurationBuilder( "", // applicationId "", //"", // deviceId "", // merchantId "", // accessToken ); const cloudConfiguration = cloudConfigurationBuilder.setCloverServer("https://sandbox.dev.clover.com") .setFriendlyId("") .build(); var builderConfiguration = {}; builderConfiguration[clover.CloverConnectorFactoryBuilder.FACTORY_VERSION] = clover.CloverConnectorFactoryBuilder.VERSION_12; var cloverConnectorFactory = clover.CloverConnectorFactoryBuilder.createICloverConnectorFactory(builderConfiguration); console.log(cloverConnectorFactory); console.log(builderConfiguration); var defaultCloverConnectorListener = Object.assign({}, clover.remotepay.ICloverConnectorListener.prototype, { onDeviceReady: function (merchantInfo) { updateStatus("Pairing successfully completed, your Clover device is ready to process requests."); console.log({message: "Device Ready to process requests!", merchantInfo: merchantInfo}); }, onDeviceDisconnected: function () { console.log({message: "Disconnected"}); }, onDeviceConnected: function () { console.log({message: "Connected, but not available to process requests"}); } }); var cloverConnector = cloverConnectorFactory.createICloverConnector(cloudConfiguration); cloverConnector.addCloverConnectorListener(defaultCloverConnectorListener); clover.remotepay.ICloverConnectorListener.prototype, { cloverConnector.initializeConnection();
and here is the response:
CloverConnectorFactoryV2 {} { FACTORY_VERSION: 'VERSION_12' } error TypeError: Cannot read property 'postData' of null at WebSocketCloudCloverTransport.obtainWebSocketUrlAndSendPushAlert (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/transport/websocket/WebSocketCloudCloverTransport.js:102:26) at WebSocketCloudCloverTransport.initialize (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/transport/websocket/WebSocketCloudCloverTransport.js:79:22) at new WebSocketCloudCloverTransport (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/transport/websocket/WebSocketCloudCloverTransport.js:53:15) at WebSocketCloudCloverDeviceConfiguration.getCloverTransport (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/device/WebSocketCloudCloverDeviceConfiguration.js:74:25) at WebsocketCloudCloverDevice.DefaultCloverDevice [as constructor] (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/device/DefaultCloverDevice.js:34:92) at new WebsocketCloudCloverDevice (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/device/WebsocketCloudCloverDevice.js:25:23) at Function.CloverDeviceFactory.get (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/device/CloverDeviceFactory.js:24:28) at CloverConnector.initialize (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/CloverConnector.js:44:65) at CloverConnector.initializeConnection (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/CloverConnector.js:51:18) at module.exports.pay (/usr/share/nginx/html/api/app/controllers/order-controller.js:125:18) Trace at Logger.toConsole (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/util/Logger.js:46:29) at Logger.emit (events.js:376:20) at Function.CloverDeviceFactory.get (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/device/CloverDeviceFactory.js:27:38) at CloverConnector.initialize (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/CloverConnector.js:44:65) at CloverConnector.initializeConnection (/usr/share/nginx/html/api/node_modules/remote-pay-cloud/dist/com/clover/remote/client/CloverConnector.js:51:18) at module.exports.pay (/usr/share/nginx/html/api/app/controllers/order-controller.js:125:18) at Layer.handle [as handle_request] (/usr/share/nginx/html/api/node_modules/express/lib/router/layer.js:95:5) at next (/usr/share/nginx/html/api/node_modules/express/lib/router/route.js:137:13) at /usr/share/nginx/html/api/app/middleware/validation.js:27:9 at Layer.handle [as handle_request] (/usr/share/nginx/html/api/node_modules/express/lib/router/layer.js:95:5) <ref *1> CloverConnector { cardEntryMethods: 34567, logger: Logger { _events: [Object: null prototype] { log: [Function: toConsole] }, _eventsCount: 1, _maxListeners: undefined, enabled: false, silly: [Function: bound emit], verbose: [Function: bound emit], info: [Function: bound emit], warn: [Function: bound emit], error: [Function: bound emit], debug: [Function: bound emit], [Symbol(kCapture)]: false }, broadcaster: CloverConnectorBroadcaster { logger: Logger { _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, enabled: false, silly: [Function: bound emit], verbose: [Function: bound emit], info: [Function: bound emit], warn: [Function: bound emit], error: [Function: bound emit], debug: [Function: bound emit], [Symbol(kCapture)]: false }, listeners: [ [Object] ] }, isReady: false, configuration: WebSocketCloudCloverDeviceConfiguration { logger: Logger { _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, enabled: false, silly: [Function: bound emit], verbose: [Function: bound emit], info: [Function: bound emit], warn: [Function: bound emit], error: [Function: bound emit], debug: [Function: bound emit], [Symbol(kCapture)]: false }, maxCharInMessage: 50000, imageUtil: ImageUtil {}, appId: '146WTJY2DVZM6.JAT1VN0J32R6W', webSocketImplClass: [Function (anonymous)], heartbeatInterval: -1, reconnectDelay: 3000, heartbeatDisconnectTimeout: 3000, cloverServer: 'https://sandbox.dev.clover.com', accessToken: '', httpSupport: null, merchantId: '', deviceId: '', friendlyId: '', forceConnect: false }, deviceObserver: InnerDeviceObserver { logger: Logger { _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, enabled: false, silly: [Function: bound emit], verbose: [Function: bound emit], info: [Function: bound emit], warn: [Function: bound emit], error: [Function: bound emit], debug: [Function: bound emit], [Symbol(kCapture)]: false }, cloverConnector: [Circular *1] }, device: null }