Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
Merge branch 'v1.21-release' into coinify-limits
Browse files Browse the repository at this point in the history
  • Loading branch information
plondon authored Jul 29, 2017
2 parents 6015477 + 608e8a4 commit 307c523
Show file tree
Hide file tree
Showing 51 changed files with 2,203 additions and 70 deletions.
3 changes: 2 additions & 1 deletion app/partials/buy-sell.pug
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@

.flex-row.flex-between.flex-center.mtl
h4.type-h5 Completed Orders
span.hidden-xs(ng-show="exchange.profile.email") Coinify Account: {{ exchange.profile.email }}
div(ng-hide="trades.pending.length")
span.hidden-xs(ng-show="exchange.profile.email") Coinify Account: {{ exchange.profile.email }}
table.width-100.mb-30(gradual-render)
tr.border.bg-light-blue
th.pvs.width-5-mobile.visible-xs
Expand Down
2 changes: 1 addition & 1 deletion app/partials/trade-summary.pug
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
li.pam.border-right.border-left.border-bottom-light.flex-between(ng-repeat="(prop, val) in formattedTrade.tx track by $index" ng-if="val")
span.em-300.colon(translate="{{prop}}" ng-class="{'em-500': prop === 'TOTAL_COST'}")
span.em-300.right-align.capitalize(ng-bind="val" ng-class="{'em-500': prop === 'TOTAL_COST', 'capitalize' : prop !== 'RECEIVING_ADDRESS'}")
span.security-red.plm(ng-if="$last && isPendingBankTransfer && isPendingBankTransfer()" translate="ORDER_ID_REFERENCE")
span.security-red.plm(ng-if="$last && isPendingBankTransfer()" translate="ORDER_ID_REFERENCE")
p.security-red.pointer.ng-hide(ng-show="vm.buySellDebug && vm.trade.bankAccount && vm.trade.state === 'awaiting_transfer_in'")
i.ti-search.mrm
span(ng-click="fakeBankTransfer()" translate="QA: Click here to fake a bank transfer")
Expand Down
8 changes: 4 additions & 4 deletions app/partials/unocoin/bank-transfer.pug
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.modal-body.clearfix(data-preflight-tag="BankTransfer")
form.bc-form(ng-submit="vm.onStep('summary') ? vm.goTo('reference') : vm.addReferenceNumber()" id="bankTransferForm" name="bankTransferForm" role="form")
form.bc-form(id="bankTransferForm" name="bankTransferForm" role="form" novalidate)
div
.mbl
span.type-h5.em-500.flex-start.pts.capitalize(class="{{vm.formattedTrade.class}}" translate="{{vm.formattedTrade.namespace}}.TITLE")
p.ptm(translate="{{vm.formattedTrade.namespace}}.BODY" translate-values="vm.formattedTrade.values")
p.ptm(ng-show="vm.onStep('summary')" translate="{{vm.formattedTrade.namespace}}.BODY" translate-values="vm.formattedTrade.values")
.border(ng-if="vm.onStep('summary')")
ul.em-300.bg-grey.border-top.pan.mbn.bank-transfer
li.pam.border-right.border-left.border-bottom-light.flex-between(ng-repeat="(prop, val) in vm.formattedTrade.tx track by $index" ng-if="val")
Expand All @@ -16,10 +16,10 @@
span.em-300.right-align.capitalize(ng-bind="val" ng-class="{'em-500': prop === 'TOTAL_COST', 'capitalize' : prop !== 'RECEIVING_ADDRESS'}")
.group(ng-if="vm.onStep('reference')")
.item
label Enter your IMPS/NEFT/RTGS/CHEQUE reference number:
label.em-300.colon(translate="UNOCOIN_AFTER_TRANSFER")
input(ng-model="vm.state.reference" name="reference" type="text" required focus-when="vm.onStep('reference')")
.ph-35.pb-25.flex-end.flex-row
button.btn.button-primary(ng-if="vm.onStep('initiated')" ng-click="vm.close()" translate="CLOSE")
button.button-muted.primary.mrm(ng-if="vm.onStep('summary')" ng-click="vm.close()" translate="CANCEL")
button.button-muted.primary.mrm(ng-if="vm.onStep('reference')" ng-click="vm.goTo('summary')" translate="GO_BACK" ng-disabled="vm.locked")
button.btn.button-primary(ng-if="vm.onStep('summary') || vm.onStep('reference')" type="submit" translate="{{vm.onStep('summary') ? 'CONTINUE' : 'SUBMIT'}}" form="bankTransferForm" ng-disabled="vm.locked")
button.btn.button-primary(ng-if="vm.onStep('summary') || vm.onStep('reference')" ng-click="vm.onStep('summary') ? vm.goTo('reference') : vm.addReferenceNumber()" translate="{{vm.onStep('summary') ? 'CONTINUE' : 'SUBMIT'}}" form="bankTransferForm" ng-disabled="vm.locked || (vm.onStep('reference') && !vm.state.reference)")
2 changes: 1 addition & 1 deletion app/partials/unocoin/signup.pug
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
div(ng-if="vm.onStep('create')" ng-controller="UnocoinCreateAccountController")
exchange-create(views="views" exchange="exchange" on-create="vm.goTo('verify')" terms-of-service="https://www.unocoin.com/post/98" privacy-agreement="https://www.unocoin.com/post/104")
div(ng-if="vm.onStep('verify')" ng-controller="UnocoinVerifyController")
exchange-verify(steps="steps" fields="fields" exchange="exchange" next-step="'upload'" error="error" initial-step="initialStep" mobile-preferences="['IN']" on-verify="verifyProfile()" on-set-profile="setProfile(fields)")
exchange-verify(steps="steps" fields="fields" exchange="exchange" next-step="'upload'" error="error" initial-step="initialStep" mobile-preferences="['IN']" on-verify="verifyProfile()" on-set-profile="setProfile()" on-set-bank-info="setBankInfo()")
div(ng-if="vm.onStep('upload')" ng-controller="UnocoinUploadController")
exchange-upload(base="unocoin_" locked="locked" id-type="state.idType" handle-upload="prepUpload(file)" auto-fill="autoFill()")
div(ng-if="vm.onStep('pending')" ng-include="'partials/unocoin/pending.pug'")
Expand Down
7 changes: 5 additions & 2 deletions app/templates/buy-quick-start.pug
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.flex-center(ng-show="exchangeRate.fiat")
span.type-sm.em-500 1 BTC = {{ exchangeRate.fiat }} {{transaction.currency.code}}
helper-button(content="EXCHANGE_RATE_HELPER")
fieldset(ng-disabled="tradingDisabled")
fieldset(ng-disabled="tradingDisabled || serviceSuspended")
.flex-row.flex-between.flex-center.flex-column-tablet
section.input-group.width-45
input.form-control.brdrn(
Expand Down Expand Up @@ -56,6 +56,9 @@
.mts.pos-rel(ng-hide="tradingDisabled")
span.pos-abs.type-sm.state-danger-text(ng-click="setFiat(limits.absoluteMin(transaction.currency.code)); updateLastInput('fiat'); transaction.fiat && getQuote();" ng-show="fiatForm.fiat.$error.min" translate="BUY_AMT_LOW" translate-values="{limit: limits.absoluteMin(transaction.currency.code), symbol: symbol}")
span.pos-abs.type-sm.state-danger-text(ng-click="setFiat(limits.absoluteMax(transaction.currency.code)); updateLastInput('fiat'); transaction.fiat && getQuote();" ng-show="fiatForm.fiat.$error.max" translate="BUY_AMT_HIGH" translate-values="{limit: limits.absoluteMax(transaction.currency.code), symbol: symbol}")
.mts.pos-rel(ng-show="serviceSuspended && serviceSuspendedReason === 'service_temporarily_unavailable'")
span.pos-abs.type-sm
span.state-danger-text(translate="TRADING_SERVICE_IS_DISABLED")
.mts.pos-rel(ng-show="tradingDisabled && tradingDisabledReason === 'disabled'")
span.pos-abs.type-sm
span.state-danger-text(translate="TRADING_IS_DISABLED")
Expand Down Expand Up @@ -89,4 +92,4 @@
a(href="https://www.coinify.com/" target="_blank" rel="noopener noreferrer")
img(src="img/coinify-logo.svg")
span.pos-abs.fade.height-100.width-100(uib-tooltip="{{'PROCESSED_BY_EXCHANGE' | translate}}" tooltip-append-to-body="true")
button.button-primary(translate="Buy Bitcoin" type="submit" ng-disabled="!fiatForm.$valid || status.busy || tradingDisabled")
button.button-primary(translate="Buy Bitcoin" type="submit" ng-disabled="!fiatForm.$valid || status.busy || tradingDisabled || serviceSuspended")
14 changes: 6 additions & 8 deletions app/templates/exchange/checkout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ form.bc-form(
type="number"
name="fiat"
ng-model="state.fiat"
ng-max="max"
ng-min="min"
ng-max="max.fiat"
ng-min="min.fiat"
ng-change="state.baseCurr = dollars"
step="1"
prevent-event="mousewheel"
transform-currency="dollars"
focus-when="true"
required)
span.mhm {{dollars.code}}
Expand All @@ -42,12 +41,11 @@ form.bc-form(
type="number"
name="btc"
ng-model="state.btc"
ng-max="max"
ng-min="min"
ng-max="max.btc"
ng-min="min.btc"
ng-change="state.baseCurr = bitcoin"
step="0.01"
prevent-event="mousewheel"
transform-currency="bitcoin"
required)
span.mhm {{bitcoin.code}}
.f-12.mts
Expand All @@ -70,14 +68,14 @@ form.bc-form(
.border-bottom.mhm
.flex-between.flex-center.form-control.bg-grey.no-border
span.colon BTC Order
span {{ format(fromSatoshi(state.btc || 0, bitcoin), bitcoin, true) }}
span {{ format(state.btc || 0, bitcoin, true) }}
.border-bottom.mhm(ng-if="typeof($ctrl.buyAccount) === 'object'")
.flex-between.flex-center.form-control.bg-grey.no-border(ng-if="typeof($ctrl.buyAccount) === 'object'")
span.colon Payment Method
span.capitalize {{ $ctrl.buyAccount.accountType }} ({{ $ctrl.buyAccount.accountNumber }})
.border-bottom.mhm
.flex-between.flex-center.form-control.bg-grey.no-border.em-500
span.colon Total Cost
span {{ format(fromSatoshi(state.total || 0, dollars), dollars, true) }}
span {{ format(state.total || 0, dollars, true) }}
.group.mtl(ng-show="$ctrl.collapseSummary")
button.btn.button-primary.full(type="submit" ng-disabled="locked || checkoutForm.$invalid || !quote || state.loadFailed") Buy Bitcoin
2 changes: 1 addition & 1 deletion app/templates/exchange/verify.pug
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
.row
.col-md-12
button.btn.button-primary.full(type="submit" ng-disabled="$ctrl.addressForm.$invalid") Continue
form.bc-form(ng-if="$ctrl.onStep('info')" name="$ctrl.infoForm" role="form" ng-submit="$ctrl.setProfile()" novalidate autocomplete="off")
form.bc-form(ng-if="$ctrl.onStep('info')" name="$ctrl.infoForm" role="form" ng-submit="$ctrl.setBankInfo()" novalidate autocomplete="off")
fieldset(ng-disabled="locked")
.row
.col-md-6
Expand Down
11 changes: 7 additions & 4 deletions app/templates/sell-quick-start.pug
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.flex-row.flex-between
.flex-center
label.em-500(translate="ENTER_AMOUNT:")
.flex-center(ng-hide="$ctrl.status.fetching")
.flex-center(ng-hide="$ctrl.status.fetching || $ctrl.serviceSuspended")
span.type-sm.em-500 1 BTC = {{ exchangeRate.fiat }} {{$ctrl.transaction.currency.code}}
helper-button(content="EXCHANGE_RATE_HELPER")
.flex-row.flex-center(ng-show="$ctrl.status.fetching")
Expand Down Expand Up @@ -55,7 +55,7 @@
ng-click="handleCurrencyClick({currency: currency}); getQuote();"
ng-class="{active: isCurrencySelected(currency)}")
a(ng-click="$event.preventDefault()") {{ currency.code }}
.mts.pos-rel.mb-10.mtm.pbl(ng-show="showZeroBalance && !isPendingSellTrade()")
.mts.pos-rel.mb-10(ng-show="!$ctrl.serviceSuspended && showZeroBalance && !isPendingSellTrade()")
| 😢
|
span.type-sm(translate="SELL.ZERO_BALANCE")
Expand All @@ -65,10 +65,13 @@
span or
|  
a(ng-click="$ctrl.selectTab({tab:'BUY_BITCOIN'})") Buy.
.pos-rel.mt-10(ng-hide="tradingDisabled || $ctrl.error.moreThanInWallet")
.mts.pos-rel(ng-hide="tradingDisabled || $ctrl.error.moreThanInWallet")
span.pos-abs.type-sm.state-danger-text(ng-click="setFiat(limits.bank.min[$ctrl.transaction.currency.code]); updateLastInput('fiat'); $ctrl.transaction.fiat && getQuote();" ng-show="fiatForm.fiat.$error.min" translate="SELL_AMT_LOW" translate-values="{limit: limits.bank.min[$ctrl.transaction.currency.code], symbol: $ctrl.sellCurrencySymbol.symbol}")
span.pos-abs.type-sm.state-danger-text(ng-click="setFiat(limits.bank.maxOutRemaining[$ctrl.transaction.currency.code]); updateLastInput('fiat'); $ctrl.transaction.fiat && getQuote();" ng-show="fiatForm.fiat.$error.max" translate="SELL_AMT_HIGH" translate-values="{limit: limits.bank.maxOutRemaining[$ctrl.transaction.currency.code], symbol: $ctrl.sellCurrencySymbol.symbol}")
.mtm.pos-rel(ng-show="$ctrl.error.moreThanInWallet")
.mts.pos-rel(ng-show="$ctrl.serviceSuspended && $ctrl.serviceSuspendedReason === 'service_temporarily_unavailable'")
span.pos-abs.type-sm
span.state-danger-text(translate="TRADING_SERVICE_IS_DISABLED")
.mtm.pos-rel(ng-show="!$ctrl.serviceSuspended && $ctrl.error.moreThanInWallet && !fiatForm.fiat.$error.min && !fiatForm.fiat.$error.max")
span.pos-abs.state-danger-text(ng-show="$ctrl.error.moreThanInWallet && !multipleAccounts()" translate="SELL.MORE_THAN_BALANCE")
span.pos-abs.state-danger-text(ng-show="$ctrl.error.moreThanInWallet && multipleAccounts()" translate="SELL.MORE_THAN_BALANCE_LABELS" translate-values="{account: defaultAccount()}")
br
Expand Down
5 changes: 5 additions & 0 deletions assets/css/modules/_landing.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
.play-store-badge {
height: 60px;
}
@media (max-width: 991px) {
.banner {
background-position: calc(60% - 140px) 50%;
}
}
}

