Comparing version 1.1.0 to 1.2.0
'use strict'; | ||
var | ||
HPP = require('./HPP'), | ||
ValidateHPP = require('./ValidateHPP'); | ||
var HPP = require('./HPP'); | ||
var ValidateHPP = require('./ValidateHPP'); | ||
module.exports.HPP = HPP; | ||
module.exports.ValidateHPP = ValidateHPP; | ||
module.exports.ValidateHPP = ValidateHPP; |
@@ -5,8 +5,6 @@ 'use strict'; | ||
var | ||
crypto = require('crypto'), | ||
zlib = require('zlib'), | ||
moment = require('moment'); | ||
var crypto = require('crypto'); | ||
var zlib = require('zlib'); | ||
var moment = require('moment'); | ||
var HPP = function (options) { | ||
@@ -22,3 +20,4 @@ | ||
// paymentAmount | ||
if (!options.paymentAmount || isNaN(options.paymentAmount)) { | ||
// can be 0 as zero value payments can be used for initial payments to setup recurring contracts | ||
if (isNaN(options.paymentAmount)) { | ||
throw new Error('paymentAmount is required and have to be a Number'); | ||
@@ -62,3 +61,4 @@ } | ||
merchantReference: options.merchantReference || 'PAYMENT-' + moment().format('YYYY-MM-DDThh:mm:ssZ'), // The merchant reference is your reference for the payment | ||
paymentAmount: options.paymentAmount, // Amount specified in minor units EUR 1,00 = 100 | ||
// if paymentAmount is 0 this will cast it into a string to ensure that it is never mistakenly handled as false | ||
paymentAmount: options.paymentAmount || '0', // Amount specified in minor units EUR 1,00 = 100 | ||
currencyCode: options.currencyCode || 'EUR', // The three-letter capitalised ISO currency code to pay in i.e. EUR | ||
@@ -68,5 +68,6 @@ shipBeforeDate: options.shipBeforeDate || moment().format('YYYY-MM-DD'), // The date by which the goods or services are shipped. Format: YYYY-MM-DD | ||
merchantAccount: options.merchantAccount, // The merchant account you want to process this payment with. | ||
sessionValidity: options.sessionValidity || moment().add('days', 1).format('YYYY-MM-DDThh:mm:ssZ'), // The final time by which a payment needs to have been made. Format: YYYY-MM-DDThh:mm:ssZ | ||
sessionValidity: options.sessionValidity || moment().add(1, 'days').format('YYYY-MM-DDThh:mm:ssZ'), // The final time by which a payment needs to have been made. Format: YYYY-MM-DDThh:mm:ssZ | ||
// Optionals for payment | ||
recurringContract: options.recurringContract || null, // For recurring payments (see Adyen documentation) | ||
shopperLocale: options.shopperLocale || 'en_US', // A combination of language code and country code to specify the language used in the session i.e. en_GB. | ||
@@ -94,6 +95,5 @@ orderData: null, // A fragment of HTML/text that will be displayed on the HPP (optional) | ||
HPP.prototype.generateHash = function () { | ||
var | ||
hmac, | ||
hmacText, | ||
key; | ||
var hmac; | ||
var hmacText; | ||
var key; | ||
@@ -119,2 +119,3 @@ for (key in this._request) { | ||
hmacText += this._request.shopperReference || ''; | ||
hmacText += this._request.recurringContract || ''; | ||
hmacText += this._request.allowedMethods || ''; | ||
@@ -133,5 +134,4 @@ hmacText += this._request.blockedMethods || ''; | ||
HPP.prototype.generateRequest = function (callback) { | ||
var | ||
requestUrl = this._url, | ||
_this = this; | ||
var requestUrl = this._url; | ||
var _this = this; | ||
@@ -138,0 +138,0 @@ // Gzip encode |
@@ -5,8 +5,5 @@ 'use strict'; | ||
var | ||
crypto = require('crypto'), | ||
var crypto = require('crypto'); | ||
var ACCEPTED_AUTH_RESULTS = ['AUTHORISED', 'REFUSED', 'CANCELLED', 'PENDING', 'ERROR']; | ||
ACCEPTED_AUTH_RESULTS = ['AUTHORISED', 'REFUSED', 'CANCELLED', 'PENDING', 'ERROR']; | ||
var Validate = function (options) { | ||
@@ -70,5 +67,4 @@ | ||
Validate.prototype.generatePaymentHash = function () { | ||
var | ||
hmac, | ||
hmacText; | ||
var hmac; | ||
var hmacText; | ||
@@ -93,3 +89,2 @@ hmacText = | ||
module.exports = Validate; | ||
module.exports = Validate; |
{ | ||
"name": "adyen", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "NodeJS module for the Adyen payment provider", | ||
@@ -14,9 +14,8 @@ "main": "./lib/adyen", | ||
"dependencies": { | ||
"moment": "~2.5.1" | ||
"moment": "~2.10.3" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~1.17.1", | ||
"chai": "~1.8.1", | ||
"request": "~2.33.0" | ||
"mocha": "~2.2.5", | ||
"chai": "~3.0.0" | ||
} | ||
} |
@@ -41,2 +41,3 @@ adyen | ||
// Optional for the payment | ||
recurringContract: 'RECURRING', // For recurring payments (see Adyen documentation) | ||
shopperLocale: 'nl_NL', // optional: 'en_US' | ||
@@ -43,0 +44,0 @@ orderData: 'XY 1 year subscription', // optional |
13956
2
105
+ Addedmoment@2.10.6(transitive)
- Removedmoment@2.5.1(transitive)
Updatedmoment@~2.10.3