-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
There are some new event types which we should handle. Full list is here: https://cloud.google.com/marketplace/docs/partners/integrated-saas/backend-integration#eventtypes
Need to add the types to here:
doit-easily-marketplace/api/Entitlement.py
Lines 119 to 174 in 660a27b
if event_type == "ENTITLEMENT_CREATION_REQUESTED": | |
if entitlement_state == "ENTITLEMENT_ACTIVATION_REQUESTED": | |
if product_settings.auto_approve_entitlements: | |
logger.debug("auto approving entitlement") | |
procurement_api.approve_entitlement(entitlement_id) | |
# TODO: we could send an update to the customer giving an approval timeline | |
# https://cloud.google.com/marketplace/docs/partners/integrated-saas/backend-integration#sending_a_status_message_to_users | |
if product_settings.slack_webhook: | |
send_slack_message(product_settings.slack_webhook, entitlement) | |
# Nothing to do here, as the approval comes from the UI | |
return | |
elif event_type == "ENTITLEMENT_ACTIVE": | |
if entitlement_state == "ENTITLEMENT_ACTIVE": | |
notify("create", entitlement, product_settings.event_topic, publisher) | |
return | |
elif event_type == "ENTITLEMENT_PLAN_CHANGE_REQUESTED": | |
if entitlement_state == "ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL": | |
# Don't write anything to our database until the entitlement | |
# becomes active within the Procurement Service. | |
procurement_api.approve_entitlement_plan_change( | |
entitlement_id, entitlement["newPendingPlan"] | |
) | |
return | |
elif event_type == "ENTITLEMENT_PLAN_CHANGED": | |
if entitlement_state == "ENTITLEMENT_ACTIVE": | |
notify("upgrade", entitlement, product_settings.event_topic, publisher) | |
return | |
elif event_type == "ENTITLEMENT_PLAN_CHANGE_CANCELLED": | |
# Do nothing. We approved the original change, but we never recorded | |
# it or changed the service level since it hadn't taken effect yet. | |
return | |
elif event_type == "ENTITLEMENT_CANCELLED": | |
if entitlement_state == "ENTITLEMENT_CANCELLED": | |
return notify("destroy", entitlement, product_settings.event_topic, publisher) | |
elif event_type == "ENTITLEMENT_PENDING_CANCELLATION": | |
# Do nothing. We want to cancel once it's truly canceled. For now | |
# it's just set to not renew at the end of the billing cycle. | |
return | |
elif event_type == "ENTITLEMENT_CANCELLATION_REVERTED": | |
# Do nothing. The service was already active, but now it's set to | |
# renew automatically at the end of the billing cycle. | |
return | |
elif event_type == "ENTITLEMENT_DELETED": | |
# Do nothing. The entitlement has to be canceled to be deleted, so | |
# this has already been handled by a cancellation message. | |
return |
Metadata
Metadata
Assignees
Labels
No labels