Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion api/organisations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def is_enterprise(self) -> bool:
return self.subscription_plan_family == SubscriptionPlanFamily.ENTERPRISE

def get_scaleup_plan_version(self) -> int:
if match := re.match(r"scale-up-v(\d+)", self.plan or ""):
if match := re.match(r"scale-up-v(\d+)", self.plan or "", re.IGNORECASE):
return int(match.group(1))
return 1

Expand Down
7 changes: 6 additions & 1 deletion api/organisations/subscriptions/serializers/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ def get_subscription(self):

def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def]
super().__init__(*args, **kwargs)
# Chargebee plan ids cannot be renamed and are mixed-case as of
# Scale-Up v4 (e.g. "Scale-Up-v4-USD-Yearly"), so match them
# case-insensitively.
self.invalid_plans_regex_matcher = (
re.compile(self.invalid_plans_regex) if self.invalid_plans_regex else None
re.compile(self.invalid_plans_regex, re.IGNORECASE)
if self.invalid_plans_regex
else None
)

def get_fields(self, *args, **kwargs): # type: ignore[no-untyped-def]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
(
("invalid-plan-id", ("invalid-plan-id",), ""),
("invalid-plan-id", tuple(), "invalid-.*"),
("Scale-Up-v4-USD-Yearly", tuple(), r"^(free|startup.*|scale-up.*)$"),
),
)
def test_read_only_if_not_valid_plan_mixin__invalid_plan__sets_fields_read_only(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ def test_is_auto_seat_upgrade_available__given_plan_and_seat_count__returns_expe
("scale-up", 1),
("startup-v2", 1),
(None, 1),
("Scale-Up-v4-USD-Yearly", 4),
("Scale-Up-v4-USD-Monthly", 4),
],
)
def test_get_scaleup_plan_version__given_plan__returns_expected(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Attributes:
### `core.encrypted_field.decrypt_failed`

Logged at `warning` from:
- `api/core/fields.py:37`
- `api/core/fields.py:62`

Attributes:
- `exc_info`
Expand Down
6 changes: 6 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22243,6 +22243,7 @@ components:
readOnly: true
url:
type: string
format: uri
maxLength: 200
enabled:
type: boolean
Expand Down Expand Up @@ -24193,6 +24194,7 @@ components:
readOnly: true
url:
type: string
format: uri
maxLength: 200
enabled:
type: boolean
Expand Down Expand Up @@ -25045,6 +25047,7 @@ components:
url:
type: string
format: uri
maxLength: 200
enabled:
type: boolean
created_at:
Expand All @@ -25066,6 +25069,7 @@ components:
readOnly: true
url:
type: string
format: uri
maxLength: 200
secret:
type: string
Expand Down Expand Up @@ -28035,6 +28039,7 @@ components:
url:
type: string
format: uri
maxLength: 200
enabled:
type: boolean
created_at:
Expand All @@ -28058,6 +28063,7 @@ components:
readOnly: true
url:
type: string
format: uri
maxLength: 200
secret:
type: string
Expand Down
Loading