@assemblypayments/spi-client-js
Advanced tools
Comparing version 2.0.3 to 2.0.4
{ | ||
"name": "@assemblypayments/spi-client-js", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "JavaScript Client Library for Assembly Payments' In-Store Integration.", | ||
@@ -5,0 +5,0 @@ "main": "karma.conf.js", |
@@ -5,2 +5,32 @@ # SPI Client JavaScript | ||
# Setup | ||
Below are basic instructions on how to run the library for development. If all you want to do is use the library in your project, just import [@assemblypayments/spi-client-js](https://www.npmjs.com/package/@assemblypayments/spi-client-js) from npm. | ||
## Building | ||
To download the dependencies and install the package, run the following: | ||
``` | ||
npm install | ||
``` | ||
## Testing | ||
To run a suite of unit tests configured in `karma.conf.js`, run the following: | ||
``` | ||
npm test | ||
``` | ||
## Creating a distribution | ||
To create a distribution, run the following: | ||
``` | ||
npm run transpile | ||
``` | ||
This will update the `dist/spi-client.js.js` file used for the npm package. | ||
# Disclaimer | ||
@@ -7,0 +37,0 @@ |
@@ -127,3 +127,12 @@ /// <summary> | ||
let now = Date.now(); | ||
let msgTime = Date.parse(this.DateTimeStamp); | ||
// Stamp format: 2018-04-19T01:42:38.279 | ||
let dts = this.DateTimeStamp.split(/[\-\+\. :T]/); | ||
let msgTime = new Date( | ||
// year, month, date | ||
dts[0], dts[1] - 1, dts[2], | ||
// hour, minute, second, millis | ||
dts[3], dts[4], dts[5], dts[6] | ||
).getTime(); // Local time zone | ||
return msgTime - now; | ||
@@ -143,3 +152,3 @@ } | ||
let sig = Crypto.HmacSignature(secrets.HmacKey, env.enc); | ||
if(sig.toUpperCase() != env.hmac) { | ||
if (sig.toUpperCase() != env.hmac) { | ||
return new Message("_", Events.InvalidHmacSignature, null, false); | ||
@@ -169,3 +178,4 @@ } | ||
let now = Date.now(); | ||
let adjustedTime = new Date(now + stamp.ServerTimeDelta); | ||
let tzoffset = new Date().getTimezoneOffset() * 60 * 1000; | ||
let adjustedTime = new Date(now - tzoffset + stamp.ServerTimeDelta); | ||
@@ -172,0 +182,0 @@ // Format date: "yyyy-MM-ddTHH:mm:ss.fff" |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
220205
4690
41