
    _jE                         d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	m
Z
mZ d dlmZmZ erd dlmZ d dlmZ d d	lmZ  G d
 ded                   ZdS )    )APIResource)Customer)ExpandableField)sanitize_id)ClassVarDictOptional)LiteralTYPE_CHECKING)
CreditNote)Invoice)Sessionc                      e Zd ZU dZdZeed                  ed<   eed<   	 e	e
d                  ed<   	 eed<   	 e	e
d                  ed	<   	 eed
<   	 e
d         ed<   	 e	e         ed<   	 e	e         ed<   	 eed<   	 eed<   	 e	e
d                  ed<   	 eed<   	 e	eeef                  ed<   	 ed         ed<   	 ed         ed<   	 d Zedd            ZdS )CustomerBalanceTransactiona5  
    Each customer has a [Balance](https://docs.stripe.com/api/customers/object#customer_object-balance) value,
    which denotes a debit or credit that's automatically applied to their next invoice upon finalization.
    You may modify the value directly by using the [update customer API](https://docs.stripe.com/api/customers/update),
    or by creating a Customer Balance Transaction, which increments or decrements the customer's `balance` by the specified `amount`.

    Related guide: [Customer balance](https://docs.stripe.com/billing/customer/balance)
    customer_balance_transactionOBJECT_NAMEamountr   checkout_sessioncreatedr   credit_notecurrencyr   customercustomer_accountdescriptionending_balanceidr   invoicelivemodemetadataobject)
adjustmentapplied_to_invoice%checkout_session_subscription_payment.checkout_session_subscription_payment_canceledr   initialinvoice_overpaidinvoice_too_largeinvoice_too_small	migrationunapplied_from_invoiceunspent_receiver_credittypec                     | j         }| j        }t          |t                    r|j         }t          j                    }t          |          }t          |          }|d|d|S )N/z/balance_transactions/)r   r   
isinstancer   	class_urlr   )selftokenr   base	cust_extnextns         h/var/www/app.qaans.com/backend/venv/lib/python3.11/site-packages/stripe/_customer_balance_transaction.pyinstance_urlz'CustomerBalanceTransaction.instance_urlg   sh    =h)) 	#{H!##))	5!!26$$			44HH    returnc                      t          d          )NzCan't retrieve a Customer Balance Transaction without a Customer ID. Use Customer.retrieve_customer_balance_transaction('cus_123', 'cbtxn_123'))NotImplementedError)clsr   paramss      r6   retrievez#CustomerBalanceTransaction.retrieveq   s    !Y
 
 	
r8   N)r9   r   )__name__
__module____qualname____doc__r   r   r
   __annotations__intr	   r   strboolr   r7   classmethodr>    r8   r6   r   r      s          	' '"@AB    KKK y9:::: LLL /,78888 MMM j)))) sm### #  	GGG oi01111 NNN tCH~&&&& 23333 	#   I I I 
 
 
 [
 
 
r8   r   N)stripe._api_resourcer   stripe._customerr   stripe._expandable_fieldr   stripe._utilr   typingr   r   r	   typing_extensionsr
   r   stripe._credit_noter   stripe._invoicer   stripe.checkout._sessionr   r   rH   r8   r6   <module>rR      s   - , , , , , % % % % % % 4 4 4 4 4 4 $ $ $ $ $ $ + + + + + + + + + + 4 4 4 4 4 4 4 4 1......''''''000000f
 f
 f
 f
 f
-I!J f
 f
 f
 f
 f
r8   