From 2c6f505d00e4d6f427fb9692e1121e392568cb25 Mon Sep 17 00:00:00 2001 From: sHesl Date: Wed, 18 Jul 2018 09:23:31 +0100 Subject: [PATCH] Add tempCustomerId and trackLogout func --- ravelin.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ravelin.js b/ravelin.js index df01c8c..2a92421 100644 --- a/ravelin.js +++ b/ravelin.js @@ -925,6 +925,15 @@ this._ravelin(['trackPage'].concat(Array.prototype.slice.call(arguments, 0))); } + /** + * trackLogout informs Ravelin of logout events and resets the associated customerId and tempCustomerId. + * + * @param {Object} meta Any additional metadata you wish to use to describe the event. + */ + RavelinJS.prototype.trackLogout = function() { + this._ravelin(['trackLogout'].concat(Array.prototype.slice.call(arguments, 0))); + } + /** * trackFingerprint sends device information back to Ravelin. Invoke from * the checkout page of your payment flow. @@ -962,10 +971,20 @@ * @param {String} customerId */ RavelinJS.prototype.setCustomerId = function() { - console.info('what?') this._ravelin(['setCustomerId'].concat(Array.prototype.slice.call(arguments, 0))); } + /** + * Set the tempCustomerId submitted with requests. This is used as a temporary association between device/ + * session data and a user, and should be followed with a v2/login request to Ravelin as soon as a + * customerId is available + * + * @param {String} customerId + */ + RavelinJS.prototype.setTempCustomerId = function() { + this._ravelin(['setTempCustomerId'].concat(Array.prototype.slice.call(arguments, 0))); + } + /** * Set the orderId submitted with requests. This is used to associate session-activity * with a specific user.