<commit_before>from __future__ import division

from django.shortcuts import render_to_response,  get_object_or_404, redirect
from django.template.context import RequestContext, Context
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User

from django.core.mail import send_mail
from django.template.loader import render_to_string

import stripe

from models import *
from account.models import UserForm

def processStripe(request, customer = None):
    args = {}
    stripe.api_key = "<KEY>"
    token = request.POST['stripeToken']
    amount = request.POST['cc-amount']
    if customer is None:
        customer = stripe.Customer.create(
            source=token,
            description="New Customer"
        )
    try:
        charge = stripe.Charge.create(
            amount=int(amount), # amount in cents, again
            currency="usd",
            customer=customer.id,
        )
        args['cc_result'] = "Your card was successfully charged $" + str(float(amount) /100)
        #Save New customer to user
        if request.user.is_authenticated():
            if not BillingInfo.objects.filter(user=request.user).exists():
                billing = BillingInfo(user=request.user, stripe=customer.id)
                billing.save()
            else:
                request.user.billinginfo.stripe = customer.id
                request.user.billinginfo.save()
        order = processProducts(request, request.session.get('cart', {}))
        processEmail(order)
        redirect("/store", args)
    except stripe.error.CardError, e:
        # The card has been declined
        args['cc_result'] = e<commit_msg>removed sensitive data<commit_after>from __future__ import division

from django.shortcuts import render_to_response,  get_object_or_404, redirect
from django.template.context import RequestContext, Context
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User

from django.core.mail import send_mail
from django.template.loader import render_to_string

import stripe

from models import *
from account.models import UserForm

def processStripe(request, customer = None):
    args = {}
    stripe.api_key = "INSERT STRIPE KEY"
    token = request.POST['stripeToken']
    amount = request.POST['cc-amount']
    if customer is None:
        customer = stripe.Customer.create(
            source=token,
            description="New Customer"
        )
    try:
        charge = stripe.Charge.create(
            amount=int(amount), # amount in cents, again
            currency="usd",
            customer=customer.id,
        )
        args['cc_result'] = "Your card was successfully charged $" + str(float(amount) /100)
        #Save New customer to user
        if request.user.is_authenticated():
            if not BillingInfo.objects.filter(user=request.user).exists():
                billing = BillingInfo(user=request.user, stripe=customer.id)
                billing.save()
            else:
                request.user.billinginfo.stripe = customer.id
                request.user.billinginfo.save()
        order = processProducts(request, request.session.get('cart', {}))
        processEmail(order)
        redirect("/store", args)
    except stripe.error.CardError, e:
        # The card has been declined
        args['cc_result'] = e
{'fraction_non_alphanumeric': 0.09506726457399103, 'fraction_numerical': 0.003587443946188341, 'mean_word_length': 2.664841182913472, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '5958713', 'n_tokens_mistral': 923, 'n_tokens_neox': 890, 'n_words': 227}