Skip to content

Commit 3189675

Browse files
authoredMay 31, 2018
Merge pull request bitpay#780 from Gamboster/fix/insightUrlForBCH
Fix: insight url for emails of BCH
2 parents f3aa4ce + 0b6e4ee commit 3189675

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed
 

‎config.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ var config = {
6262
url: 'https://test-bch-insight.bitpay.com:443',
6363
addressFormat: 'cashaddr', // copay, cashaddr, or legacy
6464
},
65-
65+
6666
},
6767
},
6868
pushNotificationsOpts: {
@@ -88,11 +88,16 @@ var config = {
8888
// defaultLanguage: 'en',
8989
// defaultUnit: 'btc',
9090
// publicTxUrlTemplate: {
91-
// livenet: 'https://insight.bitpay.com/tx/{{txid}}',
92-
// testnet: 'https://test-insight.bitpay.com/tx/{{txid}}',
91+
// btc: {
92+
// livenet: 'https://insight.bitpay.com/tx/{{txid}}',
93+
// testnet: 'https://test-insight.bitpay.com/tx/{{txid}}',
94+
// },
95+
// bch: {
96+
// livenet: 'https://bch-insight.bitpay.com/tx/{{txid}}',
97+
// testnet: 'https://test-bch-insight.bitpay.com/tx/{{txid}}',
98+
// }
9399
// },
94-
//},
95-
//
100+
// },
96101
// To use sendgrid:
97102
// var sgTransport = require('nodemail-sendgrid-transport');
98103
// mailer:sgTransport({

‎lib/emailservice.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ EmailService.prototype._getRecipientsList = function(notification, emailType, cb
216216
};
217217

218218
EmailService.prototype._getDataForTemplate = function(notification, recipient, cb) {
219-
var self = this;
219+
var self = this;
220220

221221
// TODO: Declare these in BWU
222222
var UNIT_LABELS = {
@@ -259,7 +259,7 @@ EmailService.prototype._getDataForTemplate = function(notification, recipient, c
259259
}
260260

261261
if (_.contains(['NewIncomingTx', 'NewOutgoingTx'], notification.type) && data.txid) {
262-
var urlTemplate = self.publicTxUrlTemplate[wallet.network];
262+
var urlTemplate = self.publicTxUrlTemplate[wallet.coin][wallet.network];
263263
if (urlTemplate) {
264264
try {
265265
data.urlForTx = Mustache.render(urlTemplate, data);

‎test/integration/emailnotifications.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ describe('Email notifications', function() {
5757
from: 'bws@dummy.net',
5858
subjectPrefix: '[test wallet]',
5959
publicTxUrlTemplate: {
60-
livenet: 'https://insight.bitpay.com/tx/{{txid}}',
61-
testnet: 'https://test-insight.bitpay.com/tx/{{txid}}',
60+
btc: {
61+
livenet: 'https://insight.bitpay.com/tx/{{txid}}',
62+
testnet: 'https://test-insight.bitpay.com/tx/{{txid}}',
63+
},
64+
bch: {
65+
livenet: 'https://bch-insight.bitpay.com/tx/{{txid}}',
66+
testnet: 'https://test-bch-insight.bitpay.com/tx/{{txid}}',
67+
}
6268
},
6369
},
6470
}, function(err) {
@@ -472,8 +478,14 @@ describe('Email notifications', function() {
472478
from: 'bws@dummy.net',
473479
subjectPrefix: '[test wallet]',
474480
publicTxUrlTemplate: {
475-
livenet: 'https://insight.bitpay.com/tx/{{txid}}',
476-
testnet: 'https://test-insight.bitpay.com/tx/{{txid}}',
481+
btc: {
482+
livenet: 'https://insight.bitpay.com/tx/{{txid}}',
483+
testnet: 'https://test-insight.bitpay.com/tx/{{txid}}',
484+
},
485+
bch: {
486+
livenet: 'https://bch-insight.bitpay.com/tx/{{txid}}',
487+
testnet: 'https://test-bch-insight.bitpay.com/tx/{{txid}}',
488+
}
477489
},
478490
},
479491
}, function(err) {

0 commit comments

Comments
 (0)
Please sign in to comment.