示例#1
0
def transfer_credit(request):
	user = page_users_utils.get_user_info(request.user.email)
	return direct_to_template(request, 
		'transfer_credit.html',
		{'transfer_cost':constants.CUSTO_TRANSFERENCIA_ENTRE_USERS,
		'moeda':constants.MOEDA_DA_PAGINA,
		'saldo':user.saldo })
示例#2
0
def success_checkout(request):
	last = compras_historico_utils.get_last_order_by_user(request.user.email)
	if last == None:
		return direct_to_template(request, 'success_checkout.html', {'no_orders':"XXX"})

	user = page_users_utils.get_user_info(request.user.email)
	
	saldo = user.saldo
	
	if saldo < 0:
		saldo = saldo*-1
		
		###WRONG!!!!
		nice_metodo = "Paypal"
		
		page_users_utils.add_payment_user(request,request.user.email, saldo, nice_metodo,store=True)
		if user.pais == "Portugal":
			return direct_to_template(request, 'success_checkout.html',
				{'order':last,
				'portugal':user.pais,
				'negative_client':saldo,
				'negative_client_conversion':card_database_utils.real_price_by_credits(saldo,user.pais)})
		if user.pais == "Brasil":
			return direct_to_template(request, 'success_checkout.html',
				{'order':last,
				'brasil':user.pais,
				'negative_client':saldo,
				'negative_client_conversion':card_database_utils.real_price_by_credits(saldo,user.pais)})
	
	return direct_to_template(request, 'success_checkout.html',{'order':last})
示例#3
0
def store(request):
	user = page_users_utils.get_user_info(request.user.email)
	numero_cartas = compras_historico_utils.get_total_number_cards(request)
	
	return direct_to_template(request, 
		'store.html',{'saldo':user.saldo,
		'moeda': constants.MOEDA_DA_PAGINA,
		'numero_cartas': numero_cartas,
		'number_results':constants.USER_SEARCH_COUNT})
示例#4
0
def change_info(request):
	user = page_users_utils.get_user_info(request.user.email)
	cod_postal_items = page_users_utils.split_cod_postal(user.codigopostal)
	return direct_to_template(request, 'change_info.html', 
		{'nome':user.nome,'morada': user.morada, 
		'telefone':user.telefone, 
		'cod_post':cod_postal_items[0], 
		'cod_post2':cod_postal_items[1], 
		'saldo': str(page_users_utils.get_saldo_from_email(request.user.email)), 
		'moeda': constants.MOEDA_DA_PAGINA} )
示例#5
0
def checkout(request):

	user = page_users_utils.get_user_info(request.user.email)

	#random card list
	card_list_random = compras_historico_utils.return_list_of_cards_from_compras(request.user.email)
	
	#store card list
	card_list_store = compras_historico_utils.return_list_of_cards_from_request(request)
	
	#get total price for store cart
	total_price = compras_historico_utils.get_total_price_cart(card_list_store)
	
	#total price convertion
	total_price_conversion = card_database_utils.real_price_by_credits(total_price,user.pais)
	
	if user.pais == "Portugal":
		info = {'portugal':user.pais,
		'saldo': str(page_users_utils.get_saldo_from_email(request.user.email)),
		'total_price':total_price,'total_price_conversion':total_price_conversion, 
		'moeda': constants.MOEDA_DA_PAGINA,'cartas_random': card_list_random,
		'cartas_store': card_list_store,
		'pais': user.pais,'morada': user.morada, 
		'telefone':user.telefone, 
		'cod_post':user.codigopostal,
		'nome':user.nome,
		'internacional': constants.CORREIO_INTERNACIONAL,
		'azul': constants.CORREIO_AZUL,
		'registado': constants.CORREIO_REGISTADO}
	if user.pais == "Brasil":
		info = {'brasil':user.pais,
		'saldo': str(page_users_utils.get_saldo_from_email(request.user.email)),
		'total_price':total_price,
		'total_price_conversion':total_price_conversion, 
		'moeda': constants.MOEDA_DA_PAGINA,
		'cartas_random': card_list_random,
		'cartas_store': card_list_store,
		'pais': user.pais,
		'morada': user.morada, 
		'telefone':user.telefone, 
		'cod_post':user.codigopostal,
		'nome':user.nome,
		'internacional': constants.CORREIO_INTERNACIONAL,
		'internacional_rastreio': constants.CORREIO_INTERNACIONAL_COM_RASTREIO}
	
	return direct_to_template(request, 'checkout.html',info)
示例#6
0
def main(request):
	user = page_users_utils.get_user_info(request.user.email)
	return direct_to_template(request, 'main.html',{'saldo':user.saldo, 'moeda': constants.MOEDA_DA_PAGINA})