Billing info!

master
Nick Sergeant 2013-10-19 21:15:02 -04:00
parent ead89507be
commit efd2b35a0b
5 changed files with 42 additions and 4 deletions

View File

@ -26,7 +26,7 @@
<li ng-class="{active: route.current.scope.section == 'Editor'}">
<a href="/account/editor/">Editor</a>
</li>
<li ng-show="user.is_pro" ng-class="{active: route.current.scope.section == 'Billing'}">
<li ng-show="user.is_pro && user.stripe_id && user.stripe_id != 'COMP'" ng-class="{active: route.current.scope.section == 'Billing'}">
<a href="/account/billing/">Billing</a>
</li>
</ul>

View File

@ -30,6 +30,7 @@ def stripe_account_details(request):
'interval': customer.subscription.plan.interval,
'name': customer.subscription.plan.name,
'status': customer.subscription.status,
'nextBill': customer.subscription.current_period_end,
}

File diff suppressed because one or more lines are too long

View File

@ -51,6 +51,15 @@ if (typeof angular !== 'undefined') {
return promise;
},
getStripeAccount: function() {
var promise = $http({
method: 'GET',
url: '/account/stripe-account-details/'
});
return promise;
},
saveAccount: function(user, fields) {
var promise = $http({
@ -137,6 +146,12 @@ if (typeof angular !== 'undefined') {
AccountStorage.getAccount().then(function(response) {
$scope.user = response.data;
if ($scope.user.is_pro && $scope.user.stripe_id && $scope.user.stripe_id !== 'COMP') {
AccountStorage.getStripeAccount().then(function(response) {
$scope.user.stripeAccount = response.data;
});
}
});
$scope.saveFields = function(fields) {

View File

@ -1 +1,23 @@
<p class="alert alert-info">Working on this section. Stay tuned!</p>
<div class="def" data-title="Plan">
{[{ user.stripeAccount.name || 'Loading...' }]}
</div>
<div class="def" data-title="Price">
<span ng-show="user.stripeAccount">${[{ user.stripeAccount.amount / 100 }]}.00 USD / {[{ user.stripeAccount.interval }]}</span>
<span ng-show="!user.stripeAccount">Loading...</span>
</div>
<div class="def" data-title="Card">
<span ng-show="user.stripeAccount">xxxx-xxxx-xxxx-{[{ user.stripeAccount.last4 || 'Loading...' }]}</span>
<span ng-show="!user.stripeAccount">Loading...</span>
</div>
<div class="def" data-title="Status">
{[{ user.stripeAccount.status || 'Loading...' }]}
</div>
<div class="def" data-title="Pro since">
<span ng-show="user.stripeAccount">{[{ user.stripeAccount.created * 1000 |date:'fullDate' }]}</span>
<span ng-show="!user.stripeAccount">Loading...</span>
</div>
<div class="def" data-title="Next bill date">
<span ng-show="user.stripeAccount">{[{ user.stripeAccount.nextBill * 1000 |date:'fullDate' }]}</span>
<span ng-show="!user.stripeAccount">Loading...</span>
</div>
<p class="alert alert-info">Need to cancel? <a href="mailto:nick@snipt.net">Email Nick</a>.</p>