diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index 1e682b236a1fcabec105f4e9c4b84df5384ac48e..ff67cb8390e332fdb1a31fa3987557b08b1523b5 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -915,6 +915,7 @@ "TITLE_SHORT": "Online payment", "SUMMARY": "Order summary:", "AMOUNT": "Amount:", + "AMOUNTS_HELP": "Please select the amount:", "NAME": "Name:", "PUBKEY": "Public key of the recipient:", "COMMENT": "Order reference:", @@ -944,6 +945,7 @@ "DEMO_DIVIDER": "Try it !", "DEMO_HELP": "To test this service, click on this button. The result content will be display below.", "DEMO_RESULT": "Result returned by call:", + "DEMO_RESULT_PEER": "Peer address used:", "DEMO_SUCCEED": "<i class=\"icon ion-checkmark\"></i> Success!", "DEMO_CANCELLED": "<i class=\"icon ion-close\"></i> Canceled by user", "INTEGRATE_DIVIDER": "Website integration", diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index fe47aa82bbdba0fcdbbc4971b0b61265c60ec9c8..e677925bd55d2748447a6d03a9f0cd66364bf0dc 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -915,6 +915,7 @@ "TITLE_SHORT": "Online payment", "SUMMARY": "Order summary:", "AMOUNT": "Amount:", + "AMOUNTS_HELP": "Please select the amount:", "NAME": "Name:", "PUBKEY": "Public key of the recipient:", "COMMENT": "Order reference:", @@ -944,6 +945,7 @@ "DEMO_DIVIDER": "Try it !", "DEMO_HELP": "To test this service, click on this button. The result content will be display below.", "DEMO_RESULT": "Result returned by call:", + "DEMO_RESULT_PEER": "Peer address used:", "DEMO_SUCCEED": "<i class=\"icon ion-checkmark\"></i> Success!", "DEMO_CANCELLED": "<i class=\"icon ion-close\"></i> Canceled by user", "INTEGRATE_DIVIDER": "Website integration", diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index da359ee6ab9518f99a9a81c7cd595d3c6b053781..c038521d43e990f843a7ea6a383255f486fc4001 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -915,6 +915,7 @@ "TITLE_SHORT": "Paiement en ligne", "SUMMARY": "Récapitulatif de la commande :", "AMOUNT": "Montant :", + "AMOUNTS_HELP": "Veuillez choisir le montant :", "NAME": "Nom :", "PUBKEY": "Clé publique du destinataire :", "COMMENT": "Référence de la commande :", @@ -944,7 +945,7 @@ "DEMO_DIVIDER": "Tester", "DEMO_HELP": "Pour tester ce service, cliquez sur le bouton ci-contre. Le résultat s'affichera en dessous.", "DEMO_RESULT": "Résultat retourné par l'appel :", - "DEMO_RESULT_PEER": "Nœud Duniter utilisé : ", + "DEMO_RESULT_PEER": "Adresse du nœud utilisé :", "DEMO_SUCCEED": "<i class=\"icon ion-checkmark\"></i> Succès !", "DEMO_CANCELLED": "<i class=\"icon ion-close\"></i> Annulé par l'utilisateur", "INTEGRATE_DIVIDER": "Intégrer", @@ -957,7 +958,7 @@ "PARAM_PUBKEY": "Clé publique du destinataire", "PARAM_PUBKEY_HELP": "Clé publique du destinataire (obligatoire)", "PARAM_AMOUNT": "Montant", - "PARAM_AMOUNT_HELP": "Montant de la transaction (obligatoire)", + "PARAM_AMOUNT_HELP": "Montant de la transaction (obligatoire). Valeurs multiples autorisées, en utilisant un séparateur (point virgule, barre verticale ou espace).", "PARAM_COMMENT": "Référence (ou commentaire)", "PARAM_COMMENT_HELP": "Référence ou commentaire. Vous permettra par exemple d'identifier le paiement dans la BlockChain.", "PARAM_NAME": "Nom (du destinataire ou du site web)", diff --git a/www/js/api/app.js b/www/js/api/app.js index 3d2baeb296b1b4737275e1f611ba55e381862473..7483003750974f52745d89aae296dc0f981a2a19 100644 --- a/www/js/api/app.js +++ b/www/js/api/app.js @@ -245,6 +245,7 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr $scope.loading = true; $scope.transferData = { amount: undefined, + amounts: undefined, comment: undefined, pubkey: undefined, name: undefined, @@ -259,7 +260,26 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr if (!$scope.loading) return; // already enter if (state.stateParams && state.stateParams.amount) { - $scope.transferData.amount = parseFloat(state.stateParams.amount.replace(new RegExp('[.,]'), '.')).toFixed(2) * 100; + var amountStr = state.stateParams.amount.trim(); + var amounts = ((amountStr.indexOf('|') !== -1) && amountStr.split('|')) + || ((amountStr.indexOf(' ') !== -1) && amountStr.split(' ')) + || ((amountStr.indexOf(';') !== -1) && amountStr.split(';')); + if (amounts){ + $scope.transferData.amounts = amounts.reduce(function(res, amountStr) { + var amount = normalizeAmount(amountStr); + return amount > 0 ? res.concat(amount) : res; + }, []); + if ($scope.transferData.amounts.length === 1) { + $scope.transferData.amount = $scope.transferData.amounts[0]; + delete $scope.transferData.amounts; + } + else { + $scope.transferData.amounts.sort(); + } + } + else { + $scope.transferData.amount = normalizeAmount(amountStr); + } } if (state.stateParams && state.stateParams.pubkey) { $scope.transferData.pubkey = state.stateParams.pubkey; @@ -362,14 +382,26 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr ; }; + function normalizeAmount(amountStr) { + return parseFloat((amountStr||'0').trim().replace(new RegExp('[.,]'), '.')).toFixed(2) * 100; + } + function onLogin(authData) { // User cancelled if (!authData) return $scope.onCancel(); + // Make sure amount require fields + if (!$scope.transferData.amount || !$scope.transferData.pubkey) { + $scope.transferData.error = true; + UIUtils.loading.hide(); + return $q.reject(); + } + // Avoid multiple click if ($scope.sending) return; $scope.sending = true; + delete $scope.transferData.error; var wallet = $scope.demo ? csDemoWallet.instance(authData) : csWallet.instance('api', BMA); diff --git a/www/js/platform.js b/www/js/platform.js index feef681477d5ce240a5d3c01c68abc4d524ee588..fc1453502193674d56cd9926eb7af215c14cb3c6 100644 --- a/www/js/platform.js +++ b/www/js/platform.js @@ -369,7 +369,7 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] // Status bar style if (window.StatusBar) { - console.log("[app] Status bar plugin enable"); + console.debug("[app] Status bar plugin enable"); // org.apache.cordova.statusbar required window.StatusBar.styleDefault(); } diff --git a/www/templates/api/transfer.html b/www/templates/api/transfer.html index 1ee7deb99e5cef7f302815b1ebc9d4124852fc09..567ddfa5f02cb68e7ee4541b6d91614db1ee606e 100644 --- a/www/templates/api/transfer.html +++ b/www/templates/api/transfer.html @@ -54,12 +54,30 @@ <p translate>API.TRANSFER.SUMMARY</p> </div> - <div class="item item-icon-left-padding item-tx no-border "> + <!-- Amount --> + <div class="item item-icon-left-padding item-tx no-border" ng-if="!transferData.amounts"> <h2 translate>API.TRANSFER.AMOUNT</h2> <ion-spinner class="badge item-note" icon="android" ng-show="loading"></ion-spinner> <div class="badge item-note badge-calm ng-hide" ng-show="!loading" ng-bind-html="transferData.amount|formatAmount:{useRelative: false, currency: currency.name}"></div> - <div class="badge badge-secondary ng-hide" ng-show="!loading" ng-bind-html="transferData.amount|formatAmount:{useRelative: true, currency: currency.name, currentUD: currency.currentUD}"></div> + <!--<div class="badge badge-secondary ng-hide" ng-show="!loading" ng-bind-html="transferData.amount|formatAmount:{useRelative: true, currency: currency.name, currentUD: currency.currentUD}"></div>--> + <div class="item-note badge-secondary ng-hide" ng-show="!loading" ng-bind-html="transferData.amount|formatAmount:{useRelative: true, currency: currency.name, currentUD: currency.currentUD}"></div> </div> + <!-- Amounts --> + <label ng-if="transferData.amounts" + class="item item-icon-left-padding item-tx no-border" + ng-class="{'item-input item-select': transferData.amounts}"> + <span class="input-label" translate>API.TRANSFER.AMOUNT</span> + <select ng-model="transferData.amount" + required="true" + ng-options="(amount |formatAmount:{useRelative: false, currency: currency.name}) for amount in transferData.amounts"> + </select> + <h3 class="assertive" ng-if="!transferData.amount"> + <i class="icon ion-alert-circled" ng-if="transferData.error"></i> + <span translate>API.TRANSFER.AMOUNTS_HELP</span> + </h3> + <span class="gray badge-secondary" ng-bind-html="transferData.amount|formatAmount:{useRelative: true, currency: currency.name, currentUD: currency.currentUD}"></span> + </label> + <div class="item item-icon-left-padding" > <h2 translate>API.TRANSFER.NAME</h2> <div class="badge item-note"> diff --git a/www/templates/login/form_scrypt_advanced.html b/www/templates/login/form_scrypt_advanced.html index 93b21b85bc6aaa8c6b0e16d70e983e2c670bc11e..d516ad76430bdfec31f40edbe145de2b4ff60c6e 100644 --- a/www/templates/login/form_scrypt_advanced.html +++ b/www/templates/login/form_scrypt_advanced.html @@ -43,7 +43,7 @@ <!-- WARN: not implemented yet --> -<p class="energized-100-bg padding " > +<p class="energized-100-bg padding dark" > <i class="icon ion-android-warning"></i> <span translate>INFO.FEATURES_NOT_IMPLEMENTED</span> </p>