o
    ˷e                     @   sN   d dl mZ d dlmZ d dlmZ G dd deZG dd deZegZdS )	    )settings)ProviderAccount)OAuth2Providerc                   @   s   e Zd ZdS )ShopifyAccountN)__name__
__module____qualname__ r	   r	   g/var/www/ideatree/venv/lib/python3.10/site-packages/allauth/socialaccount/providers/shopify/provider.pyr      s    r   c                       sL   e Zd ZdZdZeZedd Z fddZ	dd Z
d	d
 Zdd Z  ZS )ShopifyProvidershopifyShopifyc                 C   s4   t tdi di di dd}|  dkS )NSOCIALACCOUNT_PROVIDERSr   AUTH_PARAMSzgrant_options[] zper-user)getattrr   getlowerstrip)selfgrant_optionsr	   r	   r
   is_per_user   s   
zShopifyProvider.is_per_userc                    s6   t t| ||}|jdd }|r|d|i |S )Nshop)superr   get_auth_paramsGETr   update)r   requestactionretr   	__class__r	   r
   r      s
   zShopifyProvider.get_auth_paramsc                 C   s   ddgS )Nread_ordersread_productsr	   )r   r	   r	   r
   get_default_scope!   s   z!ShopifyProvider.get_default_scopec                 C   s&   | j rt|d d S t|d d S )Nassociated_useridr   )r   strr   datar	   r	   r
   extract_uid$   s   zShopifyProvider.extract_uidc                 C   s>   | j rt|d d |d d |d d dS t|d d dS )Nr%   email
first_name	last_name)r+   r,   r-   r   )r+   )r   dictr(   r	   r	   r
   extract_common_fields*   s   


	z%ShopifyProvider.extract_common_fields)r   r   r   r&   namer   account_classpropertyr   r   r$   r*   r/   __classcell__r	   r	   r    r
   r      s    
	r   N)	django.confr   $allauth.socialaccount.providers.baser   /allauth.socialaccount.providers.oauth2.providerr   r   r   provider_classesr	   r	   r	   r
   <module>   s    
-