
    _j*                         d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z
 e
rBd dlmZ 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 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  ddgddgdZ! G d de          Z"dS )    )StripeService)sanitize_id)Optionalcast)import_module)TYPE_CHECKING)
CreditNote)CreditNoteLineItemService)CreditNotePreviewLinesService)
ListObject)RequestOptions)CreditNoteCreateParams)CreditNoteListParams)CreditNotePreviewParams)CreditNoteRetrieveParams)CreditNoteUpdateParams)CreditNoteVoidCreditNoteParamsz%stripe._credit_note_line_item_servicer
   z)stripe._credit_note_preview_lines_servicer   )
line_itemspreview_linesc            	       r    e Zd ZU ded<   ded<    fdZd Z	 	 d!ded	         d
ed         ddfdZ	 	 d!ded	         d
ed         ddfdZ	 d"ddd
ed         ddfdZ		 d"ddd
ed         ddfdZ
	 	 d!deded         d
ed         ddfdZ	 	 d!deded         d
ed         ddfdZ	 	 d!deded         d
ed         ddfdZ	 	 d!deded         d
ed         ddfdZ	 d"ddd
ed         ddfdZ	 d"ddd
ed         ddfdZ	 	 d!deded         d
ed         ddfdZ	 	 d!deded         d
ed         ddfd Z xZS )#CreditNoteServicer
   r   r   r   c                 J    t                                          |           d S N)super__init__)self	requestor	__class__s     _/var/www/app.qaans.com/backend/venv/lib/python3.11/site-packages/stripe/_credit_note_service.pyr   zCreditNoteService.__init__.   s!    #####    c                     	 t           |         \  }}t          t          |          |          }t          | | || j                             t          | |          S # t
          $ r t                      w xY wr   )_subservicesgetattrr   setattr
_requestorKeyErrorAttributeError)r   nameimport_fromserviceservice_classs        r   __getattr__zCreditNoteService.__getattr__1   s    	##/#5 K#k** M do..  
 4&&& 	# 	# 	# """	#s   AA A7Nparamsr   optionsr   returnListObject[CreditNote]c           
      R    t          d|                     ddd||                    S )1
        Returns a list of credit notes.
        r0   get/v1/credit_notesapibase_addressr-   r.   r   _requestr   r-   r.   s      r   listzCreditNoteService.listA   s>     $MM""   	
 	
 		
r    c           
      b   K   t          d|                     ddd||           d{V           S )r2   r0   r3   r4   r5   r6   Nr   _request_asyncr:   s      r   
list_asynczCreditNoteService.list_asyncT   sb       $%%"" &        	
 	
 		
r    r   r	   c           
      R    t          d|                     ddd||                    S )  
        Issue a credit note to adjust the amount of a finalized invoice. A credit note will first reduce the invoice's amount_remaining (and amount_due), but not below zero.
        This amount is indicated by the credit note's pre_payment_amount. The excess amount is indicated by post_payment_amount, and it can result in any combination of the following:


        Refunds: create a new refund (using refund_amount) or link existing refunds (using refunds).
        Customer balance credit: credit the customer's balance (using credit_amount) which will be automatically applied to their next invoice when it's finalized.
        Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).


        The sum of refunds, customer balance credits, and outside of Stripe credits must equal the post_payment_amount.

        You may issue multiple credit notes for an invoice. Each credit note may increment the invoice's pre_payment_credit_notes_amount,
        post_payment_credit_notes_amount, or both, depending on the invoice's amount_remaining at the time of credit note creation.
        r	   postr4   r5   r6   r8   r:   s      r   createzCreditNoteService.createg   s>    ( MM""   	
 	
 		
r    c           
      b   K   t          d|                     ddd||           d{V           S )rA   r	   rB   r4   r5   r6   Nr=   r:   s      r   create_asynczCreditNoteService.create_async   sb      ( %%"" &        	
 	
 		
r    idr   c                     t          d|                     dd                    t          |                    d||                    S )M
        Retrieves the credit note object with the given identifier.
        r	   r3   /v1/credit_notes/{id}rF   r5   r6   r   r9   formatr   r   rF   r-   r.   s       r   retrievezCreditNoteService.retrieve   sU     MM'..+b//.BB"   	
 	
 		
r    c                    K   t          d|                     dd                    t          |                    d||           d{V           S )rH   r	   r3   rI   rJ   r5   r6   Nr   r>   rL   r   rM   s       r   retrieve_asyncz CreditNoteService.retrieve_async   sy       %%'..+b//.BB" &        	
 	
 		
r    r   c                     t          d|                     dd                    t          |                    d||                    S )2
        Updates an existing credit note.
        r	   rB   rI   rJ   r5   r6   rK   rM   s       r   updatezCreditNoteService.update   sU     MM'..+b//.BB"   	
 	
 		