.blocket-loading {
Expand Down
3 changes: 3 additions & 0 deletions assets/js/components/coinify/sell-summary.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ angular
function CoinifySellSummaryController ($q, Wallet, currency, Alerts, $timeout) {
this.sellRateForm;

const setFee = (data) => this.payment.updateFeePerKb(data.fees.priority);
this.payment.sideEffect(setFee);

this.insufficientFunds = () => {
const tx = this.transaction;
const combined = tx.btc + tx.fee.btc;
Expand Down
17 changes: 10 additions & 7 deletions assets/js/components/exchange/exchange-checkout.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function ExchangeCheckoutController (Env, AngularHelper, $scope, $timeout, $q, c
};

$scope.getQuoteArgs = (state) => ({
amount: state.baseFiat ? $scope.fromSatoshi(state.fiat, $scope.dollars) * this.conversion | 0 : $scope.fromSatoshi(state.btc * 100000000, $scope.bitcoin),
amount: state.baseFiat ? state.fiat * this.conversion | 0 : state.btc * 1e8,
baseCurr: state.baseCurr.code,
quoteCurr: state.quoteCurr.code
});
Expand All @@ -79,9 +79,8 @@ function ExchangeCheckoutController (Env, AngularHelper, $scope, $timeout, $q, c
state.loadFailed = false;
this.collapseSummary = true;
$scope.refreshTimeout = $timeout($scope.refreshQuote, quote.timeToExpiration);
if (state.baseFiat) state.btc = quote.quoteAmount;
else state.fiat = $scope.toSatoshi(quote.quoteAmount, $scope.dollars) / this.conversion;
$scope.getInitialQuote();
if (state.baseFiat) state.btc = quote.quoteAmount / 1e8;
else state.fiat = quote.quoteAmount;
};

this.handleQuote($scope.getQuoteArgs(state))
Expand All @@ -91,7 +90,7 @@ function ExchangeCheckoutController (Env, AngularHelper, $scope, $timeout, $q, c
});

$scope.getInitialQuote = () => {
let args = { amount: 100000000, baseCurr: $scope.bitcoin.code, quoteCurr: $scope.dollars.code };
let args = { amount: 1e8, baseCurr: $scope.bitcoin.code, quoteCurr: $scope.dollars.code };
let quoteP = $q.resolve(this.handleQuote(args));
quoteP.then(quote => { $scope.state.rate = quote.quoteAmount; });
};
Expand Down Expand Up @@ -138,8 +137,12 @@ function ExchangeCheckoutController (Env, AngularHelper, $scope, $timeout, $q, c
}
};

$scope.$watch('$ctrl.limits.min', (limit) => $scope.min = $scope.toSatoshi(limit || 0.01, $scope.dollars));
$scope.$watch('$ctrl.limits.max', (limit) => $scope.max = $scope.toSatoshi(limit, $scope.dollars));
$scope.$watch('state.rate', (rate) => {
if (!rate) return;
let limits = this.limits;
$scope.min = { fiat: limits.min, btc: limits.min / rate };
$scope.max = { fiat: limits.max, btc: limits.max / rate };
});
$scope.$watch('state.fiat', () => state.baseFiat && $scope.refreshIfValid('fiat'));
$scope.$watch('state.btc', () => !state.baseFiat && $scope.refreshIfValid('btc'));
$scope.$on('$destroy', $scope.cancelRefresh);
Expand Down
7 changes: 7 additions & 0 deletions assets/js/components/exchange/exchange-verify.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ angular
initialStep: '<',
onVerify: '&',
onSetProfile: '&',
onSetBankInfo: '&',
mobilePreferred: '@'
},
templateUrl: 'templates/exchange/verify.pug',
Expand Down Expand Up @@ -46,10 +47,12 @@ function ExchangeVerifyController (Env, $scope, bcPhoneNumber, QA, unocoin, stat
case 'You entered wrong account number':
this.goTo('info');
$timeout(() => $scope.$ctrl.infoForm.bankAccountNumber.$setValidity('correct', false), 100);
this.profile.submittedBankInfo = false;
break;
case 'You entered wrong IFSC':
this.goTo('info');
$timeout(() => $scope.$ctrl.infoForm.ifsc.$setValidity('correct', false), 100);
this.profile.submittedBankInfo = false;
break;
default:
Exchange.displayError(error);
Expand Down Expand Up @@ -80,6 +83,10 @@ function ExchangeVerifyController (Env, $scope, bcPhoneNumber, QA, unocoin, stat
this.step < Object.keys(this.steps).length - 1 ? this.step++ : this.onVerify();
};

this.setBankInfo = () => {
this.onSetBankInfo();
};

this.error && this.displayInlineError(this.error);

// QA Tools
Expand Down
14 changes: 10 additions & 4 deletions assets/js/components/sell-quick-start.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ angular
controllerAs: '$ctrl'
});

