Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit adea2a2

Browse files
feat: Receive user name instead of customer intent for new terms UI
1 parent 4c41647 commit adea2a2

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from dataclasses import dataclass
2-
from typing import Any, Optional
2+
from typing import Any
33

44
from django.utils import timezone
55

@@ -11,30 +11,28 @@
1111

1212
@dataclass
1313
class TermsAgreementInput:
14-
business_email: Optional[str] = None
14+
business_email: str
15+
name: str
1516
terms_agreement: bool = False
1617
marketing_consent: bool = False
17-
customer_intent: Optional[str] = None
1818

1919

2020
class SaveTermsAgreementInteractor(BaseInteractor):
2121
requires_service = False
2222

2323
def validate(self, input: TermsAgreementInput) -> None:
24-
valid_customer_intents = ["Business", "BUSINESS", "Personal", "PERSONAL"]
25-
if (
26-
input.customer_intent
27-
and input.customer_intent not in valid_customer_intents
28-
):
29-
raise ValidationError("Invalid customer intent provided")
24+
if not self.current_user.business_email:
25+
raise ValidationError("Business email is required")
26+
if not self.current_user.name:
27+
raise ValidationError("Name is required")
3028
if not self.current_user.is_authenticated:
3129
raise Unauthenticated()
3230

3331
def update_terms_agreement(self, input: TermsAgreementInput) -> None:
3432
self.current_user.terms_agreement = input.terms_agreement
3533
self.current_user.terms_agreement_at = timezone.now()
36-
self.current_user.customer_intent = input.customer_intent
3734
self.current_user.email_opt_in = input.marketing_consent
35+
self.current_user.name = input.name
3836
self.current_user.save()
3937

4038
if input.business_email and input.business_email != "":
@@ -53,10 +51,10 @@ def send_data_to_marketo(self) -> None:
5351
@sync_to_async
5452
def execute(self, input: Any) -> None:
5553
typed_input = TermsAgreementInput(
56-
business_email=input.get("business_email"),
57-
terms_agreement=input.get("terms_agreement"),
58-
marketing_consent=input.get("marketing_consent"),
59-
customer_intent=input.get("customer_intent"),
54+
business_email=input.get("business_email", ""),
55+
terms_agreement=input.get("terms_agreement", False),
56+
marketing_consent=input.get("marketing_consent", False),
57+
name=input.get("name", ""),
6058
)
61-
self.validate(typed_input)
59+
self.validate(input)
6260
return self.update_terms_agreement(typed_input)

graphql_api/types/mutation/save_terms_agreement/save_terms_agreement.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ type SaveTermsAgreementPayload {
55
}
66

77
input SaveTermsAgreementInput {
8-
businessEmail: String
8+
businessEmail: String!
99
termsAgreement: Boolean!
1010
marketingConsent: Boolean
11-
customerIntent: String
11+
name: String!
1212
}

graphql_api/types/user/user.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ type User {
55
student: Boolean!
66
studentCreatedAt: DateTime
77
studentUpdatedAt: DateTime
8+
# this will no longer be updated from the UI with Appless
89
customerIntent: String
910
}

graphql_api/types/user/user.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def resolve_student_updated_at(user: Owner, info) -> Optional[datetime]:
4141
return user.student_updated_at
4242

4343

44+
# this will no longer be updated from the UI
4445
@user_bindable.field("customerIntent")
4546
def resolve_customer_intent(user: Owner, info) -> str:
4647
owner = user

0 commit comments

Comments
 (0)