Esempio n. 1
0
def admin():
    """If merchant is logged in display billing plans in created and active states
    """
    if session.get('logged_in') and session.get('merchant'):
        plans_created_query_dict = BillingPlan.all({
            "status": "CREATED",
            "sort_order": "DESC"
        })
        plans_created = plans_created_query_dict.to_dict().get('plans')
        if not plans_created:
            plans_created = []

        plans_active_query_dict = BillingPlan.all({
            "status": "ACTIVE",
            "page": 4,
            "total_required": "yes"
        })
        plans_active = plans_active_query_dict.to_dict().get('plans')
        if not plans_active:
            plans_active = []

        return render_template('admin.html',
                               plans_created=plans_created,
                               plans_active=plans_active)
    else:
        return redirect(url_for('login'))
Esempio n. 2
0
def admin():
    """If merchant is logged in display billing plans in created and active states
    """
    if session.get('logged_in') and session.get('merchant'):
        plans_created = BillingPlan.all({"status": "CREATED", "sort_order": "DESC"})['plans']
        plans_active = BillingPlan.all({"status": "ACTIVE", "sort_order": "DESC"})['plans']
        return render_template('admin.html', plans_created=plans_created, plans_active=plans_active)
    else:
        return redirect(url_for('login'))
Esempio n. 3
0
def subscriptions():
    """If customer is logged in display active billing plans in
    descending order of creation time
    """
    if session.get('logged_in') and session.get('customer'):
        plans_active = BillingPlan.all({"status": "ACTIVE", "sort_order": "DESC"})['plans']
        return render_template('subscriptions.html', plans=plans_active)
    else:
        return redirect(url_for('login'))
Esempio n. 4
0
def admin():
    """If merchant is logged in display billing plans in created and active states
    """
    if session.get('logged_in') and session.get('merchant'):
        plans_created_query_dict = BillingPlan.all({"status": "CREATED",
                                                    "sort_order": "DESC"})
        plans_created = plans_created_query_dict.to_dict().get('plans')
        if not plans_created:
            plans_created = []

        plans_active_query_dict = BillingPlan.all({"status": "ACTIVE",
                                                   "page_size": 5, "page": 0, "total_required": "yes"})
        plans_active = plans_active_query_dict.to_dict().get('plans')
        if not plans_active:
            plans_active = []

        return render_template('admin.html', plans_created=plans_created, plans_active=plans_active)
    else:
        return redirect(url_for('login'))
Esempio n. 5
0
    def get_billing_plans(self, status="ACTIVE"):
        """
        status: CREATED, ACTIVE, INACTIVE, ALL

        :param status:
        :return:
        """
        plans = BillingPlan.all({"status": status})
        if 'plans' in plans:
            return plans["plans"]
        return []
Esempio n. 6
0
    def get(self):
        status = self.get_argument('status')  # ACTIVE INACTIVE
        plans = []
        plans_query_dict = BillingPlan.all({
            "status": status,
            "sort_order": "DESC"
        })

        if plans_query_dict:
            plans = plans_query_dict.to_dict().get('plans')

        self.write({'response': plans})
Esempio n. 7
0
    def get(self):
        plans_created = []
        plans_active = []
        plans_created_query_dict = BillingPlan.all({
            "status": "CREATED",
            "sort_order": "DESC"
        })
        plans_created = plans_created_query_dict.to_dict().get('plans')

        plans_active_query_dict = BillingPlan.all({
            "status": "ACTIVE",
            "page_size": 5,
            "page": 0,
            "total_required": "yes"
        })
        plans_active = plans_active_query_dict.to_dict().get('plans')

        self.write({
            "response": {
                "plans_created": plans_created,
                "plans_active": plans_active
            }
        })
Esempio n. 8
0
def subscriptions():
    """If customer is logged in display active billing plans in
    descending order of creation time
    """
    if session.get('logged_in') and session.get('customer'):

        plans_active_query_dict = BillingPlan.all({"status": "ACTIVE",
                                                   "sort_order": "DESC"})

        if plans_active_query_dict:
            plans_active = plans_active_query_dict.to_dict().get('plans')
        else:
            plans_active = []
        return render_template('subscriptions.html', plans=plans_active)
    else:
        return redirect(url_for('login'))
Esempio n. 9
0
from paypalrestsdk import BillingPlan
import logging
logging.basicConfig(level=logging.INFO)

history = BillingPlan.all({"status": "CREATED", "page_size": 5, "page": 1, "total_required": "yes"})
print(history)

print("List BillingPlan:")
for plan in history.plans:
    print("  -> BillingPlan[%s]" % (plan.id))
Esempio n. 10
0
	def get_all_billing_plans(self):
		history = BillingPlan.all({"status": "ACTIVE", "sort_order": "DESC"})
		#if history:
		#	for plan in history.plans:
		#		print("{}".format(plan.id))
		return history
Esempio n. 11
0
File: paypal.py Progetto: laxdog/mms
def getplans():
    plans = BillingPlan.all(api=api)
    if 'plans' in plans:
        return plans['plans']
    else:
        return None
Esempio n. 12
0
from paypalrestsdk import BillingPlan
import logging
logging.basicConfig(level=logging.INFO)

history = BillingPlan.all(
    {"status": "CREATED", "page_size": 5, "page": 1, "total_required": "yes"})
print(history)

print("List BillingPlan:")
for plan in history.plans:
    print("  -> BillingPlan[%s]" % (plan.id))
Esempio n. 13
0
from paypalrestsdk import BillingPlan
import logging
logging.basicConfig(level=logging.INFO)

history = BillingPlan.all({"status": "CREATED"})

print("List BillingPlan:")
for plan in history.plans:
    print("  -> BillingPlan[%s]" % (plan.id))