o
    tBhL
                     @   sD   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 )    )	APIHelper)ApiResponse)BaseApi)OAuth2c                       s*   e Zd ZdZd fdd	Zdd Z  ZS )CheckoutApiz3A Controller to access Endpoints in the square API.Nc                    s   t t| || d S N)superr   __init__)selfconfig	call_back	__class__ n/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/square/api/checkout_api.pyr	      s   zCheckoutApi.__init__c                 C   s   d}t |d|ddi}| j }||7 }t |}ddd}| jjj||t |d}t	| j| | 
|}t |j}	t|	tu rK|	d}
nd	}
t||	|
d
}|S )a  Does a POST request to /v2/locations/{location_id}/checkouts.

        Links a `checkoutId` to a `checkout_page_url` that customers are
        directed to in order to provide their payment information using a
        payment processing workflow hosted on connect.squareup.com.

        Args:
            location_id (string): The ID of the business location to associate
                the checkout with.
            body (CreateCheckoutRequest): An object containing the fields to
                POST for the request.  See the corresponding object definition
                for field details.

        Returns:
            ApiResponse: An object with the response value as well as other
                useful information such as status codes and headers. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        z%/v2/locations/{location_id}/checkoutslocation_idT)valueencodezapplication/json)acceptzContent-Type)headers
parameterserrorsN)bodyr   )r   #append_url_with_template_parametersr   get_base_uri	clean_urlhttp_clientpostjson_serializer   applyexecute_requestjson_deserializetexttypedictgetr   )r
   r   r   	_url_path_query_builder
_query_url_headers_request	_responsedecoded_errors_resultr   r   r   create_checkout   s&   



zCheckoutApi.create_checkoutr   )__name__
__module____qualname____doc__r	   r/   __classcell__r   r   r   r   r   	   s    r   N)	square.api_helperr   square.http.api_responser   square.api.base_apir   square.http.auth.o_auth_2r   r   r   r   r   r   <module>   s
   