a
    ù!fG  ã                   @   sˆ   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 d dlmZ erpd dlmZ d dlmZ G d	d
„ d
ed
 ƒZdS )é    )ÚUpdateableAPIResource)ÚExpandableField)ÚTransfer)ÚClassVarÚDictÚOptional)ÚLiteralÚTYPE_CHECKING)Ú
quote_plus)ÚBalanceTransaction)ÚRefundc                   @   sÄ   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	e
d	  ed
< eed< e	eeef  ed< ed ed< e	e
d	  ed< e
d ed< dd„ Zedd„ ƒZeddd„ƒZdS )ÚReversalaX  
    [Stripe Connect](https://stripe.com/docs/connect) platforms can reverse transfers made to a
    connected account, either entirely or partially, and can also specify whether
    to refund any related application fees. Transfer reversals add to the
    platform's balance and subtract from the destination account's balance.

    Reversing a transfer that was made for a [destination
    charge](https://stripe.com/docs/connect/destination-charges) is allowed only up to the amount of
    the charge. It is possible to reverse a
    [transfer_group](https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-options)
    transfer only if the destination account has enough balance to cover the
    reversal.

    Related guide: [Reversing transfers](https://stripe.com/docs/connect/separate-charges-and-transfers#reversing-transfers)
    Ztransfer_reversalÚOBJECT_NAMEÚamountr   Zbalance_transactionÚcreatedÚcurrencyr   Zdestination_payment_refundÚidÚmetadataÚobjectZsource_refundr   Útransferc                 C   sB   | j }| j}t|tƒr|j }t ¡ }t|ƒ}t|ƒ}d|||f S )Nz%s/%s/reversals/%s)r   r   Ú
isinstancer   Z	class_urlr
   )ÚselfÚtokenr   ÚbaseZ	cust_extnZextn© r   ú^/var/www/html/python-backend/venv/lib/python3.9/site-packages/stripe/api_resources/reversal.pyÚinstance_urlJ   s    
zReversal.instance_urlc                 K   s   t dƒ‚d S )Nz²Can't modify a reversal without a transfer ID. Use stripe.Transfer.modify_reversal('transfer_id', 'reversal_id', ...) (see https://stripe.com/docs/api/transfer_reversals/update).©ÚNotImplementedError)ÚclsZsidÚparamsr   r   r   ÚmodifyT   s    ÿzReversal.modifyNc                 K   s   t dƒ‚d S )Nz³Can't retrieve a reversal without a transfer ID. Use stripe.Transfer.retrieve_reversal('transfer_id', 'reversal_id') (see https://stripe.com/docs/api/transfer_reversals/retrieve).r   )r   r   Zapi_keyr    r   r   r   Úretrieve\   s    ÿzReversal.retrieve)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Ú__annotations__Úintr   r   Ústrr   r   Úclassmethodr!   r"   r   r   r   r   r      s"   


r   N)Zstripe.api_resources.abstractr   Z%stripe.api_resources.expandable_fieldr   Zstripe.api_resources.transferr   Útypingr   r   r   Ztyping_extensionsr   r	   Úurllib.parser
   Z(stripe.api_resources.balance_transactionr   Zstripe.api_resources.refundr   r   r   r   r   r   Ú<module>   s   