diff --git a/e2e-test/test/templates.js b/e2e-test/test/001_templates.js
similarity index 84%
rename from e2e-test/test/templates.js
rename to e2e-test/test/001_templates.js
index 54cb237..3a222ca 100644
--- a/e2e-test/test/templates.js
+++ b/e2e-test/test/001_templates.js
@@ -12,7 +12,12 @@ const TEMPLATE_ID = "test-templ-id";
const TEMPLATE = "rule:amount_test:amount() >= 20 -> decline;";
const PARTY_ID = "partyTest";
const SHOP_ID = "shopTest";
+const EMAIL = "test@mail.ru";
+
+const IP = "123.123.123.123";
+const FINGERPRINT = "xxxxx";
+const CARD_TOKEN = "4J8vmnlYPwzYzia74fny81";
describe('Test for simple rule inspection', function () {
this.timeout(testTimeout);
@@ -38,12 +43,14 @@ describe('Test for simple rule inspection', function () {
res.should.have.status(200);
res.should.be.json;
res.body.should.be.a("object");
+ res.body.should.have.property("result");
res.body.result.length.should.be.eql(1);
res.body.result.should.does.include(PARTY_ID + "_" + SHOP_ID);
}, PARTY_ID, SHOP_ID, TEMPLATE_ID);
});
it('it should inspect that payment have FATAL risk', function (done) {
+ let exceedAmount = 100;
inspectorService.inspectPayment(done,
(res) => {
res.should.have.status(200);
@@ -52,16 +59,17 @@ describe('Test for simple rule inspection', function () {
res.body.should.have.property("result");
res.body.result.should.equal('fatal');
},
- "test@mail.ru",
- "123.123.123.123",
- "xxxxx",
- "4J8vmnlYPwzYzia74fny81",
+ EMAIL,
+ IP,
+ FINGERPRINT,
+ CARD_TOKEN,
PARTY_ID,
SHOP_ID,
- 100);
+ exceedAmount);
});
it('it should inspect that payment have default HIGH risk', function (done) {
+ let acceptableAmount = 10;
inspectorService.inspectPayment(done,
(res) => {
res.should.have.status(200);
@@ -70,12 +78,12 @@ describe('Test for simple rule inspection', function () {
res.body.should.have.property("result");
res.body.result.should.equal('high');
},
- "test@mail.ru",
- "123.123.123.123",
- "xxxxx",
- "4J8vmnlYPwzYzia74fny81",
+ EMAIL,
+ IP,
+ FINGERPRINT,
+ CARD_TOKEN,
PARTY_ID,
SHOP_ID,
- 10);
+ acceptableAmount);
});
});
diff --git a/e2e-test/test/aggregates.js b/e2e-test/test/002_aggregates.js
similarity index 100%
rename from e2e-test/test/aggregates.js
rename to e2e-test/test/002_aggregates.js
diff --git a/e2e-test/test/columbus.js b/e2e-test/test/003_columbus.js
similarity index 100%
rename from e2e-test/test/columbus.js
rename to e2e-test/test/003_columbus.js
diff --git a/e2e-test/test/trusted_tokens.js b/e2e-test/test/004_trusted_tokens.js
similarity index 100%
rename from e2e-test/test/trusted_tokens.js
rename to e2e-test/test/004_trusted_tokens.js
diff --git a/e2e-test/test/white_black_lists.js b/e2e-test/test/005_white_black_lists.js
similarity index 80%
rename from e2e-test/test/white_black_lists.js
rename to e2e-test/test/005_white_black_lists.js
index 1a5679b..6667980 100644
--- a/e2e-test/test/white_black_lists.js
+++ b/e2e-test/test/005_white_black_lists.js
@@ -1,16 +1,13 @@
const chai = require("chai");
const chaiHttp = require("chai-http");
-const should = chai.should();
chai.use(chaiHttp);
const config = require("../config");
const templateService = require("./service/template_service.js");
const inspectorService = require("./service/inspector_service.js");
const listsService = require("./service/wb_list_service.js");
const paymentService = require("./service/payment_service.js");
-
-const FB_MGMNT_URL = config.fbManagement.url;
-
-const GROUP_PATH = config.fbManagement.groupPath;
+const listGroupService = require("./service/list_group_service.js");
+const referenceService = require('./service/reference_service.js');
const testTimeout = config.testTimeout;
const IN_WHITE_lIST_TEMPLATE_ID = "white-list-template-id";
@@ -24,6 +21,8 @@ const IN_WHITE_LIST_TEMPLATE = "rule: inWhiteList(\"email\") -> accept;";
const IN_GREY_LIST_TEMPLATE = "rule: inGreyList(\"card_token\") -> accept;";
const IN_BLACK_LIST_TEMPLATE = "rule: inBlackList(\"card_token\") -> decline;"
const CARD_TOKEN = "wb_test_token_";
+const IP = "123.123.123.123";
+const FINGERPRINT = "xxxxx";
function generateCardToken() {
return CARD_TOKEN + Math.floor(Math.random() * 999);
@@ -93,63 +92,27 @@ describe('Test for check white, black and grey tokens', function () {
});
it('it should create a new group for list templates', function (done) {
- let TEST_GROUP = {
- groupId: GROUP_ID,
- modifiedByUser: "test-user",
- priorityTemplates: [
- {
- id: IN_WHITE_lIST_TEMPLATE_ID,
- lastUpdateTime: "2019-08-24T14:15:22Z",
- priority: 0
- },
- {
- id: IN_GREY_LIST_TEMPLATE_ID,
- lastUpdateTime: "2019-08-24T14:15:22Z",
- priority: 2
- },
- {
- id: IN_BLACK_LIST_TEMPLATE_ID,
- lastUpdateTime: "2019-08-24T14:15:22Z",
- priority: 1
- }]
- };
- chai.request(FB_MGMNT_URL)
- .post(GROUP_PATH)
- .send(TEST_GROUP)
- .end(function (err) {
- if (err) {
- console.log(err.text);
- done(err);
- }
+ listGroupService.create(done,
+ GROUP_ID,
+ IN_WHITE_lIST_TEMPLATE_ID,
+ IN_GREY_LIST_TEMPLATE_ID,
+ IN_BLACK_LIST_TEMPLATE_ID);
- done();
- });
});
it('it should create a new reference for group', function (done) {
- let TEST_GROUP = [{
- groupId: GROUP_ID,
- id: GROUP_REFERENCE_ID,
- lastUpdateDate: "2022-04-15T10:30:30",
- modifiedByUser: "test-user",
- shopId: SHOP_ID,
- partyId: PARTY_ID
- }];
- chai.request(FB_MGMNT_URL)
- .post(GROUP_PATH + '/' + GROUP_ID + '/references')
- .send(TEST_GROUP)
- .end(function (err, res) {
- if (err) {
- console.log(err.text);
- done(err);
- }
- should.not.exist(err);
+ referenceService.createGroup(done,
+ (res) => {
res.should.have.status(200);
res.should.be.json;
- done()
- });
+ },
+ GROUP_ID,
+ GROUP_REFERENCE_ID,
+ SHOP_ID,
+ PARTY_ID);
+
});
let cardToken = generateCardToken();
@@ -164,8 +127,8 @@ describe('Test for check white, black and grey tokens', function () {
res.body.result.should.equal('high');
},
EMAIL,
- "123.123.123.123",
- "xxxxx",
+ IP,
+ FINGERPRINT,
cardToken,
PARTY_ID,
SHOP_ID,
@@ -198,8 +161,8 @@ describe('Test for check white, black and grey tokens', function () {
res.body.result.should.equal('low');
},
EMAIL,
- "123.123.123.123",
- "xxxxx",
+ IP,
+ FINGERPRINT,
cardToken,
PARTY_ID,
SHOP_ID,
@@ -224,7 +187,7 @@ describe('Test for check white, black and grey tokens', function () {
SHOP_ID,
cardToken,
{
- "count": 0,
+ "count": 1,
"endCountTime": getNowDatePlusOneDay().toJSON(),
"startCountTime": (new Date()).toJSON()
});
@@ -240,8 +203,8 @@ describe('Test for check white, black and grey tokens', function () {
res.body.result.should.equal('low');
},
EMAIL + 'x',
- "123.123.123.123",
- "xxxxx",
+ IP,
+ FINGERPRINT,
cardToken,
PARTY_ID,
SHOP_ID,
@@ -255,9 +218,9 @@ describe('Test for check white, black and grey tokens', function () {
},
"captured",
EMAIL + 'x',
- "123.123.123.123",
+ IP,
cardToken,
- "xxxxx",
+ FINGERPRINT,
PARTY_ID,
SHOP_ID,
"invoice_id_1.1");
@@ -289,8 +252,8 @@ describe('Test for check white, black and grey tokens', function () {
res.body.result.should.equal('fatal');
},
EMAIL + 'x',
- "123.123.123.123",
- "xxxxx",
+ IP,
+ FINGERPRINT,
cardToken,
PARTY_ID,
SHOP_ID,
diff --git a/e2e-test/test/factory/payment_factory.js b/e2e-test/test/factory/payment_factory.js
index f1171a5..217717a 100644
--- a/e2e-test/test/factory/payment_factory.js
+++ b/e2e-test/test/factory/payment_factory.js
@@ -1,12 +1,12 @@
const CARD_TOKEN = "aggr_test_token";
const IP = "192.1.1.1";
const EMAIL = "test_unique@vality.dev";
-const PAYMENT_ID = "payment_id";
+const paymentId = Math.floor(Math.random() * 999);
module.exports.create =
function (id, ip, email, fingerprint, cardToken, partyId, shopId, amount, currency) {
return {
- id: id || PAYMENT_ID,
+ id: id || paymentId,
customer: {
name: "Test Test",
device: {
diff --git a/e2e-test/test/service/inspector_service.js b/e2e-test/test/service/inspector_service.js
index 6e6789b..148b0d2 100644
--- a/e2e-test/test/service/inspector_service.js
+++ b/e2e-test/test/service/inspector_service.js
@@ -10,9 +10,10 @@ const INSPECT_PATH = config.fbApi.inspectPath;
module.exports.inspectPayment =
function (done, checkResponse, email, ip, fingerprint, cardToken, partyId, shopId, amount, currency) {
+ let id = Math.floor(Math.random() * 999);
let TEST_INSPECTOR_PAYMENT_REQ_HIGH = {
payment: paymentFactory.create(
- "payment_id",
+ id,
ip,
email,
fingerprint,
diff --git a/e2e-test/test/service/list_group_service.js b/e2e-test/test/service/list_group_service.js
new file mode 100644
index 0000000..8bda519
--- /dev/null
+++ b/e2e-test/test/service/list_group_service.js
@@ -0,0 +1,43 @@
+const chai = require("chai");
+const config = require("../../config");
+const chaiHttp = require("chai-http");
+chai.use(chaiHttp);
+
+const GROUP_PATH = config.fbManagement.groupPath;
+const FB_MGMNT_URL = config.fbManagement.url;
+
+module.exports.create = function (done, groupId, whiteListTemplateId, greyListTemplateId, blackListTemplateId) {
+
+ let TEST_GROUP = {
+ groupId: groupId,
+ modifiedByUser: "test-user",
+ priorityTemplates: [
+ {
+ id: whiteListTemplateId,
+ lastUpdateTime: "2019-08-24T14:15:22Z",
+ priority: 0
+ },
+ {
+ id: greyListTemplateId,
+ lastUpdateTime: "2019-08-24T14:15:22Z",
+ priority: 2
+ },
+ {
+ id: blackListTemplateId,
+ lastUpdateTime: "2019-08-24T14:15:22Z",
+ priority: 1
+ }]
+ };
+
+ chai.request(FB_MGMNT_URL)
+ .post(GROUP_PATH)
+ .send(TEST_GROUP)
+ .end(function (err) {
+ if (err) {
+ console.log(err.text);
+ done(err);
+ }
+
+ done()
+ });
+}
\ No newline at end of file
diff --git a/e2e-test/test/service/reference_service.js b/e2e-test/test/service/reference_service.js
index 2162281..420b33c 100644
--- a/e2e-test/test/service/reference_service.js
+++ b/e2e-test/test/service/reference_service.js
@@ -5,6 +5,7 @@ const should = chai.should();
chai.use(chaiHttp);
const REFERENCE_PATH = config.fbManagement.referencePath;
+const GROUP_PATH = config.fbManagement.groupPath;
const FB_MGMNT_URL = config.fbManagement.url;
module.exports.create = function (done, checkResponse, partyId, shopId, templateId) {
@@ -31,4 +32,28 @@ module.exports.create = function (done, checkResponse, partyId, shopId, template
checkResponse(res);
done()
});
+}
+
+module.exports.createGroup = function (done, checkResponse, groupId, groupReferenceId, shopId, partyId) {
+ let TEST_GROUP = [{
+ groupId: groupId,
+ id: groupReferenceId,
+ lastUpdateDate: "2022-04-15T10:30:30",
+ modifiedByUser: "test-user",
+ shopId: shopId,
+ partyId: partyId
+ }];
+
+ chai.request(FB_MGMNT_URL)
+ .post(GROUP_PATH + '/' + groupId + '/references')
+ .send(TEST_GROUP)
+ .end(function (err, res) {
+ if (err) {
+ console.log(err.text);
+ done(err);
+ }
+ should.not.exist(err);
+ checkResponse(res);
+ done()
+ });
}
\ No newline at end of file
diff --git a/log-java/logback-test.xml b/log-java/logback-test.xml
index a762615..ad43e95 100644
--- a/log-java/logback-test.xml
+++ b/log-java/logback-test.xml
@@ -6,7 +6,7 @@
-
+