<commit_before>angular.module('blueRidgeApp')
.controller('SubscriptionCtrl',function($scope,$location,Auth,Restangular,PaymentHelpers){
    Restangular.one('services','cashier').get().then(function(cashier){
        $scope.cashier=cashier;
    });

    $scope.alerts = [];

    $scope.closeAlert = function(index) {
        $scope.alerts.splice(index, 1);
    };

    $scope.open=function(){
        $scope.shouldBeOpen = true;
        Stripe.setPublishableKey($scope.cashier.key);

    };

    $scope.makePayment = function(card){

        if(typeof card != 'undefined'){
            var expiry = PaymentHelpers.cardExpiryVal(card.expiry);

            var subscriber = {
                name:card.name,
                number:card.number,
                exp_month:expiry.month,
                exp_year:expiry.year
            }
            Stripe.card.createToken(subscriber, $scope.subscribe);

        }else{
            $scope.alerts.push({ type: 'error', msg: 'Oh snap! Double check on you payment info and try submitting again.' });
        }

    };

    $scope.subscribe = function(status, response){
        if (response.error) {
            $scope.alerts.push({ type: 'error', msg: 'Oh my! '+response.error.message });
        } else {

            console.log(response);
        }
    };
});<commit_msg>-n  close bottom<commit_after>angular.module('blueRidgeApp')
.controller('SubscriptionCtrl',function($scope,$location,Auth,Restangular,PaymentHelpers){
    Restangular.one('services','cashier').get().then(function(cashier){
        $scope.cashier=cashier;
    });

    $scope.alerts = [];

    $scope.closeAlert = function(index) {
        $scope.alerts.splice(index, 1);
    };

     $scope.close=function(){
        $scope.shouldBeOpen = false;
    };

    $scope.open=function(){
        $scope.shouldBeOpen = true;
        Stripe.setPublishableKey($scope.cashier.key);

    };

    $scope.makePayment = function(card){

        if(typeof card != 'undefined'){
            var expiry = PaymentHelpers.cardExpiryVal(card.expiry);

            var subscriber = {
                name:card.name,
                number:card.number,
                exp_month:expiry.month,
                exp_year:expiry.year
            }
            Stripe.card.createToken(subscriber, $scope.subscribe);

        }else{
            $scope.alerts.push({ type: 'error', msg: 'Oh snap! Double check your card details and try submitting again.' });
        }

    };

    $scope.subscribe = function(status, response){
        if (response.error) {
            $scope.alerts.push({ type: 'error', msg: 'Oh my! '+response.error.message });
        } else {

            console.log(response);
        }
    };
});
{'fraction_non_alphanumeric': 0.14491150442477876, 'fraction_numerical': 0.0007374631268436578, 'mean_word_length': 2.256902761104442, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7313691', 'n_tokens_mistral': 840, 'n_tokens_neox': 787, 'n_words': 124}