Skip to content

Commit afca6cd

Browse files
authored
Merge pull request #920 from openedx/pwnage101/ENT-11009/2
feat: add 2nd plan + renewal to provisioning workflow (ENT-11009)
2 parents a8c5434 + df785c7 commit afca6cd

File tree

14 files changed

+1049
-171
lines changed

14 files changed

+1049
-171
lines changed

enterprise_access/apps/api/serializers/provisioning.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,25 @@ class SubscriptionPlanRequestSerializer(BaseSerializer):
8383
help_text='The title of the subscription plan.',
8484
)
8585
salesforce_opportunity_line_item = serializers.CharField(
86+
required=True, allow_null=True,
8687
help_text='The Salesforce Opportunity Line Item id associated with this subscription plan.',
8788
)
8889
start_date = serializers.DateTimeField(
90+
required=False, allow_null=False,
8991
help_text='The date and time at which the subscription plan becomes usable.',
9092
)
9193
expiration_date = serializers.DateTimeField(
92-
help_text='The date and time at which the subscription plan becomes unusable.'
94+
help_text='The date and time at which the subscription plan becomes unusable.',
95+
required=False, allow_null=False,
9396
)
9497
product_id = serializers.ChoiceField(
9598
choices=settings.PROVISIONING_DEFAULTS['subscription']['all_product_choices'],
99+
required=False, allow_null=False,
96100
help_text='The internal edX Enterprise Subscription Product record.',
97101
)
98102
desired_num_licenses = serializers.IntegerField(
99-
help_text='The number of licenses to create for this plan.'
103+
required=False, allow_null=False,
104+
help_text='The number of licenses to create for this plan.',
100105
)
101106
enterprise_catalog_uuid = serializers.UUIDField(
102107
required=False, allow_null=True, default=None,
@@ -125,7 +130,8 @@ class ProvisioningRequestSerializer(BaseSerializer):
125130
required=False,
126131
allow_null=True,
127132
)
128-
subscription_plan = SubscriptionPlanRequestSerializer()
133+
trial_subscription_plan = SubscriptionPlanRequestSerializer()
134+
first_paid_subscription_plan = SubscriptionPlanRequestSerializer()
129135

130136

131137
## All the RESPONSE serializers go under here ##
@@ -189,6 +195,7 @@ class SubscriptionPlanResponseSerializer(BaseSerializer):
189195
plan_type = serializers.CharField()
190196
enterprise_catalog_uuid = serializers.UUIDField()
191197
product = serializers.IntegerField()
198+
desired_num_licenses = serializers.IntegerField()
192199

193200

194201
class CustomerAgreementResponseSerializer(BaseSerializer):
@@ -201,6 +208,19 @@ class CustomerAgreementResponseSerializer(BaseSerializer):
201208
subscriptions = SubscriptionPlanResponseSerializer(many=True)
202209

203210

211+
class SubscriptionPlanRenewalResponseSerializer(BaseSerializer):
212+
"""
213+
Subscription Plan Renewal serializer for provisioning responses.
214+
"""
215+
id = serializers.IntegerField()
216+
prior_subscription_plan = serializers.UUIDField()
217+
renewed_subscription_plan = serializers.UUIDField()
218+
number_of_licenses = serializers.IntegerField()
219+
effective_date = serializers.DateTimeField()
220+
renewed_expiration_date = serializers.DateTimeField()
221+
salesforce_opportunity_line_item = serializers.CharField(required=False)
222+
223+
204224
class ProvisioningResponseSerializer(BaseSerializer):
205225
"""
206226
Response serializer for provisioning create view.
@@ -209,7 +229,9 @@ class ProvisioningResponseSerializer(BaseSerializer):
209229
customer_admins = AdminObjectResponseSerializer()
210230
enterprise_catalog = EnterpriseCatalogResponseSerializer()
211231
customer_agreement = CustomerAgreementResponseSerializer()
212-
subscription_plan = SubscriptionPlanResponseSerializer()
232+
trial_subscription_plan = SubscriptionPlanResponseSerializer()
233+
first_paid_subscription_plan = SubscriptionPlanResponseSerializer()
234+
subscription_plan_renewal = SubscriptionPlanRenewalResponseSerializer()
213235

214236

215237
class SubscriptionPlanOLIUpdateSerializer(BaseSerializer):

0 commit comments

Comments
 (0)