Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request Modules/paymentwall-node!3
  • Loading branch information
Vladimir Kovalyov committed Jul 20, 2022
2 parents 60eeb04 + 152467d commit 026a18d
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 56 deletions.
Binary file removed .DS_Store
Binary file not shown.
Binary file removed features/.DS_Store
Binary file not shown.
46 changes: 22 additions & 24 deletions features/widget.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Scenario: check Digital Goods widget signature v2 with correct secret key
Given Public key "c22f895840bf2391f67a40da64bfed26"
And Secret key "a7408723eaf4bfa2e3ac49b3cb695046"
And API type "2"
And Widget signature version "2"
And Widget signature version "2"
And Product name "Automatic Test Product Name"
When Widget is constructed
When Widget is constructed
And Widget HTML content is loaded
Then Widget HTML content should not contain "It looks like you're not authorized to view this content."
And Widget HTML content should contain "Automatic Test Product Name"
Expand All @@ -18,54 +18,54 @@ Scenario: check Digital Goods widget signature v2 with wrong secret key
Given Public key "c22f895840bf2391f67a40da64bfed26"
And Secret key "000"
And API type "2"
And Widget signature version "2"
When Widget is constructed
And Widget signature version "2"
When Widget is constructed
And Widget HTML content is loaded
Then Widget HTML content should contain "It looks like you're not authorized to view this content."

Scenario: check Digital Goods widget signature v1 with correct secret key
Given Public key "c22f895840bf2391f67a40da64bfed26"
And Secret key "a7408723eaf4bfa2e3ac49b3cb695046"
And API type "2"
And Widget signature version "1"
When Widget is constructed
And Widget signature version "1"
When Widget is constructed
And Widget HTML content is loaded
Then Widget HTML content should not contain "It looks like you're not authorized to view this content."

Scenario: check Digital Goods widget signature v1 with wrong secret key
Given Public key "c22f895840bf2391f67a40da64bfed26"
And Secret key "000"
And API type "2"
And Widget signature version "1"
When Widget is constructed
And Widget signature version "1"
When Widget is constructed
And Widget HTML content is loaded
Then Widget HTML content should contain "It looks like you're not authorized to view this content."

Scenario: check Digital Goods widget signature v3 with correct secret key
Given Public key "c22f895840bf2391f67a40da64bfed26"
And Secret key "a7408723eaf4bfa2e3ac49b3cb695046"
And API type "2"
And Widget signature version "3"
When Widget is constructed
And Widget signature version "3"
When Widget is constructed
And Widget HTML content is loaded
Then Widget HTML content should not contain "It looks like you're not authorized to view this content."

Scenario: check Digital Goods widget signature v3 with wrong secret key
Given Public key "c22f895840bf2391f67a40da64bfed26"
And Secret key "000"
And API type "2"
And Widget signature version "3"
When Widget is constructed
And Widget signature version "3"
When Widget is constructed
And Widget HTML content is loaded
Then Widget HTML content should contain "It looks like you're not authorized to view this content."

Scenario: check Digital Goods widget signature v3 with wrong secret key
Given Public key "c22f895840bf2391f67a40da64bfed26"
And Secret key "a7408723eaf4bfa2e3ac49b3cb695046"
And API type "2"
And Widget signature version "3"
And Widget signature version "3"
And Product name "Automatic Test Product Name"
When Widget is constructed
When Widget is constructed
And Widget HTML content is loaded
Then Widget HTML content should not contain "It looks like you're not authorized to view this content."
And Widget HTML content should contain "Automatic Test Product Name"
Expand All @@ -74,23 +74,22 @@ Scenario: check Virtual Currency offer widget signature v2 with correct secret k
Given Public key "c10c60d07a2f4549a17902d683eb0b11"
And Secret key "6274def95b105f1c92d341a8d3bc2e77"
And API type "1"
And Widget signature version "2"
And Widget code "w1"
And Language code "en"
When Widget is constructed
And Widget signature version "2"
And Widget code "w1"
And Language code "en"
When Widget is constructed
And Widget HTML content is loaded
Then Widget URL should contain "/api/?"
And Widget HTML content should not contain "It looks like you're not authorized to view this content."
And Widget HTML content should contain "by completing offers below"

Scenario: check Virtual Currency payment widget signature v2 with correct secret key
Given Public key "c10c60d07a2f4549a17902d683eb0b11"
And Secret key "6274def95b105f1c92d341a8d3bc2e77"
And API type "1"
And Widget signature version "2"
And Widget code "p10"
And Language code "en"
When Widget is constructed
And Widget code "p10"
And Language code "en"
When Widget is constructed
And Widget HTML content is loaded
Then Widget URL should contain "/api/ps?"
And Widget HTML content should not contain "It looks like you're not authorized to view this content."
Expand All @@ -101,7 +100,6 @@ Scenario: check Virtual Currency widget signature v2 with wrong secret key
And Secret key "000"
And API type "1"
And Widget signature version "2"
When Widget is constructed
When Widget is constructed
And Widget HTML content is loaded
Then Widget HTML content should contain "It looks like you're not authorized to view this content."

Binary file removed lib/.DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions lib/ApiObject.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict';

var Base = require('./Base'),
util = require('util'),
inherits = require('inherits'),
querystring = require('querystring');

function ApiObject() {
}

util.inherits(ApiObject, Base);
inherits(ApiObject, Base);

