diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index 3a6ce5bbe..091f486f9 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -1027,7 +1027,8 @@ Wallet.prototype.createPaymentTxSync = function(options, merchantData, unspent) var outs = []; merchantData.pr.pd.outputs.forEach(function(output) { outs.push({ - address: self.getAddressesStr()[0] || '1NGYre1pSqTnCXaqN5gLQ1e2KNTJXjDhtF', // dummy address + address: self.getAddressesStr()[0] + || 'mfWxJ45yp2SFn7UciZyNpvDKrzbhyfKrY8', // dummy address (testnet 0 * hash160) amountSatStr: '0' // dummy amount }); }); diff --git a/test/test.PayPro.js b/test/test.PayPro.js index 8f4244b5a..cdf337f85 100644 --- a/test/test.PayPro.js +++ b/test/test.PayPro.js @@ -20,6 +20,7 @@ var TransactionBuilder = bitcore.TransactionBuilder; var Transaction = bitcore.Transaction; var Address = bitcore.Address; var PayPro = bitcore.PayPro; +var startServer = require('./mocks/FakePayProServer'); var G = is_browser ? window : global; G.SSL_UNTRUSTED = true; diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js index 818eac500..10c9891d9 100644 --- a/test/unit/controllers/controllersSpec.js +++ b/test/unit/controllers/controllersSpec.js @@ -217,6 +217,32 @@ describe("Unit: Controllers", function() { sinon.assert.callCount(scope.loadTxs, 1); }); + it('should create a payment protocol transaction proposal', function() { + var uri = 'bitcoin:1JqniWpWNA6Yvdivg3y9izLidETnurxRQm?amount=0.00001000&r=https://localhost:8080/-/request'; + sendForm.address.$setViewValue(uri); + sendForm.amount.$setViewValue(1000); + + scope.wallet.totalCopayers = scope.wallet.requiredCopayers = 3; + var spy = sinon.spy(scope.wallet, 'createTx'); + var spy2 = sinon.spy(scope.wallet, 'sendTx'); + scope.submitForm(sendForm); + sinon.assert.callCount(spy, 1); + sinon.assert.callCount(spy2, 0); + }); + + it('should create and send a payment protocol transaction proposal', function() { + var uri = 'bitcoin:1JqniWpWNA6Yvdivg3y9izLidETnurxRQm?amount=0.00001000&r=https://localhost:8080/-/request'; + sendForm.address.$setViewValue(uri); + sendForm.amount.$setViewValue(1000); + + scope.wallet.totalCopayers = scope.wallet.requiredCopayers = 1; + var spy = sinon.spy(scope.wallet, 'createTx'); + var spy2 = sinon.spy(scope.wallet, 'sendTx'); + + scope.submitForm(sendForm); + sinon.assert.callCount(spy, 1); + sinon.assert.callCount(spy2, 1); + }); }); describe("Unit: Version Controller", function() {