Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit b08c58d

Browse files
committed
Added shapeshift to transaction modal.
1 parent 442dbde commit b08c58d

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

js/languages/en-US.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,9 @@
686686
"OpenAddress": "Open in Local Wallet",
687687
"CopyAddress": "Copy to Clipboard",
688688
"RefreshPayment": "Refresh Payment Status",
689+
"Refresh": "Refresh",
689690
"PayWithAltCoins": "Pay with Altcoins",
691+
"AltCoins": "Altcoins",
690692
"summaryMsg1": "Your payment has been sent to %{recipient}",
691693
"summaryMsg2": "The expected processing time for this order is %{time}",
692694
"summaryMsg3": "You can check the status of your order on your %{purchasesPageLink}",

js/templates/transactionModal.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,17 @@ <h3 class="txt-bright"><%= polyglot.t('CheckExchanges') %> </h3>
5555
href="bitcoin:<%= ob.buyer_order.order.payment.address %>?amount=<%= ob.buyer_order.order.payment.amount %>&message=<%= ob.vendor_offer.listing.item.title %>">
5656
<i class="ion-link"></i> <%= polyglot.t('buyFlow.OpenAddress') %>
5757
</a>
58-
<a class="btn btn-txt btn-wide js-transactionPayCheck"><i class="ion-refresh"></i> <%= polyglot.t('buyFlow.RefreshPayment') %></a>
58+
59+
<div class="flexRow pad">
60+
<div class="flexCol-6">
61+
<a class="btn btn-txt btn-wide js-transactionPayCheck"><i class="ion-refresh"></i> <%= polyglot.t('buyFlow.Refresh') %></a>
62+
</div>
63+
<div class="flexCol-6">
64+
<a class="btn btn-txt btn-wide js-transactionShapeshiftURL">
65+
<img src="imgs/shapeshift_logo.png" height="18px" width="18px" style="position: relative; top: 4px;"> <%= polyglot.t('buyFlow.AltCoins') %>
66+
</a>
67+
</div>
68+
</div>
5969
</div>
6070
</div>
6171
</div>

js/views/buyWizardVw.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ var __ = require('underscore'),
1313
app = require('../App').getApp(),
1414
clipboard = require('electron').clipboard,
1515
templateHelpers = require('../utils/templateHelpers'),
16-
electron = require('electron'),
17-
BrowserWindow = electron.remote.BrowserWindow;
16+
BrowserWindow = require('electron').remote.BrowserWindow;
1817

1918

2019
module.exports = baseModal.extend({

js/views/transactionModalVw.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

1617
module.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+'&amp;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

Comments
 (0)