Skip to content

Commit

Permalink
changeCustomerStatus is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
estyxx committed Jan 30, 2024
1 parent 75f6d56 commit 33218ad
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions backend/integrations/plain.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,39 +96,6 @@ def create_customer(user: User) -> str:
return response["upsertCustomer"]["customer"]["id"]


def change_customer_status(customer_id: str):
document = """
mutation changeCustomerStatus ($input: ChangeCustomerStatusInput!) {
changeCustomerStatus (input:$input) {
customer {
id
}
error {
message
}
}
}
"""

response = _execute(
document,
variables={"input": {"status": "ACTIVE", "customerId": customer_id}},
)

if response["changeCustomerStatus"]["error"]:
if (
response["changeCustomerStatus"]["error"]["message"]
== "Customer already is status: ACTIVE"
):
return
raise PlainError(response["changeCustomerStatus"]["error"]["message"])

logger.info(
"Customer set to ACTIVE on Plain",
)


def _create_thread(customer_id: str, title: str, message: str):
document = """
mutation createThread($input: CreateThreadInput!) {
Expand Down Expand Up @@ -185,5 +152,4 @@ def _create_thread(customer_id: str, title: str, message: str):

def send_message(user: User, title: str, message: str):
customer_id = create_customer(user)
change_customer_status(customer_id)
_create_thread(customer_id, title, message)

Check warning on line 155 in backend/integrations/plain.py

View check run for this annotation

Codecov / codecov/patch

backend/integrations/plain.py#L155

Added line #L155 was not covered by tests

0 comments on commit 33218ad

Please sign in to comment.