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

Commit 3df19d4

Browse files
committed
Merge pull request #1393 from OpenBazaar/QRdetailsToggleOnPayment
QR details toggle on payment
2 parents 5b5bf15 + c55b8ba commit 3df19d4

File tree

9 files changed

+59
-12
lines changed

9 files changed

+59
-12
lines changed

css/obBase.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,6 +3129,7 @@ input[type="checkbox"].fieldItem + label:before {
31293129
box-shadow: none;
31303130
opacity: 1;
31313131
font-size: 1.5em;
3132+
vertical-align: middle;
31323133
}
31333134

31343135
input[type="checkbox"].fieldItem + label.compact {
@@ -3140,6 +3141,10 @@ input[type="checkbox"].fieldItem + label.compact:before {
31403141
left: 0;
31413142
}
31423143

3144+
input[type="checkbox"].fieldItem.thin + label {
3145+
line-height: inherit;
3146+
}
3147+
31433148
input[type="checkbox"].fieldItem:checked + label:before {
31443149
content: "\f374";
31453150
}

js/languages/en-US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@
325325
"PriceForOne": "Price per single item, file, or service.",
326326
"Avatar": "Avatar",
327327
"AdditionalPaymentData": "Additional payment data",
328-
"AdditionalPaymentDataInfo": "Include message and label in payment QR code.",
328+
"AdditionalPaymentDataInfo": "Include name of purchase and order number in payment QR code?",
329329
"firewall": {
330330
"Open": "Open",
331331
"Restricted": "Restricted",

js/templates/buyWizard.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,20 @@ <h3 class="txt-bright padding30"><%= polyglot.t('CheckExchanges') %> </h3>
2323
</div>
2424
</div>
2525
<div class="modal-hero modal-heroFullHeightNoButtons padding40 js-buyWizardPay hide background1">
26-
<div class="width100 padding20">
26+
<div class="width100 row20">
2727
<img class="blockCenter qrCode js-buyWizardPayQRCode" height="250" width="250" src="imgs/defaultItem.png"/>
2828
</div>
2929
<div class="txt-bright pad20">
3030
<div class="txt-center row10 textSize20px">
3131
<%= polyglot.t('buyFlow.SendBTCtoAddress', {amount: '<span class="js-buyWizardDetailsTotalBTC"></span>'}) %>
3232
</div>
33-
<div class="txt-center row20">
33+
<div class="txt-center row10">
3434
<a class="textSize16px js-buyWizardPayLink"><span class="js-buyWizardPayURL"></span></a>
3535
</div>
36+
<div class="txt-center row10">
37+
<input type="checkbox" class="textSize11px fieldItem thin" id="BuyWizardQRDetailsInput">
38+
<label for="BuyWizardQRDetailsInput" class="textSize11px"> <%= polyglot.t('AdditionalPaymentDataInfo') %></label>
39+
</div>
3640
<a class="btn btn-txt btn-wide row10 js-buyWizardPayCopy"><i class="ion-clipboard"></i> <%= polyglot.t('buyFlow.CopyAddress') %></a>
3741
<a class="btn btn-txt btn-wide row10 js-buyWizardPayLink"><i class="ion-link"></i> <%= polyglot.t('buyFlow.OpenAddress') %></a>
3842
<a class="btn btn-txt btn-wide js-buyWizardPayCheck"><i class="ion-refresh"></i> <%= polyglot.t('buyFlow.RefreshPayment') %></a>

js/templates/pageNav.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ <h3 class="margin0 marginTop25"><%= polyglot.t('Discover') %></h3>
126126
<a class="js-navRestart">
127127
<span class="ion-refresh fontSize11 marginRight2 textOpacity1"></span>
128128
<%= polyglot.t('nav.restart') %>
129-
<span class="pull-right txt-muted"><%= ob.ctrlCmdKey + config.keyShortcuts.restart.toUpperCase() %></span>
129+
<span class="pull-right txt-muted"><%= config.keyShortcutPrefix + config.keyShortcuts.restart.toUpperCase() %></span>
130130
</a>
131131
<hr/>
132132
<a class="js-showAboutModal">

js/templates/transactionModal.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,20 @@ <h3 class="txt-bright"><%= polyglot.t('CheckExchanges') %> </h3>
4141
<div class="modal-hero js-transactionPay background1">
4242
<div class="positionTop width100 padding20">
4343
<img class="pull-left qrCode js-transactionPayQRCode" height="180" width="180" src="imgs/defaultItem.png"/>
44-
<div class="pull-left rowtop20 pad20Left txt-bright" style="width:255px;">
45-
<div class="txt-center row20 textSize16px">
44+
<div class="pull-left pad20Left txt-bright" style="width:255px;">
45+
<div class="txt-center row10 textSize16px">
4646
<%= polyglot.t('buyFlow.SendBTCtoAddress', {amount: ob.buyer_order.order.payment.amount}) %>
4747
</div>
48-
<div class="txt-center row20">
48+
<div class="txt-center row10">
4949
<a class="textSize11px"
5050
href="bitcoin:<%= ob.buyer_order.order.payment.address %>?amount=<%= ob.buyer_order.order.payment.amount %>&message=<%= ob.vendor_offer.listing.item.title %>">
5151
<%= ob.buyer_order.order.payment.address %>
5252
</a>
5353
</div>
54+
<div class="txt-center row10">
55+
<input type="checkbox" class="textSize11px fieldItem thin" id="BuyWizardQRDetailsInput">
56+
<label for="BuyWizardQRDetailsInput" class="textSize11px"> <%= polyglot.t('AdditionalPaymentDataInfo') %></label>
57+
</div>
5458
<a class="btn btn-txt btn-wide row10 js-transactionPayCopy"><i class="ion-clipboard"></i> <%= polyglot.t('buyFlow.CopyAddress') %></a>
5559
<a class="btn btn-txt btn-wide row10 js-externalLink"
5660
href="bitcoin:<%= ob.buyer_order.order.payment.address %>?amount=<%= ob.buyer_order.order.payment.amount %>&message=<%= ob.vendor_offer.listing.item.title %>">

js/templates/userPage.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
<div class="ctrlGroup js-pageCustomizationButtons js-userPageControls hide">
2727
<a class="btn btn-txt custCol-primary js-saveCustomization">
2828
<span class="ion-checkmark fontSize11 marginRight2 textOpacity1"></span>
29-
<% console.log(config.keyShortcuts) %>
3029
<%= polyglot.t('SaveChanges') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.save.toUpperCase() %>)
3130
</a>
3231
</div>

js/utils/setTheme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module.exports = function(primaryColor, secondaryColor, backgroundColor, textCol
5656
"#ov1 #userPage input[type='radio'].fieldItem.starRating + label:before { color: " + textColor + "; background: none; box-shadow: none;}" +
5757
"#ov1 #userPage input[type='radio'].fieldItem.starRating:checked + label:before { background: none; box-shadow: none;}" +
5858
"#ov1 #userPage .starRating:before { color: " + textColor + ";}" +
59-
"#ov1 #userPage input[type='checkbox'].fieldItem:checked + label:before { color: " + textColor + "; box-shadow: inset 0 0 0 4px " + primaryColor + ";}" +
59+
//"#ov1 #userPage input[type='checkbox'].fieldItem:checked + label:before { color: " + textColor + "; box-shadow: inset 0 0 0 4px " + primaryColor + ";}" +
6060
"#ov1 #userPage input[type='number'].fieldItem { color: " + textColor + ";}" +
6161
"#ov1 #userPage input[type='number'].spinButtons::-webkit-inner-spin-button:before { color: " + textColor + ";}" +
6262
"#ov1 #userPage input[type='number'].spinButtons::-webkit-inner-spin-button:after { color: " + textColor + ";}" +

js/views/buyWizardVw.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ module.exports = baseVw.extend({
5656
'click .js-buyWizardCloseSummary': 'closeWizard',
5757
'click input[name="radioPaymentType"]': 'changePaymentType',
5858
'blur .js-buyWizardPostalInput': 'updateMap',
59+
'click #BuyWizardQRDetailsInput': 'toggleQRDetails',
5960
'blur input': 'validateInput'
6061
},
6162

@@ -73,6 +74,7 @@ module.exports = baseVw.extend({
7374
this.orderID = "";
7475
this.model.set('selectedModerator', "");
7576
this.model.updateAttributes();
77+
this.cachePayData = "";
7678

7779
//create the country select list
7880
this.countryList = countries.get('countries');
@@ -197,6 +199,9 @@ module.exports = baseVw.extend({
197199
$(".js-BuyWizardWallets").randomize();
198200
}
199201

202+
//set the QR details checkbox
203+
var QRtoggleVal = localStorage.getItem('AdditionalPaymentData') != "false" ? true : false;
204+
self.$('#BuyWizardQRDetailsInput').prop('checked', QRtoggleVal);
200205
});
201206
return this;
202207
},
@@ -485,6 +490,7 @@ module.exports = baseVw.extend({
485490
success: function(data){
486491
if(data.success == true){
487492
self.showPayAddress(data);
493+
self.cachePayData = data; //cache the data for the QR Details toggle
488494
} else {
489495
messageModal.show(window.polyglot.t('errorMessages.contractError'), window.polyglot.t('errorMessages.sellerError') +" " +
490496
window.polyglot.t('errorMessages.checkPurchaseData') + "\n\n Reason: " + data.reason);
@@ -499,8 +505,21 @@ module.exports = baseVw.extend({
499505
});
500506
},
501507

508+
toggleQRDetails: function(){
509+
var toggleInput = this.$('#BuyWizardQRDetailsInput'),
510+
toggleVal = toggleInput.prop('checked');
511+
localStorage.setItem('AdditionalPaymentData', toggleVal);
512+
this.showPayAddress();
513+
},
514+
502515
showPayAddress: function(data){
503-
"use strict";
516+
data = data || this.cachePayData;
517+
518+
if(!data) {
519+
throw new Error('Data must be provided to the showPayAddress function');
520+
return;
521+
}
522+
504523
var totalBTCPrice = 0,
505524
storeName = encodeURI(this.model.get('page').profile.name),
506525
message = encodeURI(this.model.get('vendor_offer').listing.item.title.substring(0, 20) + " "+data.order_id),
@@ -515,7 +534,7 @@ module.exports = baseVw.extend({
515534
payHREF = "bitcoin://"+ data.payment_address+"?amount="+totalBTCPrice;
516535
if(localStorage.getItem('AdditionalPaymentData') != "false") {
517536
payHREF += "&label="+storeName+"&message="+message;
518-
}
537+
}
519538

520539
this.hideMaps();
521540
this.$el.find('.js-buyWizardPay').removeClass('hide');

js/views/transactionModalVw.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ module.exports = baseVw.extend({
5858
'blur .js-transactionDiscussionSendText': 'blurInput',
5959
'blur input': 'validateInput',
6060
'blur textarea': 'validateInput',
61+
'click #BuyWizardQRDetailsInput': 'toggleQRDetails',
6162
'keydown #transactionDiscussionSendText': 'onKeydownDiscussion',
6263
'keyup #transactionDiscussionSendText': 'onKeyupDiscussion'
6364
},
@@ -166,6 +167,9 @@ module.exports = baseVw.extend({
166167
self.getDiscussion();
167168
self.discussionScroller = self.$('.js-discussionScroller');
168169
self.moderatorPercentage = self.model.get('displayModerator').feeDecimal;
170+
//set the QR details checkbox
171+
var QRtoggleVal = localStorage.getItem('AdditionalPaymentData') != "false" ? true : false;
172+
self.$('#BuyWizardQRDetailsInput').prop('checked', QRtoggleVal);
169173
});
170174
},
171175

@@ -205,12 +209,24 @@ module.exports = baseVw.extend({
205209
}
206210
},
207211

212+
toggleQRDetails: function(){
213+
var toggleInput = this.$('#BuyWizardQRDetailsInput'),
214+
toggleVal = toggleInput.prop('checked');
215+
localStorage.setItem('AdditionalPaymentData', toggleVal);
216+
this.showPayment();
217+
},
218+
208219
showPayment: function(){
209220
var totalBTCPrice = 0,
210221
payHREF,
211222
dataURI;
212223
if(this.model.get('buyer_order')){
213-
payHREF = "bitcoin:" + this.model.get('buyer_order').order.payment.address + "?amount=" + this.model.get('buyer_order').order.payment.amount + "&message=" + this.model.get('vendor_offer').listing.item.title.substring(0, 20);
224+
payHREF = "bitcoin:" + this.model.get('buyer_order').order.payment.address + "?amount=" + this.model.get('buyer_order').order.payment.amount;
225+
226+
if(localStorage.getItem('AdditionalPaymentData') != "false") {
227+
payHREF += "&message=" + this.model.get('vendor_offer').listing.item.title.substring(0, 20) + " " + this.orderID;
228+
}
229+
214230
dataURI = qr(payHREF, {type: 10, size: 10, level: 'M'});
215231
this.$el.find('.js-transactionPayQRCode').attr('src', dataURI);
216232
} else {

0 commit comments

Comments
 (0)