credit card edit elimated. The new card is a little more fastter. The whirte margin is again eliminated.

This commit is contained in:
unknown 2017-01-06 11:33:55 -04:00
parent 2b2b40a9ef
commit af3980d372
3 changed files with 19 additions and 71 deletions

View file

@ -72,7 +72,7 @@
</div> </div>
{% if credit_card_data.last4 %} {% if credit_card_data.last4 %}
<form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate> <form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate>
<h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:TermsAndConditions' %}">New</a><a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:edit_credit_card' %}">Edit</a></h2> <h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:TermsAndConditions' %}">New</a></h2>
<h2 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h2> <h2 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h2>
<h2 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h2> <h2 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h2>
<input type="hidden" name="credit_card_needed" value="false"/> <input type="hidden" name="credit_card_needed" value="false"/>

View file

@ -111,7 +111,16 @@
.dropdown.home-dropdown { .dropdown.home-dropdown {
display: none; display: none;
} }
}
html,body{
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow-x: hidden;
}
</style> </style>
</head> </head>

View file

@ -93,86 +93,25 @@ class ValidateView(SignupViewMixin):
form_class = SignupForm form_class = SignupForm
success_url = reverse_lazy('digitalglarus:login') success_url = reverse_lazy('digitalglarus:login')
#def activarUsuario(request, pk):
#if request.method == 'POST':
# u = U.objects.get(pk = pk)
# u.is_active = True
# u.save()
# messages.info(request, 'Usuario Activado')
# Log('activar','usuario',request)
#resp = dict()
#resp['msg'] = 0 #0 para exito
#return HttpResponse(json.dumps(resp), content_type ='application/json')
@csrf_exempt @csrf_exempt
def TermsAndConditions(request): def TermsAndConditions(request):
cus = StripeCustomer.get_or_create(email=request.user.email) cus = StripeCustomer.get_or_create(email=request.user.email)
s= str(cus) s= str(cus)
s= s.split(" ") s= s.split(" ")
#t=stripe.Customer.retrieve(s[0]).sources.all(object="card")
#tt=t['data']
#print (tt)
#for i in tt:
# print (i.id)
# print (i.last4)
# print ("aja estoy aqui",i.id)
# customer = stripe.Customer.retrieve(s[0])
# customer.sources.retrieve(i.id).delete()
# crear tarjeta de credito
customer = stripe.Customer.retrieve(s[0])
#print ("voy por aqui")
custom_card= customer.default_source
t=stripe.Customer.retrieve(s[0]).sources.all(object="card")
tt=t['data']
#print (tt)
cc = dict() cc = dict()
for i in tt: customer = stripe.Customer.retrieve(s[0])
#print (i.id) custom_card= customer.default_source
#print (i.last4) card = customer.sources.retrieve(custom_card)
if i.id== custom_card: cc['last4']= card.last4
#print ("ESTA ES LA TARJETA ACTUAL") cc['cc_brand'] = card.brand
cc['last4']= i.last4
cc['cc_brand'] = i.brand
#customer.sources.create(source=resp)
#t=stripe.Customer.retrieve(s[0]).sources.all(object="card")
#tt=t['data']
#x= resp['number']
#for i in tt:
# print (i.id)
# print (i.last4)
# print (x[-4:])
# if i.last4 == x[-4:]:
# print ("ESTOY AQUI")
# customer.default_source= i.id
#customer.save()
m=MembershipOrder.objects.filter(customer__user=request.user) m=MembershipOrder.objects.filter(customer__user=request.user)
customer = StripeCustomer.get_or_create(email=request.user.email) #customer = StripeCustomer.get_or_create(email=request.user.email)
last_booking_order = BookingOrder.objects.filter(customer__user=request.user).last() last_booking_order = BookingOrder.objects.filter(customer__user=request.user).last()
last_membership_order = MembershipOrder.objects.filter(customer__user=request.user).last() last_membership_order = MembershipOrder.objects.filter(customer__user=request.user).last()
credit_card_data = last_booking_order.get_booking_cc_data() if last_booking_order \
and last_booking_order.get_booking_cc_data() \
else last_membership_order.get_membership_order_cc_data()
current_billing_address = request.user.billing_addresses.first() current_billing_address = request.user.billing_addresses.first()
#return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request))
return render_to_response('digitalglarus/new_credit_card.html',{'last4':cc['last4'],'brand_type':cc['cc_brand'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request)) return render_to_response('digitalglarus/new_credit_card.html',{'last4':cc['last4'],'brand_type':cc['cc_brand'],'stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request))
#return render_to_response('digitalglarus/new_credit_card.html',{'last4':'probando','brand_type':'probando','stripe_key': settings.STRIPE_API_PUBLIC_KEY,'street_address': current_billing_address.street_address,'city': current_billing_address.city, 'postal_code': current_billing_address.postal_code,'country': current_billing_address.country,},context_instance= RequestContext(request))
'''
def g
et_success_url(self):
# redirect to membership orders list if user has at least one.
print (self.request.user)
print ("JNSKDJNASJDNKSJANDKJNSAKJDNKJND")
'''
def TermsAndConditions3(request): def TermsAndConditions3(request):
return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand']}) return render_to_response('digitalglarus/new_credit_card.html',{'last4':credit_card_data['last4'],'brand_type':credit_card_data['cc_brand']})