r    c                    K   t          d|                     dd                    t          |                    d||           d{V           S )rS   r	   rB   rI   rJ   r5   r6   NrP   rM   s       r   update_asynczCreditNoteService.update_async   sy       %%'..+b//.BB" &        	
 	
 		
r    r   c           
      R    t          d|                     ddd||                    S )E
        Get a preview of a credit note without creating it.
        r	   r3   /v1/credit_notes/previewr5   r6   r8   r:   s      r   previewzCreditNoteService.preview   s>     MM*"   	
 	
 		
r    c           
      b   K   t          d|                     ddd||           d{V           S )rX   r	   r3   rY   r5   r6   Nr=   r:   s      r   preview_asynczCreditNoteService.preview_async  sb       %%*" &        	
 	
 		
r    r   c                     t          d|                     dd                    t          |                    d||                    S )
        Marks a credit note as void. Learn more about [voiding credit notes](https://docs.stripe.com/docs/billing/invoices/credit-notes#voiding).
        r	   rB   /v1/credit_notes/{id}/voidrJ   r5   r6   rK   rM   s       r   void_credit_notez"CreditNoteService.void_credit_note  sU     MM,33{23GG"   	
 	
 		
r    c                    K   t          d|                     dd                    t          |                    d||           d{V           S )r^   r	   rB   r_   rJ   r5   r6   NrP   rM   s       r   void_credit_note_asyncz(CreditNoteService.void_credit_note_async/  sy       %%,33{23GG" &        	
 	
 		
r    )NNr   )__name__
__module____qualname____annotations__r   r,   r   r;   r?   rC   rE   strrN   rQ   rT   rV   rZ   r\   r`   rb   __classcell__)r   s   @r   r   r   *   s        ++++2222$ $ $ $ $# # #$ 48.2
 
/0
 *+
 
"	
 
 
 
* 48.2
 
/0
 *+
 
"	
 
 
 
, /3
 
(
 *+
 
	
 
 
 
D /3
 
(
 *+
 
	
 
 
 
D 8<.2	
 

 34
 *+	

 

 
 
 
. 8<.2	
 

 34
 *+	

 

 
 
 
. 6:.2	
 

 12
 *+	

 

 
 
 
. 6:.2	
 

 12
 *+	

 

 
 
 
. /3
 
)
 *+
 
	
 
 
 
, /3
 
)
 *+
 
	
 
 
 
, >B.2	
 

 9:
 *+	

 

 
 
 
. >B.2	
 

 9:
 *+	

 

 
 
 
 
 
 
 
r    r   N)#stripe._stripe_servicer   stripe._utilr   typingr   r   	importlibr   typing_extensionsr   stripe._credit_noter	   %stripe._credit_note_line_item_servicer
   )stripe._credit_note_preview_lines_servicer   stripe._list_objectr   stripe._request_optionsr   (stripe.params._credit_note_create_paramsr   &stripe.params._credit_note_list_paramsr   )stripe.params._credit_note_preview_paramsr   *stripe.params._credit_note_retrieve_paramsr   (stripe.params._credit_note_update_paramsr   2stripe.params._credit_note_void_credit_note_paramsr   r"   r    r    r   <module>rz      s   1 0 0 0 0 0 $ $ $ $ $ $ ! ! ! ! ! ! ! ! # # # # # # + + + + + + ......OOOOOO      /.....666666OOOOOOKKKKKK           POOOOO      	0#
 	4'	 	W
 W
 W
 W
 W
 W
 W
 W
 W
 W
r    