@@ -11,7 +11,8 @@ var __ = require('underscore'),
1111 qr = require ( 'qr-encode' ) ,
1212 app = require ( '../App.js' ) . getApp ( ) ,
1313 discussionCl = require ( '../collections/discussionCl' ) ,
14- clipboard = require ( 'electron' ) . clipboard ;
14+ clipboard = require ( 'electron' ) . clipboard ,
15+ BrowserWindow = require ( 'electron' ) . remote . BrowserWindow ;
1516
1617module . exports = baseModal . extend ( {
1718
@@ -56,7 +57,8 @@ module.exports = baseModal.extend({
5657 //'blur textarea': 'validateInput',
5758 'click #BuyWizardQRDetailsInput' : 'toggleQRDetails' ,
5859 'keydown #transactionDiscussionSendText' : 'onKeydownDiscussion' ,
59- 'keyup #transactionDiscussionSendText' : 'onKeyupDiscussion'
60+ 'keyup #transactionDiscussionSendText' : 'onKeyupDiscussion' ,
61+ 'click .js-transactionShapeshiftURL' : 'openShapeshiftURL' ,
6062 } ,
6163
6264 initialize : function ( options ) {
@@ -151,8 +153,8 @@ module.exports = baseModal.extend({
151153 render : function ( ) {
152154 var self = this ,
153155 orderPrice = 0 ,
154- orderPaid = 0 ,
155- orderDue = 0 ;
156+ orderPaid = 0 ;
157+ this . orderDue = 0 ;
156158
157159 //make sure data is valid
158160 if ( this . model . get ( 'invalidData' ) ) {
@@ -168,7 +170,7 @@ module.exports = baseModal.extend({
168170 __ . each ( this . model . get ( "bitcoin_txs" ) , function ( payment ) {
169171 orderPaid += payment . value ;
170172 } ) ;
171- orderDue = orderPrice - orderPaid ;
173+ this . orderDue = orderPrice - orderPaid ;
172174
173175 loadTemplate ( './js/templates/transactionModal.html' , function ( loadedTemplate ) {
174176 self . $el . html ( loadedTemplate (
@@ -184,7 +186,7 @@ module.exports = baseModal.extend({
184186 orderID : self . orderID ,
185187 orderPrice : orderPrice ,
186188 orderPaid : orderPaid ,
187- orderDue : orderDue
189+ orderDue : self . orderDue
188190 } )
189191 ) ) ;
190192
@@ -259,7 +261,8 @@ module.exports = baseModal.extend({
259261 var payHREF ,
260262 dataURI ;
261263 if ( this . model . get ( 'buyer_order' ) ) {
262- payHREF = "bitcoin:" + this . model . get ( 'buyer_order' ) . order . payment . address + "?amount=" + this . model . get ( 'buyer_order' ) . order . payment . amount ;
264+ this . payURL = this . model . get ( 'buyer_order' ) . order . payment . address ;
265+ payHREF = "bitcoin:" + this . payURL + "?amount=" + this . orderDue ;
263266
264267 if ( localStorage . getItem ( 'AdditionalPaymentData' ) != "false" ) {
265268 payHREF += "&message=" + this . model . get ( 'vendor_offer' ) . listing . item . title . substring ( 0 , 20 ) + " " + this . orderID ;
@@ -819,6 +822,12 @@ module.exports = baseModal.extend({
819822 targ4 . text ( app . intlNumFormat ( adjustedTotal - updatedVal * adjustedTotal , 8 ) ) ;
820823 } ,
821824
825+ openShapeshiftURL : function ( ) {
826+ var shapeshiftURL = 'https://shapeshift.io/shifty.html?destination=' + this . payURL + '&output=BTC&apiKey=24ad734e196c948de4608e00472ab8a4b956a298c52abc20fda74114d6cebcb632714a9c5a0f38f46cef0bc974dfd41c34488432128d65acc099b3892f92d602&amount=' + this . orderDue ;
827+ var shapeshiftWin = new BrowserWindow ( { width : 700 , height : 500 , frame : true } ) ;
828+ shapeshiftWin . loadURL ( shapeshiftURL ) ;
829+ } ,
830+
822831 closeOrderForm : function ( ) {
823832 this . setState ( this . lastTab ) ;
824833 } ,
0 commit comments