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

Commit

Permalink
feat(Recurring Buy): copy for recurring confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Welber committed Apr 10, 2018
1 parent 64ba9f8 commit 8d9fd4b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
15 changes: 7 additions & 8 deletions app/partials/coinify/recurring-confirm.pug
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
.pv-25.ph-25
.flex-column
span.f-18.mb-15.em-400(ng-hide="$ctrl.needsKyc" translate="RECURRING_CONFIRM_HEADER")
span.f-18.mb-15.em-400(ng-show="$ctrl.needsKyc" translate="RECURRING_CONFIRM_NEED_IDENTITY_HEADER")
span.f-14.em-300(ng-if="$ctrl.endTime && !$ctrl.needsKyc" translate="RECURRING_CONFIRM_BODY_WITH_ENDTIME" translate-values="{timing: $ctrl.recurringTiming(), end: $ctrl.endTime.toDateString()}")
span.f-14.em-300(ng-if="!$ctrl.endTime && !$ctrl.needsKyc" translate="RECURRING_CONFIRM_BODY" translate-values="{timing: $ctrl.recurringTiming()}")
span.f-14.em-300(ng-if="$ctrl.needsKyc" translate="RECURRING_CONFIRM_NEED_IDENTITY_BODY")
.f-18.mb-15.em-400
span.f-18.mb-15.em-400(translate="{{ 'RECURRING_CONFIRM' + '.' + $ctrl.state + '.' + 'HEADER' }}")
.f-14.em-300
span.f-14.em-300(translate="{{ 'RECURRING_CONFIRM' + '.' + $ctrl.state + '.' + 'BODY' }}" translate-values="{timing: $ctrl.recurringTiming()}")
.modal-footer.flex-end.flex-row
.flex-1.flex-end
button.button-muted.mrm(ng-click="$ctrl.onCancel()" translate="GO_BACK")
button.button-primary(ng-if="!$ctrl.needsKyc" translate="PROCEED_WITH_MY_ORDER" ng-click="$ctrl.onProceed()")
button.button-primary(ng-if="$ctrl.needsKyc" translate="PROCEED_TO_KYC" ng-click="$ctrl.onProceed()")
button.button-muted.mrm(ng-if="$ctrl.state !== 'NEEDS_TRADES'" ng-click="$ctrl.onCancel()" translate="GO_BACK")
button.button-primary(ng-if="$ctrl.state !== 'NEEDS_TRADES'" translate="{{ 'RECURRING_CONFIRM' + '.' + $ctrl.state + '.' + 'BUTTON' }}" ng-click="$ctrl.onProceed()")
button.button-primary(ng-if="$ctrl.state === 'NEEDS_TRADES'" translate="{{ 'RECURRING_CONFIRM' + '.' + $ctrl.state + '.' + 'BUTTON' }}" ng-click="$ctrl.onCancel()")
13 changes: 11 additions & 2 deletions assets/js/components/coinify/recurring-confirm.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ angular
controllerAs: '$ctrl'
});

