1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._cash_balance import CashBalance
from stripe._request_options import RequestOptions
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from typing import List, cast
from typing_extensions import Literal, NotRequired, TypedDict
class CustomerCashBalanceService(StripeService):
class RetrieveParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
class UpdateParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
settings: NotRequired[
"CustomerCashBalanceService.UpdateParamsSettings"
]
"""
A hash of settings for this cash balance.
"""
class UpdateParamsSettings(TypedDict):
reconciliation_mode: NotRequired[
Literal["automatic", "manual", "merchant_default"]
]
"""
Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic`, `manual`, or `merchant_default`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation).
"""
def retrieve(
self,
customer: str,
params: "CustomerCashBalanceService.RetrieveParams" = {},
options: RequestOptions = {},
) -> CashBalance:
"""
Retrieves a customer's cash balance.
"""
return cast(
CashBalance,
self._request(
"get",
"/v1/customers/{customer}/cash_balance".format(
customer=sanitize_id(customer),
),
base_address="api",
params=params,
options=options,
),
)
async def retrieve_async(
self,
customer: str,
params: "CustomerCashBalanceService.RetrieveParams" = {},
options: RequestOptions = {},
) -> CashBalance:
"""
Retrieves a customer's cash balance.
"""
return cast(
CashBalance,
await self._request_async(
"get",
"/v1/customers/{customer}/cash_balance".format(
customer=sanitize_id(customer),
),
base_address="api",
params=params,
options=options,
),
)
def update(
self,
customer: str,
params: "CustomerCashBalanceService.UpdateParams" = {},
options: RequestOptions = {},
) -> CashBalance:
"""
Changes the settings on a customer's cash balance.
"""
return cast(
CashBalance,
self._request(
"post",
"/v1/customers/{customer}/cash_balance".format(
customer=sanitize_id(customer),
),
base_address="api",
params=params,
options=options,
),
)
async def update_async(
self,
customer: str,
params: "CustomerCashBalanceService.UpdateParams" = {},
options: RequestOptions = {},
) -> CashBalance:
"""
Changes the settings on a customer's cash balance.
"""
return cast(
CashBalance,
await self._request_async(
"post",
"/v1/customers/{customer}/cash_balance".format(
customer=sanitize_id(customer),
),
base_address="api",
params=params,
options=options,
),
)
|