diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 22b1a1e..3d2ac0b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.20" + ".": "0.1.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 4c348f6..c85b5ab 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 135 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/frostedinc%2Fwhopsdk-c28f76de0001bfa87ee1b13b38528823b96c236b51d3706bc7fbe2ef22ed1c96.yml -openapi_spec_hash: 8476411081a6a94534139b21c3cf74b7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/frostedinc%2Fwhopsdk-4fe579c1f59d4d7b14f08207325df32c9261bb2bca524d114fb27618e4a7987f.yml +openapi_spec_hash: 24ce983a4a29faf534bf0512dfc5bdfb config_hash: c4e43bac321badafc3ba52b6c6c4e646 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f0cb04..7a3cbb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## 0.1.0 (2026-01-01) + +Full Changelog: [v0.0.20...v0.1.0](https://github.com/whopio/whopsdk-python/compare/v0.0.20...v0.1.0) + +### Features + +* **api:** api update ([a94ed18](https://github.com/whopio/whopsdk-python/commit/a94ed183fe791304c081bce91b7ccbd4d886099a)) +* **api:** api update ([1db8a0e](https://github.com/whopio/whopsdk-python/commit/1db8a0e90ce8aecdc98453d56666ff532ea5653b)) +* **api:** api update ([67cbed8](https://github.com/whopio/whopsdk-python/commit/67cbed8c20b394d39c019ada21212537eb393ca4)) +* **api:** api update ([4a91396](https://github.com/whopio/whopsdk-python/commit/4a91396f7231d325be8f0a5e019ddf9fc0cf9092)) +* **api:** api update ([178a244](https://github.com/whopio/whopsdk-python/commit/178a244f1af3783a3fc0b2a894ff82b7004084a9)) +* **api:** api update ([58e3e4f](https://github.com/whopio/whopsdk-python/commit/58e3e4fd76c5bee88c8c863766db5bc7a7a1228d)) +* **api:** api update ([59b2893](https://github.com/whopio/whopsdk-python/commit/59b28939a8a030734004c16f6945f6bab277dbe5)) + + +### Bug Fixes + +* use async_to_httpx_files in patch method ([c3f1923](https://github.com/whopio/whopsdk-python/commit/c3f19234a7efea6c6048c09ae693839b5c7654ce)) + + +### Chores + +* **internal:** add `--fix` argument to lint script ([ee64709](https://github.com/whopio/whopsdk-python/commit/ee64709e6629563c7cce0733015c3dd2a7411e83)) + ## 0.0.20 (2025-12-16) Full Changelog: [v0.0.19...v0.0.20](https://github.com/whopio/whopsdk-python/compare/v0.0.19...v0.0.20) diff --git a/LICENSE b/LICENSE index 719201a..6834378 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2025 Whop + Copyright 2026 Whop Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/api.md b/api.md index 51dea89..3fd08bc 100644 --- a/api.md +++ b/api.md @@ -155,6 +155,7 @@ from whop_sdk.types import ( WithdrawalCreatedWebhookEvent, WithdrawalUpdatedWebhookEvent, CourseLessonInteractionCompletedWebhookEvent, + PayoutMethodCreatedWebhookEvent, PaymentCreatedWebhookEvent, PaymentSucceededWebhookEvent, PaymentFailedWebhookEvent, diff --git a/pyproject.toml b/pyproject.toml index 7902ab1..56574b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "whop-sdk" -version = "0.0.20" +version = "0.1.0" description = "The official Python library for the Whop API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/scripts/lint b/scripts/lint index 8aa7eb9..2d8bba9 100755 --- a/scripts/lint +++ b/scripts/lint @@ -4,8 +4,13 @@ set -e cd "$(dirname "$0")/.." -echo "==> Running lints" -rye run lint +if [ "$1" = "--fix" ]; then + echo "==> Running lints with --fix" + rye run fix:ruff +else + echo "==> Running lints" + rye run lint +fi echo "==> Making sure it imports" rye run python -c 'import whop_sdk' diff --git a/src/whop_sdk/_base_client.py b/src/whop_sdk/_base_client.py index adeef0b..c16a1d4 100644 --- a/src/whop_sdk/_base_client.py +++ b/src/whop_sdk/_base_client.py @@ -1774,7 +1774,7 @@ async def patch( options: RequestOptions = {}, ) -> ResponseT: opts = FinalRequestOptions.construct( - method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts) diff --git a/src/whop_sdk/_version.py b/src/whop_sdk/_version.py index 09479ac..162053b 100644 --- a/src/whop_sdk/_version.py +++ b/src/whop_sdk/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "whop_sdk" -__version__ = "0.0.20" # x-release-please-version +__version__ = "0.1.0" # x-release-please-version diff --git a/src/whop_sdk/resources/payment_methods.py b/src/whop_sdk/resources/payment_methods.py index 98b1798..fab6fdc 100644 --- a/src/whop_sdk/resources/payment_methods.py +++ b/src/whop_sdk/resources/payment_methods.py @@ -51,7 +51,8 @@ def retrieve( self, id: str, *, - member_id: str, + company_id: Optional[str] | Omit = omit, + member_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -64,14 +65,16 @@ def retrieve( such as a card, bank account, or digital wallet. It holds the necessary billing details and can be attached to a member for future one-time or recurring charges. This lets you reuse the same payment credentials across multiple - payments. + payments. You must provide exactly one of company_id or member_id. Required permissions: - `member:payment_methods:read` Args: - member_id: The ID of the Member associated with the PaymentMethod + company_id: The ID of the Company. Provide either this or member_id (not both). + + member_id: The ID of the Member. Provide either this or company_id (not both). extra_headers: Send extra headers @@ -93,7 +96,11 @@ def retrieve( extra_body=extra_body, timeout=timeout, query=maybe_transform( - {"member_id": member_id}, payment_method_retrieve_params.PaymentMethodRetrieveParams + { + "company_id": company_id, + "member_id": member_id, + }, + payment_method_retrieve_params.PaymentMethodRetrieveParams, ), ), cast_to=cast( @@ -105,14 +112,15 @@ def retrieve( def list( self, *, - member_id: str, after: Optional[str] | Omit = omit, before: Optional[str] | Omit = omit, + company_id: Optional[str] | Omit = omit, created_after: Union[str, datetime, None] | Omit = omit, created_before: Union[str, datetime, None] | Omit = omit, direction: Optional[Direction] | Omit = omit, first: Optional[int] | Omit = omit, last: Optional[int] | Omit = omit, + member_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -132,12 +140,12 @@ def list( - `member:payment_methods:read` Args: - member_id: The ID of the Member to list payment methods for - after: Returns the elements in the list that come after the specified cursor. before: Returns the elements in the list that come before the specified cursor. + company_id: The ID of the Company. Provide either this or member_id (not both). + created_after: The minimum creation date to filter by created_before: The maximum creation date to filter by @@ -148,6 +156,8 @@ def list( last: Returns the last _n_ elements from the list. + member_id: The ID of the Member to list payment methods for + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -166,14 +176,15 @@ def list( timeout=timeout, query=maybe_transform( { - "member_id": member_id, "after": after, "before": before, + "company_id": company_id, "created_after": created_after, "created_before": created_before, "direction": direction, "first": first, "last": last, + "member_id": member_id, }, payment_method_list_params.PaymentMethodListParams, ), @@ -208,7 +219,8 @@ async def retrieve( self, id: str, *, - member_id: str, + company_id: Optional[str] | Omit = omit, + member_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -221,14 +233,16 @@ async def retrieve( such as a card, bank account, or digital wallet. It holds the necessary billing details and can be attached to a member for future one-time or recurring charges. This lets you reuse the same payment credentials across multiple - payments. + payments. You must provide exactly one of company_id or member_id. Required permissions: - `member:payment_methods:read` Args: - member_id: The ID of the Member associated with the PaymentMethod + company_id: The ID of the Company. Provide either this or member_id (not both). + + member_id: The ID of the Member. Provide either this or company_id (not both). extra_headers: Send extra headers @@ -250,7 +264,11 @@ async def retrieve( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform( - {"member_id": member_id}, payment_method_retrieve_params.PaymentMethodRetrieveParams + { + "company_id": company_id, + "member_id": member_id, + }, + payment_method_retrieve_params.PaymentMethodRetrieveParams, ), ), cast_to=cast( @@ -262,14 +280,15 @@ async def retrieve( def list( self, *, - member_id: str, after: Optional[str] | Omit = omit, before: Optional[str] | Omit = omit, + company_id: Optional[str] | Omit = omit, created_after: Union[str, datetime, None] | Omit = omit, created_before: Union[str, datetime, None] | Omit = omit, direction: Optional[Direction] | Omit = omit, first: Optional[int] | Omit = omit, last: Optional[int] | Omit = omit, + member_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -289,12 +308,12 @@ def list( - `member:payment_methods:read` Args: - member_id: The ID of the Member to list payment methods for - after: Returns the elements in the list that come after the specified cursor. before: Returns the elements in the list that come before the specified cursor. + company_id: The ID of the Company. Provide either this or member_id (not both). + created_after: The minimum creation date to filter by created_before: The maximum creation date to filter by @@ -305,6 +324,8 @@ def list( last: Returns the last _n_ elements from the list. + member_id: The ID of the Member to list payment methods for + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -323,14 +344,15 @@ def list( timeout=timeout, query=maybe_transform( { - "member_id": member_id, "after": after, "before": before, + "company_id": company_id, "created_after": created_after, "created_before": created_before, "direction": direction, "first": first, "last": last, + "member_id": member_id, }, payment_method_list_params.PaymentMethodListParams, ), diff --git a/src/whop_sdk/resources/payments.py b/src/whop_sdk/resources/payments.py index 0d8d2c8..c58da93 100644 --- a/src/whop_sdk/resources/payments.py +++ b/src/whop_sdk/resources/payments.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union, Optional +from typing import Dict, List, Union, Optional from datetime import datetime from typing_extensions import Literal, overload @@ -61,6 +61,7 @@ def create( member_id: str, payment_method_id: str, plan: payment_create_params.CreatePaymentInputWithPlanPlan, + metadata: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -98,6 +99,8 @@ def create( plan: Pass this object to create a new plan for this payment + metadata: Custom metadata to attach to the payment. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -116,6 +119,7 @@ def create( member_id: str, payment_method_id: str, plan_id: str, + metadata: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -153,6 +157,8 @@ def create( plan_id: An ID of an existing plan to use for the payment. + metadata: Custom metadata to attach to the payment. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -174,6 +180,7 @@ def create( member_id: str, payment_method_id: str, plan: payment_create_params.CreatePaymentInputWithPlanPlan | Omit = omit, + metadata: Optional[Dict[str, object]] | Omit = omit, plan_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -190,6 +197,7 @@ def create( "member_id": member_id, "payment_method_id": payment_method_id, "plan": plan, + "metadata": metadata, "plan_id": plan_id, }, payment_create_params.PaymentCreateParams, @@ -580,6 +588,7 @@ async def create( member_id: str, payment_method_id: str, plan: payment_create_params.CreatePaymentInputWithPlanPlan, + metadata: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -617,6 +626,8 @@ async def create( plan: Pass this object to create a new plan for this payment + metadata: Custom metadata to attach to the payment. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -635,6 +646,7 @@ async def create( member_id: str, payment_method_id: str, plan_id: str, + metadata: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -672,6 +684,8 @@ async def create( plan_id: An ID of an existing plan to use for the payment. + metadata: Custom metadata to attach to the payment. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -693,6 +707,7 @@ async def create( member_id: str, payment_method_id: str, plan: payment_create_params.CreatePaymentInputWithPlanPlan | Omit = omit, + metadata: Optional[Dict[str, object]] | Omit = omit, plan_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -709,6 +724,7 @@ async def create( "member_id": member_id, "payment_method_id": payment_method_id, "plan": plan, + "metadata": metadata, "plan_id": plan_id, }, payment_create_params.PaymentCreateParams, diff --git a/src/whop_sdk/resources/support_channels.py b/src/whop_sdk/resources/support_channels.py index d0a3cb3..51a8660 100644 --- a/src/whop_sdk/resources/support_channels.py +++ b/src/whop_sdk/resources/support_channels.py @@ -71,7 +71,7 @@ def create( Args: company_id: The ID of the company to create the support chat in - user_id: The ID of the user to create the support chat for + user_id: The ID (user_xxx) or username of the user to create the support chat for extra_headers: Send extra headers @@ -255,7 +255,7 @@ async def create( Args: company_id: The ID of the company to create the support chat in - user_id: The ID of the user to create the support chat for + user_id: The ID (user_xxx) or username of the user to create the support chat for extra_headers: Send extra headers diff --git a/src/whop_sdk/types/__init__.py b/src/whop_sdk/types/__init__.py index 2a40fb6..db44c65 100644 --- a/src/whop_sdk/types/__init__.py +++ b/src/whop_sdk/types/__init__.py @@ -253,6 +253,7 @@ from .authorized_user_retrieve_response import AuthorizedUserRetrieveResponse as AuthorizedUserRetrieveResponse from .checkout_configuration_list_params import CheckoutConfigurationListParams as CheckoutConfigurationListParams from .membership_activated_webhook_event import MembershipActivatedWebhookEvent as MembershipActivatedWebhookEvent +from .payout_method_created_webhook_event import PayoutMethodCreatedWebhookEvent as PayoutMethodCreatedWebhookEvent from .setup_intent_canceled_webhook_event import SetupIntentCanceledWebhookEvent as SetupIntentCanceledWebhookEvent from .checkout_configuration_create_params import CheckoutConfigurationCreateParams as CheckoutConfigurationCreateParams from .checkout_configuration_list_response import CheckoutConfigurationListResponse as CheckoutConfigurationListResponse diff --git a/src/whop_sdk/types/payment_create_params.py b/src/whop_sdk/types/payment_create_params.py index c8a0ed3..787324d 100644 --- a/src/whop_sdk/types/payment_create_params.py +++ b/src/whop_sdk/types/payment_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Optional +from typing import Dict, Union, Optional from typing_extensions import Required, TypeAlias, TypedDict from .shared.currency import Currency @@ -37,6 +37,9 @@ class CreatePaymentInputWithPlan(TypedDict, total=False): plan: Required[CreatePaymentInputWithPlanPlan] """Pass this object to create a new plan for this payment""" + metadata: Optional[Dict[str, object]] + """Custom metadata to attach to the payment.""" + class CreatePaymentInputWithPlanPlanProduct(TypedDict, total=False): """Pass this object to create a new product for this plan. @@ -165,5 +168,8 @@ class CreatePaymentInputWithPlanID(TypedDict, total=False): plan_id: Required[str] """An ID of an existing plan to use for the payment.""" + metadata: Optional[Dict[str, object]] + """Custom metadata to attach to the payment.""" + PaymentCreateParams: TypeAlias = Union[CreatePaymentInputWithPlan, CreatePaymentInputWithPlanID] diff --git a/src/whop_sdk/types/payment_list_fees_response.py b/src/whop_sdk/types/payment_list_fees_response.py index 8be63f4..8320749 100644 --- a/src/whop_sdk/types/payment_list_fees_response.py +++ b/src/whop_sdk/types/payment_list_fees_response.py @@ -51,5 +51,6 @@ class PaymentListFeesResponse(BaseModel): "three_ds_fixed_fee", "billing_percentage_fee", "revshare_percentage_fee", + "application_fee", ] """The specific origin of the fee, if applicable.""" diff --git a/src/whop_sdk/types/payment_list_response.py b/src/whop_sdk/types/payment_list_response.py index 5676456..2985357 100644 --- a/src/whop_sdk/types/payment_list_response.py +++ b/src/whop_sdk/types/payment_list_response.py @@ -231,7 +231,8 @@ class PaymentListResponse(BaseModel): metadata: Optional[Dict[str, object]] = None """The custom metadata stored on this payment. - This will be copied the checkout configuration for which this payment was made + This will be copied over to the checkout configuration for which this payment + was made """ paid_at: Optional[datetime] = None diff --git a/src/whop_sdk/types/payment_method_list_params.py b/src/whop_sdk/types/payment_method_list_params.py index 073c0a1..9fae03d 100644 --- a/src/whop_sdk/types/payment_method_list_params.py +++ b/src/whop_sdk/types/payment_method_list_params.py @@ -4,7 +4,7 @@ from typing import Union, Optional from datetime import datetime -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo from .shared.direction import Direction @@ -13,15 +13,15 @@ class PaymentMethodListParams(TypedDict, total=False): - member_id: Required[str] - """The ID of the Member to list payment methods for""" - after: Optional[str] """Returns the elements in the list that come after the specified cursor.""" before: Optional[str] """Returns the elements in the list that come before the specified cursor.""" + company_id: Optional[str] + """The ID of the Company. Provide either this or member_id (not both).""" + created_after: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """The minimum creation date to filter by""" @@ -36,3 +36,6 @@ class PaymentMethodListParams(TypedDict, total=False): last: Optional[int] """Returns the last _n_ elements from the list.""" + + member_id: Optional[str] + """The ID of the Member to list payment methods for""" diff --git a/src/whop_sdk/types/payment_method_retrieve_params.py b/src/whop_sdk/types/payment_method_retrieve_params.py index 2dae30d..a2c0621 100644 --- a/src/whop_sdk/types/payment_method_retrieve_params.py +++ b/src/whop_sdk/types/payment_method_retrieve_params.py @@ -2,11 +2,15 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Optional +from typing_extensions import TypedDict __all__ = ["PaymentMethodRetrieveParams"] class PaymentMethodRetrieveParams(TypedDict, total=False): - member_id: Required[str] - """The ID of the Member associated with the PaymentMethod""" + company_id: Optional[str] + """The ID of the Company. Provide either this or member_id (not both).""" + + member_id: Optional[str] + """The ID of the Member. Provide either this or company_id (not both).""" diff --git a/src/whop_sdk/types/payout_method_created_webhook_event.py b/src/whop_sdk/types/payout_method_created_webhook_event.py new file mode 100644 index 0000000..d0746b7 --- /dev/null +++ b/src/whop_sdk/types/payout_method_created_webhook_event.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["PayoutMethodCreatedWebhookEvent", "Data", "DataDestination"] + + +class DataDestination(BaseModel): + """The payout destination associated with the payout token""" + + category: Literal["crypto", "rtp", "next_day_bank", "bank_wire", "digital_wallet", "unknown"] + """The category of the payout destination""" + + country_code: str + """The country code of the payout destination""" + + name: str + """The name of the payer associated with the payout destination""" + + +class Data(BaseModel): + """An object representing an user's setup payout destination.""" + + id: str + """The ID of the payout token""" + + currency: str + """The currency code of the payout destination. + + This is the currency that payouts will be made in for this token. + """ + + destination: Optional[DataDestination] = None + """The payout destination associated with the payout token""" + + nickname: Optional[str] = None + """An optional nickname for the payout token to help the user identify it. + + This is not used by the provider and is only for the user's reference. + """ + + +class PayoutMethodCreatedWebhookEvent(BaseModel): + id: str + """A unique ID for every single webhook request""" + + api_version: Literal["v1"] + """The API version for this webhook""" + + data: Data + """An object representing an user's setup payout destination.""" + + timestamp: datetime + """The timestamp in ISO 8601 format that the webhook was sent at on the server""" + + type: Literal["payout_method.created"] + """The webhook event type""" diff --git a/src/whop_sdk/types/shared/membership_status.py b/src/whop_sdk/types/shared/membership_status.py index 1dd86f1..fc47b97 100644 --- a/src/whop_sdk/types/shared/membership_status.py +++ b/src/whop_sdk/types/shared/membership_status.py @@ -5,5 +5,5 @@ __all__ = ["MembershipStatus"] MembershipStatus: TypeAlias = Literal[ - "trialing", "active", "past_due", "completed", "canceled", "expired", "unresolved", "drafted" + "trialing", "active", "past_due", "completed", "canceled", "expired", "unresolved", "drafted", "canceling" ] diff --git a/src/whop_sdk/types/shared/payment.py b/src/whop_sdk/types/shared/payment.py index b59db23..ff952bd 100644 --- a/src/whop_sdk/types/shared/payment.py +++ b/src/whop_sdk/types/shared/payment.py @@ -231,7 +231,8 @@ class Payment(BaseModel): metadata: Optional[Dict[str, object]] = None """The custom metadata stored on this payment. - This will be copied the checkout configuration for which this payment was made + This will be copied over to the checkout configuration for which this payment + was made """ paid_at: Optional[datetime] = None diff --git a/src/whop_sdk/types/shared_params/membership_status.py b/src/whop_sdk/types/shared_params/membership_status.py index be5151d..dbc9a1f 100644 --- a/src/whop_sdk/types/shared_params/membership_status.py +++ b/src/whop_sdk/types/shared_params/membership_status.py @@ -7,5 +7,5 @@ __all__ = ["MembershipStatus"] MembershipStatus: TypeAlias = Literal[ - "trialing", "active", "past_due", "completed", "canceled", "expired", "unresolved", "drafted" + "trialing", "active", "past_due", "completed", "canceled", "expired", "unresolved", "drafted", "canceling" ] diff --git a/src/whop_sdk/types/support_channel_create_params.py b/src/whop_sdk/types/support_channel_create_params.py index b51f3bb..d30c1ec 100644 --- a/src/whop_sdk/types/support_channel_create_params.py +++ b/src/whop_sdk/types/support_channel_create_params.py @@ -12,4 +12,4 @@ class SupportChannelCreateParams(TypedDict, total=False): """The ID of the company to create the support chat in""" user_id: Required[str] - """The ID of the user to create the support chat for""" + """The ID (user_xxx) or username of the user to create the support chat for""" diff --git a/src/whop_sdk/types/unwrap_webhook_event.py b/src/whop_sdk/types/unwrap_webhook_event.py index 9967a25..9c8591c 100644 --- a/src/whop_sdk/types/unwrap_webhook_event.py +++ b/src/whop_sdk/types/unwrap_webhook_event.py @@ -23,6 +23,7 @@ from .withdrawal_created_webhook_event import WithdrawalCreatedWebhookEvent from .withdrawal_updated_webhook_event import WithdrawalUpdatedWebhookEvent from .membership_activated_webhook_event import MembershipActivatedWebhookEvent +from .payout_method_created_webhook_event import PayoutMethodCreatedWebhookEvent from .setup_intent_canceled_webhook_event import SetupIntentCanceledWebhookEvent from .membership_deactivated_webhook_event import MembershipDeactivatedWebhookEvent from .setup_intent_succeeded_webhook_event import SetupIntentSucceededWebhookEvent @@ -49,6 +50,7 @@ WithdrawalCreatedWebhookEvent, WithdrawalUpdatedWebhookEvent, CourseLessonInteractionCompletedWebhookEvent, + PayoutMethodCreatedWebhookEvent, PaymentCreatedWebhookEvent, PaymentSucceededWebhookEvent, PaymentFailedWebhookEvent, diff --git a/tests/api_resources/test_payment_methods.py b/tests/api_resources/test_payment_methods.py index 34ee3e2..6a82519 100644 --- a/tests/api_resources/test_payment_methods.py +++ b/tests/api_resources/test_payment_methods.py @@ -27,6 +27,15 @@ class TestPaymentMethods: def test_method_retrieve(self, client: Whop) -> None: payment_method = client.payment_methods.retrieve( id="payt_xxxxxxxxxxxxx", + ) + assert_matches_type(PaymentMethodRetrieveResponse, payment_method, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_retrieve_with_all_params(self, client: Whop) -> None: + payment_method = client.payment_methods.retrieve( + id="payt_xxxxxxxxxxxxx", + company_id="biz_xxxxxxxxxxxxxx", member_id="mber_xxxxxxxxxxxxx", ) assert_matches_type(PaymentMethodRetrieveResponse, payment_method, path=["response"]) @@ -36,7 +45,6 @@ def test_method_retrieve(self, client: Whop) -> None: def test_raw_response_retrieve(self, client: Whop) -> None: response = client.payment_methods.with_raw_response.retrieve( id="payt_xxxxxxxxxxxxx", - member_id="mber_xxxxxxxxxxxxx", ) assert response.is_closed is True @@ -49,7 +57,6 @@ def test_raw_response_retrieve(self, client: Whop) -> None: def test_streaming_response_retrieve(self, client: Whop) -> None: with client.payment_methods.with_streaming_response.retrieve( id="payt_xxxxxxxxxxxxx", - member_id="mber_xxxxxxxxxxxxx", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -65,38 +72,34 @@ def test_path_params_retrieve(self, client: Whop) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.payment_methods.with_raw_response.retrieve( id="", - member_id="mber_xxxxxxxxxxxxx", ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_list(self, client: Whop) -> None: - payment_method = client.payment_methods.list( - member_id="mber_xxxxxxxxxxxxx", - ) + payment_method = client.payment_methods.list() assert_matches_type(SyncCursorPage[PaymentMethodListResponse], payment_method, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_list_with_all_params(self, client: Whop) -> None: payment_method = client.payment_methods.list( - member_id="mber_xxxxxxxxxxxxx", after="after", before="before", + company_id="biz_xxxxxxxxxxxxxx", created_after=parse_datetime("2023-12-01T05:00:00.401Z"), created_before=parse_datetime("2023-12-01T05:00:00.401Z"), direction="asc", first=42, last=42, + member_id="mber_xxxxxxxxxxxxx", ) assert_matches_type(SyncCursorPage[PaymentMethodListResponse], payment_method, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_list(self, client: Whop) -> None: - response = client.payment_methods.with_raw_response.list( - member_id="mber_xxxxxxxxxxxxx", - ) + response = client.payment_methods.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -106,9 +109,7 @@ def test_raw_response_list(self, client: Whop) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_list(self, client: Whop) -> None: - with client.payment_methods.with_streaming_response.list( - member_id="mber_xxxxxxxxxxxxx", - ) as response: + with client.payment_methods.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -128,6 +129,15 @@ class TestAsyncPaymentMethods: async def test_method_retrieve(self, async_client: AsyncWhop) -> None: payment_method = await async_client.payment_methods.retrieve( id="payt_xxxxxxxxxxxxx", + ) + assert_matches_type(PaymentMethodRetrieveResponse, payment_method, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncWhop) -> None: + payment_method = await async_client.payment_methods.retrieve( + id="payt_xxxxxxxxxxxxx", + company_id="biz_xxxxxxxxxxxxxx", member_id="mber_xxxxxxxxxxxxx", ) assert_matches_type(PaymentMethodRetrieveResponse, payment_method, path=["response"]) @@ -137,7 +147,6 @@ async def test_method_retrieve(self, async_client: AsyncWhop) -> None: async def test_raw_response_retrieve(self, async_client: AsyncWhop) -> None: response = await async_client.payment_methods.with_raw_response.retrieve( id="payt_xxxxxxxxxxxxx", - member_id="mber_xxxxxxxxxxxxx", ) assert response.is_closed is True @@ -150,7 +159,6 @@ async def test_raw_response_retrieve(self, async_client: AsyncWhop) -> None: async def test_streaming_response_retrieve(self, async_client: AsyncWhop) -> None: async with async_client.payment_methods.with_streaming_response.retrieve( id="payt_xxxxxxxxxxxxx", - member_id="mber_xxxxxxxxxxxxx", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -166,38 +174,34 @@ async def test_path_params_retrieve(self, async_client: AsyncWhop) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.payment_methods.with_raw_response.retrieve( id="", - member_id="mber_xxxxxxxxxxxxx", ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncWhop) -> None: - payment_method = await async_client.payment_methods.list( - member_id="mber_xxxxxxxxxxxxx", - ) + payment_method = await async_client.payment_methods.list() assert_matches_type(AsyncCursorPage[PaymentMethodListResponse], payment_method, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncWhop) -> None: payment_method = await async_client.payment_methods.list( - member_id="mber_xxxxxxxxxxxxx", after="after", before="before", + company_id="biz_xxxxxxxxxxxxxx", created_after=parse_datetime("2023-12-01T05:00:00.401Z"), created_before=parse_datetime("2023-12-01T05:00:00.401Z"), direction="asc", first=42, last=42, + member_id="mber_xxxxxxxxxxxxx", ) assert_matches_type(AsyncCursorPage[PaymentMethodListResponse], payment_method, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncWhop) -> None: - response = await async_client.payment_methods.with_raw_response.list( - member_id="mber_xxxxxxxxxxxxx", - ) + response = await async_client.payment_methods.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -207,9 +211,7 @@ async def test_raw_response_list(self, async_client: AsyncWhop) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncWhop) -> None: - async with async_client.payment_methods.with_streaming_response.list( - member_id="mber_xxxxxxxxxxxxx", - ) as response: + async with async_client.payment_methods.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_payments.py b/tests/api_resources/test_payments.py index 0f4ed9e..63bf95b 100644 --- a/tests/api_resources/test_payments.py +++ b/tests/api_resources/test_payments.py @@ -72,6 +72,7 @@ def test_method_create_with_all_params_overload_1(self, client: Whop) -> None: "trial_period_days": 42, "visibility": "visible", }, + metadata={"foo": "bar"}, ) assert_matches_type(Payment, payment, path=["response"]) @@ -118,6 +119,18 @@ def test_method_create_overload_2(self, client: Whop) -> None: ) assert_matches_type(Payment, payment, path=["response"]) + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create_with_all_params_overload_2(self, client: Whop) -> None: + payment = client.payments.create( + company_id="biz_xxxxxxxxxxxxxx", + member_id="mber_xxxxxxxxxxxxx", + payment_method_id="pmt_xxxxxxxxxxxxxx", + plan_id="plan_xxxxxxxxxxxxx", + metadata={"foo": "bar"}, + ) + assert_matches_type(Payment, payment, path=["response"]) + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_create_overload_2(self, client: Whop) -> None: @@ -493,6 +506,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn "trial_period_days": 42, "visibility": "visible", }, + metadata={"foo": "bar"}, ) assert_matches_type(Payment, payment, path=["response"]) @@ -539,6 +553,18 @@ async def test_method_create_overload_2(self, async_client: AsyncWhop) -> None: ) assert_matches_type(Payment, payment, path=["response"]) + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncWhop) -> None: + payment = await async_client.payments.create( + company_id="biz_xxxxxxxxxxxxxx", + member_id="mber_xxxxxxxxxxxxx", + payment_method_id="pmt_xxxxxxxxxxxxxx", + plan_id="plan_xxxxxxxxxxxxx", + metadata={"foo": "bar"}, + ) + assert_matches_type(Payment, payment, path=["response"]) + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_create_overload_2(self, async_client: AsyncWhop) -> None: