Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check instant license flag in subscriptions #1407

Merged
merged 1 commit into from
Dec 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions cartoframes/data/observatory/catalog/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ def display_existing_subscription_message(entity_id, entity_type):

def display_subscription_form(entity_id, entity_type, credentials):
info = fetch_subscription_info(entity_id, entity_type, credentials)
instant_licensing = credentials.get_do_credentials().instant_licensing

if is_ipython_notebook():
_display_subscription_form_notebook(entity_id, entity_type, info, credentials)
_display_subscription_form_notebook(entity_id, entity_type, info, instant_licensing, credentials)
else:
_display_subscription_form_cli(entity_id, entity_type, info, credentials)
_display_subscription_form_cli(entity_id, entity_type, info, instant_licensing, credentials)


def _display_existing_subscription_message_notebook(entity_id, entity_type):
Expand All @@ -51,8 +52,9 @@ def _display_existing_subscription_message_cli(entity_id, entity_type):
print(message)


def _display_subscription_form_notebook(entity_id, entity_type, info, credentials):
if info.get('estimated_delivery_days') == 0:
def _display_subscription_form_notebook(entity_id, entity_type, info, instant_licensing, credentials):
delivery_days = info.get('estimated_delivery_days')
if instant_licensing and delivery_days == 0:
delivery_message = '''
This {type} is available for Instant Subscription for your organization,
so it will automatically process the order and you will get immediate access to the {type}.
Expand All @@ -61,7 +63,7 @@ def _display_subscription_form_notebook(entity_id, entity_type, info, credential
delivery_message = '''
This {type} will be available in your account in about {days} days.
We will contact you shortly to complete the subscription details.
'''.format(type=entity_type, days=info.get('estimated_delivery_days'))
'''.format(type=entity_type, days=delivery_days)

message = '''
<h3>Subscription contract</h3>
Expand Down Expand Up @@ -130,8 +132,9 @@ def on_button_no_clicked(b):
return (text, buttons)


def _display_subscription_form_cli(entity_id, entity_type, info, credentials):
if info.get('estimated_delivery_days') == 0:
def _display_subscription_form_cli(entity_id, entity_type, info, instant_licensing, credentials):
delivery_days = info.get('estimated_delivery_days')
if instant_licensing and delivery_days == 0:
delivery_message = (
'This {type} is available for Instant Subscription for your organization, '
'so it will automatically process the order and you will get immediate access to the {type}.'
Expand All @@ -140,7 +143,7 @@ def _display_subscription_form_cli(entity_id, entity_type, info, credentials):
delivery_message = (
'This {type} will be available in your account in about {days} days. '
'We will contact you shortly to complete the subscription details.'
).format(type=entity_type, days=info.get('estimated_delivery_days'))
).format(type=entity_type, days=delivery_days)

message = (
'Subscription contract:\n'
Expand Down