function sellQuickStartController ($scope, $rootScope, currency, buySell, Alerts, $interval, $timeout, modals, Wallet, MyWalletHelpers, $q, $stateParams, $uibModal) {
function sellQuickStartController ($scope, $rootScope, currency, buySell, Alerts, $interval, $timeout, modals, Wallet, MyWalletHelpers, $q, $stateParams, $uibModal, Exchange) {
$scope.exchangeRate = {};
$scope.tradingDisabled = this.tradingDisabled;
$scope.currencies = currency.coinifySellCurrencies;
Expand Down Expand Up @@ -137,9 +137,15 @@ function sellQuickStartController ($scope, $rootScope, currency, buySell, Alerts
}
};

const error = () => {
this.status = {};
Alerts.displayError('ERROR_QUOTE_FETCH');
const error = (err) => {
let error = Exchange.interpretError(err);
if (error === 'service_temporarily_unavailable') {
this.serviceSuspended = true;
this.serviceSuspendedReason = error;
} else {
this.status = {};
Alerts.displayError('ERROR_QUOTE_FETCH');
}
};

$scope.triggerSell = () => {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/constants/wallet-stats.constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ angular
.module('walletApp')
.constant('walletStats', {
transactionsCountMillions: 100,
walletCountMillions: 14
walletCountMillions: 15
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ function CoinifyTradeSummaryController ($scope, $q, formatTrade) {
let completedState = $scope.vm.completedState || trade.state;
$scope.formattedTrade = formatTrade[completedState](trade);

$scope.isPendingBankTransfer = () => trade.state === 'awaiting_transfer_in' && trade.medium === 'bank';

$scope.fakeBankTransfer = () => {
$q.resolve(trade.fakeBankTransfer())
.then(() => trade.refresh())
Expand Down
17 changes: 13 additions & 4 deletions assets/js/controllers/unocoin/unocoinBankTransfer.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ angular

let enumify = (...ns) => ns.reduce((e, n, i) => angular.merge(e, {[n]: i}), {});

function UnocoinBankTransferController (trade, bankAccount, $uibModalInstance, formatTrade, $q, unocoin, modals, AngularHelper, Alerts, Env) {
function UnocoinBankTransferController (trade, bankAccount, $uibModalInstance, formatTrade, $q, unocoin, modals, AngularHelper, Alerts, Env, localStorageService) {
Env.then(env => {
let links = env.partners.unocoin.surveyTradeLinks;

this.close = () => {
Alerts.surveyCloseConfirm('unocoin-trade-survey', links, this.step).then($uibModalInstance.dismiss);
let survey = 'unocoin-trade-survey';
let surveyCache = localStorageService.get(survey);
let shouldClose = surveyCache && surveyCache.index === links.length - 1;

if (shouldClose) $uibModalInstance.dismiss();
else Alerts.surveyCloseConfirm(survey, links, this.step).then($uibModalInstance.dismiss);
};
});

Expand All @@ -25,8 +30,12 @@ function UnocoinBankTransferController (trade, bankAccount, $uibModalInstance, f
this.addReferenceNumber = () => {
this.lock();
$q.resolve(trade.addReferenceNumber(this.state.reference))
.then((trade) => this.formattedTrade = formatTrade.initiated(trade))
.then(() => this.goTo('initiated'))
.then((trade) => {
this.formattedTrade = formatTrade.initiated(trade);
})
.then(() => {
this.goTo('initiated');
})
.catch((err) => { console.log(err); }).finally(this.free);
};

Expand Down
Loading

0 comments on commit 307c523

Please sign in to comment.