From 8286be4e4b54d05e3f624b1c327e5b9810844473 Mon Sep 17 00:00:00 2001 From: goga-m Date: Mon, 14 Aug 2017 20:17:08 +0300 Subject: [PATCH 1/3] Insert anonymous customer as default reference for cach_in_txs & cash_out_txs tables --- lib/constants.js | 6 ++++++ migrations/036-add_customers_table.js | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 lib/constants.js diff --git a/lib/constants.js b/lib/constants.js new file mode 100644 index 00000000..e7cff197 --- /dev/null +++ b/lib/constants.js @@ -0,0 +1,6 @@ +const anonymous_customer = { + uuid : '47ac1184-8102-11e7-9079-8f13a7117867', + name: 'anonymous', +} + +module.exports = {anonymous_customer} diff --git a/migrations/036-add_customers_table.js b/migrations/036-add_customers_table.js index 445e9223..4202914f 100644 --- a/migrations/036-add_customers_table.js +++ b/migrations/036-add_customers_table.js @@ -1,4 +1,5 @@ var db = require('./db') +var anonymous = require('../lib/constants').anonymous_customer exports.up = function(next) { const sql = @@ -20,8 +21,9 @@ exports.up = function(next) { id_card_image_path text, id_card_image_at timestamptz, created timestamptz NOT NULL DEFAULT now() )`, - `alter table cash_in_txs add column customer_id uuid references customers (id)`, - `alter table cash_out_txs add column customer_id uuid references customers (id)` + `insert into customers (id, name) VALUES ( '${anonymous.uuid}','${anonymous.name}' )`, + `alter table cash_in_txs add column customer_id uuid references customers (id) DEFAULT '${anonymous.uuid}'`, + `alter table cash_out_txs add column customer_id uuid references customers (id) DEFAULT '${anonymous.uuid}'`, ] db.multi(sql, next) From a0e63f8405eabc8d288ad0cc84429e701156eb8e Mon Sep 17 00:00:00 2001 From: goga-m Date: Tue, 15 Aug 2017 12:23:10 +0300 Subject: [PATCH 2/3] Naming corrections --- lib/constants.js | 2 +- migrations/036-add_customers_table.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/constants.js b/lib/constants.js index e7cff197..e1c23873 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -1,4 +1,4 @@ -const anonymous_customer = { +const anonymousCustomer = { uuid : '47ac1184-8102-11e7-9079-8f13a7117867', name: 'anonymous', } diff --git a/migrations/036-add_customers_table.js b/migrations/036-add_customers_table.js index 4202914f..70ebcba5 100644 --- a/migrations/036-add_customers_table.js +++ b/migrations/036-add_customers_table.js @@ -1,5 +1,5 @@ var db = require('./db') -var anonymous = require('../lib/constants').anonymous_customer +var anonymous = require('../lib/constants').anonymousCustomer exports.up = function(next) { const sql = From 2c051f434444e03b524e9fc32878bc316a4720b1 Mon Sep 17 00:00:00 2001 From: goga-m Date: Tue, 15 Aug 2017 14:43:01 +0300 Subject: [PATCH 3/3] Change smsVerificationEnabled to smsVerificationActive --- lib/constants.js | 2 +- lib/routes.js | 2 +- test/fixtures/two-way-btc.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/constants.js b/lib/constants.js index e1c23873..c9414276 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -3,4 +3,4 @@ const anonymousCustomer = { name: 'anonymous', } -module.exports = {anonymous_customer} +module.exports = {anonymousCustomer} diff --git a/lib/routes.js b/lib/routes.js index 3196bd42..69ff04cb 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -58,7 +58,7 @@ function poll (req, res, next) { locale, txLimit: config.cashInTransactionLimit, idVerificationEnabled: config.idVerificationEnabled, - smsVerificationEnabled: config.smsVerificationEnabled, + smsVerificationActive: config.smsVerificationActive, cassettes, twoWayMode: config.cashOutEnabled, zeroConfLimit: config.zeroConfLimit, diff --git a/test/fixtures/two-way-btc.json b/test/fixtures/two-way-btc.json index 8ca25d60..501ea03c 100644 --- a/test/fixtures/two-way-btc.json +++ b/test/fixtures/two-way-btc.json @@ -99,7 +99,7 @@ "crypto": "global", "machine": "global" }, - "code": "smsVerificationEnabled", + "code": "smsVerificationActive", "fieldType": "onOff", "fieldClass": null },