Add credit card expiration date to the billing info screen

This commit is contained in:
Joseph Schorr 2014-05-22 16:52:51 -04:00
parent f4c488f9b6
commit a9a8105fbc
4 changed files with 30 additions and 1 deletions

View file

@ -3293,6 +3293,13 @@ quayApp.directive('billingOptions', function () {
PlanService.unregisterListener(this);
});
$scope.isExpiringSoon = function(cardInfo) {
var current = new Date();
var expires = new Date(cardInfo.exp_year, cardInfo.exp_month, 1);
var difference = expires - current;
return difference < (60 * 60 * 24 * 60 * 1000 /* 60 days */);
};
$scope.changeCard = function() {
var previousCard = $scope.currentCard;
$scope.changingCard = true;