o
    i.                     @   s   d dl mZ d dlmZ d dlmZmZ d dlmZ erLd 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 G dd deZdS )    )StripeService)sanitize_id)Optionalcast)TYPE_CHECKING)Coupon)
ListObject)RequestOptions)CouponCreateParams)CouponDeleteParams)CouponListParams)CouponRetrieveParams)CouponUpdateParamsc                	   @   s  e Zd Z		d"deded ded ddfd	d
Z		d"deded ded ddfddZ		d"deded ded ddfddZ		d"deded ded ddfddZ		d"deded ded ddfddZ			d"deded ded ddfddZ
		d"ded ded ddfddZ		d"ded ded ddfddZ		d"ded ded ddfddZ		d"ded ded ddfd d!ZdS )#CouponServiceNcouponparamsr   optionsr	   returnr   c              	   C   &   t d| jddjt|dd||dS )D  
        You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons via the API.
        r   delete/v1/coupons/{coupon}r   apibase_addressr   r   r   _requestformatr   selfr   r   r    r!   v/var/www/snowflake_co_dev_github/snow_flake_back_end_deploy/env/lib/python3.10/site-packages/stripe/_coupon_service.pyr         	zCouponService.deletec              	      .   t d| jddjt|dd||dI dH S )r   r   r   r   r   r   r   Nr   _request_asyncr   r   r   r!   r!   r"   delete_async(      	
zCouponService.delete_asyncr   c              	   C   r   )9
        Retrieves the coupon with the given ID.
        r   getr   r   r   r   r   r   r!   r!   r"   retrieve<   r#   zCouponService.retrievec              	      r$   )r)   r   r*   r   r   r   r   Nr%   r   r!   r!   r"   retrieve_asyncP   r(   zCouponService.retrieve_asyncr   c              	   C   r   )
        Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
        r   postr   r   r   r   r   r   r!   r!   r"   updated   r#   zCouponService.updatec              	      r$   )r-   r   r.   r   r   r   r   Nr%   r   r!   r!   r"   update_asyncx   r(   zCouponService.update_asyncr   ListObject[Coupon]c              	   C      t d| jddd||dS )1
        Returns a list of your coupons.
        r1   r*   /v1/couponsr   r   r   r   r    r   r   r!   r!   r"   list   s   zCouponService.listc              	      "   t d| jddd||dI dH S )r3   r1   r*   r4   r   r   Nr   r&   r6   r!   r!   r"   
list_async   s   
zCouponService.list_asyncr
   c              	   C   r2   )  
        You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.

        A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice's subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.
        r   r.   r4   r   r   r5   r6   r!   r!   r"   create   s   
zCouponService.createc              	      r8   )r;   r   r.   r4   r   r   Nr9   r6   r!   r!   r"   create_async   s   

zCouponService.create_async)NN)__name__
__module____qualname__strr   r   r'   r+   r,   r/   r0   r7   r:   r<   r=   r!   r!   r!   r"   r      s    








r   N)stripe._stripe_servicer   stripe._utilr   typingr   r   typing_extensionsr   stripe._couponr   stripe._list_objectr   stripe._request_optionsr	   #stripe.params._coupon_create_paramsr
   #stripe.params._coupon_delete_paramsr   !stripe.params._coupon_list_paramsr   %stripe.params._coupon_retrieve_paramsr   #stripe.params._coupon_update_paramsr   r   r!   r!   r!   r"   <module>   s   