def get_all_rental_plans_info(request): result = [] # Campaign #6 -- Commission Junction # Campaign #13 -- Neverblue if not request.user.is_authenticated() and request.campaign_id in ['6', '13']: plans = [RentalPlan.PlanA, RentalPlan.PlanB] else: plans = [RentalPlan.PlanA, RentalPlan.PlanB, RentalPlan.PlanD, RentalPlan.PlanE, RentalPlan.PlanC] for plan in plans: _plan = RentalPlan.get_details2(plan, request) or {} _plan.update({ 'price_display': RentalPlan.get_price_display(plan), 'allowed': RentalPlan.get_allowed_games_amount(plan), }) result.append(_plan) return result
def account_billing_history(request): history = {} qs = BillingHistory.objects.filter(user=request.user, status__in=[TransactionStatus.Passed], type__in=[TransactionType.RentPayment, TransactionType.BuyCheckout]) years = [y.year for y in qs.dates('timestamp', 'year')] years.sort() months = [m for m in qs.dates('timestamp', 'month')] months.sort() for m in months: history[m] = qs.filter(timestamp__year=m.year, timestamp__month=m.month) plan = MemberRentalPlan.get_current_plan(request.user) return { 'title': 'Billing History', 'price': RentalPlan.get_price_display(plan.plan) if plan else None, 'membership_terms': RentalPlan.get_membership_terms(plan.plan) if plan else None, 'years': years, 'months': months, 'history': history, }
def _(plan): return { 'price_display': RentalPlan.get_price_display(plan), }