function CoinifyRecurringConfirmController (recurringTrade) {
this.date = new Date()
function CoinifyRecurringConfirmController (recurringTrade, coinify) {
this.date = new Date();
this.recurringTiming = () => recurringTrade.getTimespan(this.date, this.frequency);
this.needsMoreTrades = coinify.trades.filter((t) => coinify.tradeStateIn(coinify.states.completed)(t) && !t.tradeSubscriptionId && t.medium === 'card').length < 3;

const determineState = () => {
if (this.needsKyc && this.needsMoreTrades) return 'NEEDS_KYC_AND_TRADES'
if (this.needsKyc) return 'NEEDS_KYC';
if (this.needsMoreTrades) return 'NEEDS_TRADES';
return 'PROCEED';
}
this.state = determineState();
}
2 changes: 1 addition & 1 deletion assets/js/controllers/coinify/coinify.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function CoinifyController ($rootScope, $scope, $q, $state, $timeout, $uibModalI
this.fiatAmount = () => this.baseFiat() ? Math.abs(this.quote.baseAmount) : Math.abs(this.quote.quoteAmount);
this.transactionFee = () => this.mediums ? this.mediums[this.medium || 'card'].outFixedFees['BTC'] * 1e8 : 0;
this.timeToExpiration = () => this.quote ? this.quote.expiresAt - this.now() : this.trade.expiresAt - this.now();
this.needsKYCForRecurring = this.exchange.profile.level && this.exchange.profile.level.name < 2
this.needsKYCForRecurring = this.exchange.profile.level && this.exchange.profile.level.name < 2;
this.triggerKYCForRecurring = () => { coinify.getOpenKYC(); this.trade = exchange.kycs[0]; this.goTo('isx') }
this.refreshQuote = () => {
if (this.baseFiat()) return $q.resolve(coinify.getQuote(this.fiatAmount() * 100, this.quote.baseCurrency)).then((q) => this.quote = q);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function CoinifyCheckoutController ($scope, $rootScope, $stateParams, Env, Angul

$scope.hasDismissedRecurringBuyIntro = () => localStorageService.get('dismissedRecurringBuyIntro');
$scope.dismissRecurringBuyIntro = () => localStorageService.set('dismissedRecurringBuyIntro', true);
$scope.disableRecurring = coinify.getPendingKYC();

Env.then(env => {
$scope.tabs = {
Expand All @@ -59,7 +60,6 @@ function CoinifyCheckoutController ($scope, $rootScope, $stateParams, Env, Angul
}
};
$scope.showRecurringBuy = MyWallet.wallet.accountInfo.countryCodeGuess !== 'UK' && env.partners.coinify.showRecurringBuy && $scope.exchange.profile.email; /* && $scope.exchange.profile.tradeSubscriptionsAllowed */
$scope.disableRecurring = coinify.getPendingKYC()

if (env.qaDebugger) {
$scope.qaDebugger = env.qaDebugger;
Expand Down
28 changes: 22 additions & 6 deletions locales/en-human.json
Original file line number Diff line number Diff line change
Expand Up @@ -2116,18 +2116,34 @@
"TITLE": "Feature Disabled",
"BODY": "This feature has been temporarily disabled. Please check back later when we are back up and running!"
},
"RECURRING_CONFIRM": {
"NEEDS_KYC_AND_TRADES": {
"HEADER": "Verify Your Identity and Complete 3 Orders",
"BODY": "To unlock the recurring buy feature, verify your identity and complete 3 credit card orders.",
"BUTTON": "Proceed To Verify My Identity"
},
"NEEDS_KYC": {
"HEADER": "Verify Your Identity",
"BODY": "To set up a recurring order, you first need to verify your identity",
"BUTTON": "Proceed To Verify My Identity"
},
"NEEDS_TRADES": {
"HEADER": "Complete 3 Orders",
"BODY": "To set up Recurring Orders you first need to complete 3 credit card orders with the same card.",
"BUTTON": "Close"
},
"PROCEED": {
"HEADER": "You're About To Set Up A Recurring Order",
"BODY": "This Recurring Order will happen today and every {{::timing}} until you cancel or reach your limit, whichever happens first.",
"BUTTON": "Proceed with my Order"
}
},
"RECURRING_INTRO_HEADER": "About Recurring Orders",
"RECURRING_INTRO_1": "You can now create recurring bitcoin purchases from within your wallet after verifying your account.",
"RECURRING_INTRO_2": "Select <b>'Make this a recurring order'</b>, set your recurring preferences, and continue with your purchase as normal. Each time an order is processed you will receive an email to notify you.",
"RECURRING_INTRO_3": "Recurring orders can be canceled at anytime from",
"RECURRING_INTRO_4": "Want to know more about Recurring Orders?",
"RECURRING_CONFIRM_HEADER": "You're About To Set Up A Recurring Order",
"RECURRING_CONFIRM_NEED_IDENTITY_HEADER": "Verify Your Identity",
"RECURRING_CONFIRM_BODY_WITH_ENDTIME": "This Recurring Order will happen today and every {{::timing}} until {{::end}} or you reach your limit, whichever happens first.",
"RECURRING_CONFIRM_BODY": "This Recurring Order will happen today and every {{::timing}} until you cancel or reach your limit, whichever happens first.",
"RECURRING_CONFIRM_NEED_IDENTITY_BODY": "To set up a recurring order, you first need to verify your identity",
"PROCEED_WITH_MY_ORDER": "Proceed with my Order",
"PROCEED_TO_KYC": "Proceed To Verify My Identity",
"ORDERS": "Orders.",
"LEARN_MORE_HERE": "Learn more here.",
"MAKE_RECURRING_ORDER": "Make this a recurring order",
Expand Down

0 comments on commit 8d9fd4b

Please sign in to comment.