util._extend(ApiObject.prototype, {
Object.assign(ApiObject.prototype, {

checkProjectEnv: function(){
var reg = /_+/;
Expand Down
10 changes: 5 additions & 5 deletions lib/Base.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var util = require('util');
var inherits = require('inherits');
var Config = require('./Config');

Base.API_VC = 1;
Expand All @@ -10,9 +10,9 @@ Base.API_CART = 3;
function Base() {
}

util.inherits(Base, Config);
inherits(Base, Config);

util._extend(Base.prototype, {
Object.assign(Base.prototype, {

getApiType: function() {
return this.apiType;
Expand All @@ -30,7 +30,7 @@ util._extend(Base.prototype, {
for (var x in b) a[x] = b[x];
return a;
},

appendToErrors: function(err) {
return this.errors.push(err);
},
Expand All @@ -43,4 +43,4 @@ util._extend(Base.prototype, {
return this.getErrors().join("\n");
}
});
module.exports = Base;
module.exports = Base;
6 changes: 3 additions & 3 deletions lib/Charge.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var HttpAction = require('./HttpAction'),
ApiObject = require('./ApiObject'),
util = require('util'),
inherits = require('inherits'),
querystring = require('querystring');

function Charge(amount,currency,description,email,fingerprint,token,extra){
Expand All @@ -15,9 +15,9 @@ function Charge(amount,currency,description,email,fingerprint,token,extra){
this.extra = extra||null;
}

util.inherits(Charge, ApiObject);
inherits(Charge, ApiObject);

util._extend(Charge.prototype, {
Object.assign(Charge.prototype, {

createCharge: function(callback){
//set the post data
Expand Down
8 changes: 4 additions & 4 deletions lib/Onetimetoken.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
var ApiObject = require('./ApiObject'),
Card = require('./Card'),
HttpAction = require('./HttpAction'),
util = require('util'),
inherits = require('inherits'),
querystring = require('querystring');

function Onetimetoken(number,exp_month,exp_year,cvv){
this.card = new Card(number,exp_month,exp_year,cvv);
}

util.inherits(Onetimetoken, ApiObject);
inherits(Onetimetoken, ApiObject);

Object.assign(Onetimetoken.prototype, {

util._extend(Onetimetoken.prototype, {

createOnetimetoken: function(callback){
//set the post data
var post_data = {
Expand Down
6 changes: 3 additions & 3 deletions lib/Pingback.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var Base = require('./Base'),
Product = require('./Product'),
util = require('util'),
inherits = require('inherits'),
Signature = require('./Signature/Pingback'),
querystring = require('querystring');

Expand All @@ -25,9 +25,9 @@ function Pingback(parameters, ipAddress, pingbackForBrick) {
this.pingbackForBrick = pingbackForBrick||false;
}

util.inherits(Pingback, Base);
inherits(Pingback, Base);

util._extend(Pingback.prototype, {
Object.assign(Pingback.prototype, {

validate: function(skipIpWhitelistCheck) {
var pingbackForBrick = this.pingbackForBrick;
Expand Down
10 changes: 5 additions & 5 deletions lib/Subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var HttpAction = require('./HttpAction'),
ApiObject = require('./ApiObject'),
util = require('util'),
inherits = require('inherits'),
querystring = require('querystring');

function Subscription(amount,currency,description,email,fingerprint,token,period,period_duration,trial_data,extra){
Expand All @@ -18,9 +18,9 @@ function Subscription(amount,currency,description,email,fingerprint,token,period
this.extra = extra||null;
}

util.inherits(Subscription, ApiObject);
inherits(Subscription, ApiObject);

util._extend(Subscription.prototype, {
Object.assign(Subscription.prototype, {

createSubscription: function(callback){
//set the post data
Expand Down Expand Up @@ -58,7 +58,7 @@ util._extend(Subscription.prototype, {
default: console.log('Parameter error in subscription.otherOperation');
break;
}

var post_options = this.createRequest('subscription', additional_path);
HttpAction.runAction(post_options, post_data, true, function(data){
callback(data);
Expand All @@ -67,4 +67,4 @@ util._extend(Subscription.prototype, {
}
});

module.exports = Subscription;
module.exports = Subscription;
6 changes: 3 additions & 3 deletions lib/Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var Base = require('./Base'),
Product = require('./Product'),
util = require('util'),
inherits = require('inherits'),
querystring = require('querystring'),
Signature = require('./Signature/Widget');

Expand All @@ -14,8 +14,8 @@ function Widget(userId, widgetCode, products, extraParams) {
this.extraParams = extraParams || null;
}

util.inherits(Widget, Base);
util._extend(Widget.prototype, {
inherits(Widget, Base);
Object.assign(Widget.prototype, {

getDefaultWidgetSignature: function() {
return this.getApiType() !== this.API_CART ? this.DEFAULT_SIGNATURE_VERSION : this.SIGNATURE_VERSION_2;
Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "paymentwall",
"version": "1.2.4",
"version": "2.0.0",
"author": "Paymentwall Team <[email protected]>",
"description": "Paymentwall Node.js Library",
"main": "./index",
Expand All @@ -13,7 +13,7 @@
},
"bugs": {
"url": "https://github.com/paymentwall/paymentwall-node/issues"
},
},
"keywords": [
"payments",
"paymentwall",
Expand All @@ -27,11 +27,14 @@
"cucumber"
],
"devDependencies": {
"cucumber": "1.*",
"chai": "*",
"request": "*",
"cheerio": "*"
"cheerio": "*",
"cucumber": "1.*",
"request": "*"
},
"license": "MIT",
"homepage": "http://www.paymentwall.com"
"homepage": "http://www.paymentwall.com",
"dependencies": {
"inherits": "^2.0.4"
}
}

0 comments on commit 026a18d

Please sign in to comment.