mirror of
https://github.com/simple-login/app.git
synced 2025-10-01 19:06:53 +08:00
Fix old name in plan decoding
This commit is contained in:
parent
6b2127353f
commit
3b0b5f464e
2 changed files with 5 additions and 5 deletions
|
@ -91,7 +91,7 @@ def set_plan_for_partner_user(partner_user: PartnerUser, plan: SLPlan):
|
||||||
end_time = None
|
end_time = None
|
||||||
if sub is None:
|
if sub is None:
|
||||||
LOG.i(
|
LOG.i(
|
||||||
f"Creating partner_subscription [user_id={partner_user.user_id}] [partner_id={partner_user.partner_id}]"
|
f"Creating partner_subscription [user_id={partner_user.user_id}] [partner_id={partner_user.partner_id}] with {end_time} / {is_lifetime}"
|
||||||
)
|
)
|
||||||
create_partner_subscription(
|
create_partner_subscription(
|
||||||
partner_user=partner_user,
|
partner_user=partner_user,
|
||||||
|
@ -102,14 +102,14 @@ def set_plan_for_partner_user(partner_user: PartnerUser, plan: SLPlan):
|
||||||
agent.record_custom_event("PlanChange", {"plan": "premium", "type": "new"})
|
agent.record_custom_event("PlanChange", {"plan": "premium", "type": "new"})
|
||||||
else:
|
else:
|
||||||
if sub.end_at != plan.expiration or sub.lifetime != is_lifetime:
|
if sub.end_at != plan.expiration or sub.lifetime != is_lifetime:
|
||||||
LOG.i(
|
|
||||||
f"Updating partner_subscription [user_id={partner_user.user_id}] [partner_id={partner_user.partner_id}]"
|
|
||||||
)
|
|
||||||
agent.record_custom_event(
|
agent.record_custom_event(
|
||||||
"PlanChange", {"plan": "premium", "type": "extension"}
|
"PlanChange", {"plan": "premium", "type": "extension"}
|
||||||
)
|
)
|
||||||
sub.end_at = plan.expiration if not is_lifetime else None
|
sub.end_at = plan.expiration if not is_lifetime else None
|
||||||
sub.lifetime = is_lifetime
|
sub.lifetime = is_lifetime
|
||||||
|
LOG.i(
|
||||||
|
f"Updating partner_subscription [user_id={partner_user.user_id}] [partner_id={partner_user.partner_id}] to {sub.end_at} / {sub.lifetime} "
|
||||||
|
)
|
||||||
emit_user_audit_log(
|
emit_user_audit_log(
|
||||||
user=partner_user.user,
|
user=partner_user.user,
|
||||||
action=UserAuditLogAction.SubscriptionExtended,
|
action=UserAuditLogAction.SubscriptionExtended,
|
||||||
|
|
|
@ -113,7 +113,7 @@ class HttpProtonClient(ProtonClient):
|
||||||
if plan_value == PLAN_FREE:
|
if plan_value == PLAN_FREE:
|
||||||
plan = SLPlan(type=SLPlanType.Free, expiration=None)
|
plan = SLPlan(type=SLPlanType.Free, expiration=None)
|
||||||
elif plan_value == PLAN_PREMIUM:
|
elif plan_value == PLAN_PREMIUM:
|
||||||
expiration = info.get("Expiration", "1")
|
expiration = info.get("PlanExpiration", "1")
|
||||||
plan = SLPlan(
|
plan = SLPlan(
|
||||||
type=SLPlanType.Premium,
|
type=SLPlanType.Premium,
|
||||||
expiration=Arrow.fromtimestamp(expiration, tzinfo="utc"),
|
expiration=Arrow.fromtimestamp(expiration, tzinfo="utc"),
|
||||||
|
|
Loading…
Add table
Reference in a new issue