diff --git a/src/js/services/bitpayAccountService.js b/src/js/services/bitpayAccountService.js index 7ab5a1bf7..8204da246 100644 --- a/src/js/services/bitpayAccountService.js +++ b/src/js/services/bitpayAccountService.js @@ -14,18 +14,18 @@ angular.module('copayApp.services').factory('bitpayAccountService', function($lo * email: email address associated with bitpay account * otp: two-factor one-time use password * } - * + * * pairingReason - text string to be embedded into popup message. If `null` then the reason * message is not shown to the UI. * "To {{reason}} you must pair this app with your BitPay account ({{email}})." - * + * * cb - callback after completion * callback(err, paired, apiContext) * * err - something unexpected happened which prevented the pairing - * + * * paired - boolean indicating whether the pairing was compledted by the user - * + * * apiContext - the context needed for making future api calls * { * token: api token for use in future calls @@ -33,6 +33,7 @@ angular.module('copayApp.services').factory('bitpayAccountService', function($lo * appIdentity: the identity of this app * } */ + root.pair = function(pairData, pairingReason, cb) { checkOtp(pairData, function(otp) { pairData.otp = otp; @@ -66,14 +67,19 @@ angular.module('copayApp.services').factory('bitpayAccountService', function($lo fetchBasicInfo(apiContext, function(err, basicInfo) { if (err) return cb(err); var title = gettextCatalog.getString('Add BitPay Account?'); - var msgDetail = 'Add this BitPay account ({{email}})?'; + var msg; + if (pairingReason) { - msgDetail = 'To {{reason}} you must first add your BitPay account - {{email}}'; - } - var msg = gettextCatalog.getString(msgDetail, { - reason: pairingReason, - email: pairData.email - }); + msg = gettextCatalog.getString('To {{reason}} you must first add your BitPay account - {{email}}', { + reason: pairingReason, + email: pairData.email + }); + } else { + msg = gettextCatalog.getString('Add this BitPay account ({{email}})?', { + email: pairData.email + }); + } + var ok = gettextCatalog.getString('Add Account'); var cancel = gettextCatalog.getString('Go back'); popupService.showConfirm(title, msg, ok, cancel, function(res) { @@ -182,5 +188,5 @@ angular.module('copayApp.services').factory('bitpayAccountService', function($lo }; return root; - + }); diff --git a/www/views/bitpayCard.html b/www/views/bitpayCard.html index c08297225..b787ca4a9 100644 --- a/www/views/bitpayCard.html +++ b/www/views/bitpayCard.html @@ -64,8 +64,8 @@