o
    tBhj
                     @   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 )ApplePayApiz3A Controller to access Endpoints in the square API.Nc                    s   t t| || d S N)superr   __init__)selfconfig	call_back	__class__ o/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/square/api/apple_pay_api.pyr	      s   zApplePayApi.__init__c                 C   s   d}| j  }||7 }t|}ddd}| j jj||t|d}t| j | | 	|}t
|j}t|tu r@|d}	nd}	t|||	d}
|
S )a  Does a POST request to /v2/apple-pay/domains.

        Activates a domain for use with Apple Pay on the Web and Square. A
        validation
        is performed on this domain by Apple to ensure that it is properly set
        up as
        an Apple Pay enabled domain.
        This endpoint provides an easy way for platform developers to bulk
        activate
        Apple Pay on the Web with Square for merchants using their platform.
        To learn more about Web Apple Pay, see
        [Add the Apple Pay on the Web
        Button](https://developer.squareup.com/docs/payment-form/add-digital-wa
        llets/apple-pay).

        Args:
            body (RegisterDomainRequest): 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/apple-pay/domainszapplication/json)acceptzContent-Type)headers
parameterserrorsN)bodyr   )r   get_base_urir   	clean_urlhttp_clientpostjson_serializer   applyexecute_requestjson_deserializetexttypedictgetr   )r
   r   	_url_path_query_builder
_query_url_headers_request	_responsedecoded_errors_resultr   r   r   register_domain   s    #


zApplePayApi.register_domainr   )__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
   