question

demskigroup avatar image
demskigroup asked David Marginian Deactivated commented

Remote Pay Cloud getting a postData null error

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
}


Remote Pay Cloud
3 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image David Marginian ♦♦ commented ·

Don't post credentials (sandbox or not) in a public forum.

0 Likes 0 ·
demskigroup avatar image demskigroup David Marginian ♦♦ commented ·

I've edited the post

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ demskigroup commented ·

Thanks, take a look at the example.

0 Likes 0 ·

1 Answer

·
David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated commented
4 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

demskigroup avatar image demskigroup commented ·

This is a client side sample only, is it possible to connect the sdk on the server side and run it?

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ demskigroup commented ·

Sorry, it wasn't clear you were running this outside of the browser. If you intend to run outside of the browser please see the notes here - https://github.com/clover/remote-pay-cloud-examples/tree/master/remote-pay-cloud-nodejs-example#implementation-notes.

0 Likes 0 ·
demskigroup avatar image demskigroup David Marginian ♦♦ commented ·

I was able to get this working, thanks. The issue is though I cannot get all the statuses that are returned with the same browser sdk. Any ideas there?

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community