-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add card/delegation guard-rails to Python SDK #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b5c8b14
ad1ab96
1fffab1
1902906
afc15b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -271,18 +271,29 @@ class CardDelegationConfig(BaseModel): | |
| """ | ||
| Configuration for card delegation (fiat/Stripe) payments. | ||
|
|
||
| To reuse an existing delegation supply ``delegation_id``. | ||
| To reuse an existing card (PaymentMethod entity) supply ``card_id``. | ||
| When creating a brand-new delegation provide ``provider_payment_method_id``, | ||
| ``spending_limit_cents``, and ``duration_secs``. | ||
|
|
||
|
Comment on lines
+274
to
+278
|
||
| Attributes: | ||
| provider_payment_method_id: Stripe payment method ID (e.g., 'pm_...') | ||
| spending_limit_cents: Maximum spending limit in cents | ||
| duration_secs: Duration of the delegation in seconds | ||
| card_id: PaymentMethod entity UUID -- preferred way to reference an enrolled card | ||
| delegation_id: Existing delegation UUID to reuse instead of creating a new one | ||
| provider_payment_method_id: Stripe payment method ID (e.g., 'pm_...'). Required only for new delegations. | ||
| spending_limit_cents: Maximum spending limit in cents. Required only for new delegations. | ||
| duration_secs: Duration of the delegation in seconds. Required only for new delegations. | ||
| currency: Currency code (default: 'usd') | ||
| merchant_account_id: Stripe Connect merchant account ID | ||
| max_transactions: Maximum number of transactions allowed | ||
| """ | ||
|
|
||
| provider_payment_method_id: str = Field(alias="providerPaymentMethodId") | ||
| spending_limit_cents: int = Field(alias="spendingLimitCents") | ||
| duration_secs: int = Field(alias="durationSecs") | ||
| card_id: Optional[str] = Field(None, alias="cardId") | ||
| delegation_id: Optional[str] = Field(None, alias="delegationId") | ||
| provider_payment_method_id: Optional[str] = Field( | ||
| None, alias="providerPaymentMethodId" | ||
| ) | ||
| spending_limit_cents: Optional[int] = Field(None, alias="spendingLimitCents") | ||
| duration_secs: Optional[int] = Field(None, alias="durationSecs") | ||
| currency: Optional[str] = None | ||
| merchant_account_id: Optional[str] = Field(None, alias="merchantAccountId") | ||
| max_transactions: Optional[int] = Field(None, alias="maxTransactions") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list_delegations()andDelegationSummaryare new behavior, but there are existing unit tests forlist_payment_methods()in this repo and no corresponding coverage for delegations. Please add unit tests that mock the GET call and assert successful parsing and HTTP error handling forlist_delegations().There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback