Esempio n. 1
0
 def handle(self, *args, **options):
     client = get_client()
     for seller_name, seller_config in sellers.items():
         log.info('Configuring: {0}'.format(seller_name))
         seller = get_or_create_seller(seller_name)
         plans = get_plans(client)
         # Iterate through each product checking they exist.
         for product in seller_config.products:
             get_or_create_seller_product(
                 external_id=product.id,
                 public_id=product.id,
                 seller=seller
             )
             product_exists(plans, product.id, product.amount)
Esempio n. 2
0
 def handle(self, *args, **options):
     client = get_client()
     for seller_name, seller_config in sellers.items():
         log.info('Configuring: {0}'.format(seller_name))
         seller = get_or_create_seller(seller_name)
         plans = get_plans(client)
         # Iterate through each product checking they exist.
         for product in seller_config.products:
             # Check that the product exists in Braintree.
             get_or_create_seller_product(
                 external_id=product.id,
                 public_id=product.id,
                 seller=seller
             )
             if product.recurrence:
                 # If there's recurrence, we need to check
                 # that it exists in Braintree and is set up ok.
                 product_exists(plans, product.id, product.amount)
Esempio n. 3
0
    def handle(self, *args, **options):
        client = get_client()
        for seller_name, seller_config in sellers.items():
            log.info('Configuring: {0}'.format(seller_name))
            seller = get_or_create_seller(seller_name)
            plans = get_plans(client)
            # Iterate through each product checking they exist.
            for product in seller_config.products:
                # Check that the product exists in Braintree.
                get_or_create_seller_product(
                    external_id=product.id,
                    public_id=product.id,
                    seller=seller
                )
                if product.recurrence:
                    # If there's recurrence, we need to check
                    # that it exists in Braintree and is set up ok.
                    try:
                        product_exists(plans, product.id, product.amount)
                    except BraintreePlanDoesNotExist:
                        raise CommandError(textwrap.dedent('''\
                            Missing product: {product.id}

                            Currently it's not possible to automate this.

                            1. Log into https://sandbox.braintreegateway.com/
                               (or the production dashboard)
                            2. Go to Recurring Billing > Plans from the sidebar
                            3. Enter the following data:

                                Plan ID: {product.id}
                                Plan Name: {product.description}
                                Price: {price}
                                Billing Cycle Every: 1 month

                            4. re-run this script
                            5. MFBT
                        '''.format(
                            # TODO: show the right thing for recurrence
                            # other than 'month'
                            product=product,
                            price=(product.amount or '0.00'),
                        )))
Esempio n. 4
0
    def handle(self, *args, **options):
        client = get_client()
        for seller_name, seller_config in sellers.items():
            log.info('Configuring: {0}'.format(seller_name))
            seller = get_or_create_seller(seller_name)
            plans = get_plans(client)
            # Iterate through each product checking they exist.
            for product in seller_config.products:
                # Check that the product exists in Braintree.
                get_or_create_seller_product(
                    external_id=product.id,
                    public_id=product.id,
                    seller=seller
                )
                if product.recurrence:
                    # If there's recurrence, we need to check
                    # that it exists in Braintree and is set up ok.
                    try:
                        product_exists(plans, product.id, product.amount)
                    except BraintreePlanDoesNotExist:
                        raise CommandError(textwrap.dedent('''\
                            Missing product: {product.id}

                            Currently it's not possible to automate this.

                            1. Log into https://sandbox.braintreegateway.com/
                               (or the production dashboard)
                            2. Go to Recurring Billing > Plans from the sidebar
                            3. Enter the following data:

                                Plan ID: {product.id}
                                Plan Name: {product.description}
                                Price: {price}
                                Billing Cycle Every: 1 month

                            4. re-run this script
                            5. MFBT
                        '''.format(
                            # TODO: show the right thing for recurrence
                            # other than 'month'
                            product=product,
                            price=(product.amount or '0.00'),
                        )))