
    Ei                       d dl mZ d dlmZmZmZ d dlmZ d dlmZm	Z	m
Z
mZ  G d de      Z G d de      Z G d	 d
e      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)    )annotations)AnyDictOptional)datetime)	BaseModelField
ConfigDictfield_validatorc                      e Zd ZU dZded<   dZded<   dZded<   dZded<   dZded	<   dZ	ded
<   dZ
ded<   dZded<   dZded<   ded<   dZded<    ed      Zy) PaymentMethodCardDetailsResponsez!Response schema for card details.intidNOptional[str]card_numberbrandexpire_monthexpire_yearreference_idreference_tokenFbool
is_defaultTis_autosavedr   
created_atOptional[datetime]last_used_atfrom_attributes)__name__
__module____qualname____doc____annotations__r   r   r   r   r   r   r   r   r   r
   model_config     n/var/www/html/hwPaymentPortal-be-dev/hw-payment-portal-api/src/apps/payment_methods/schemas/payment_methods.pyr   r   	   su    +G!%K%E="&L-&!%K%"&L-&%)O])JL$'+L$+d3Lr&   r   c                      e Zd ZU dZded<   dZded<   dZded<   dZded<   dZded	<   dZ	ded
<   dZ
ded<   dZded<   dZded<   dZded<   ded<   dZded<    ed      Zy)PaymentMethodAchDetailsResponsez Response schema for ACH details.r   r   Nr   account_numberrouting_numberaccount_name	bank_nameaccount_typer   r   Fr   r   Tr   r   r   r   r   r   )r   r    r!   r"   r#   r*   r+   r,   r-   r.   r   r   r   r   r   r
   r$   r%   r&   r'   r)   r)      s    *G$(NM($(NM("&L-&#I}#"&L-&"&L-&%)O])JL$'+L$+d3Lr&   r)   c                      e Zd ZU  edd      Zded<    edd      Zded<    edd      Zded	<    edd
      Zded<   y)PaymentMethodCardDetailsInputNzCard brand from frontenddefaultdescriptionr   r   zCard last 4 from frontendlast4zCard expiry month from frontend	exp_monthzCard expiry year from frontendexp_year)	r   r    r!   r	   r   r#   r4   r5   r6   r%   r&   r'   r0   r0   ,   sJ     ;UVE=V ;VWE=W$T?`aI}a#D>^_Hm_r&   r0   c                      e Zd ZU  edd      Zded<    edd      Zded<    edd      Zded	<    edd
      Zded<   y)PaymentMethodAchDetailsInputNzBank account holder namer1   r   r,   z	Bank namer-   zAccount type (checking/savings)r.   zBank routing numberr+   )	r   r    r!   r	   r,   r#   r-   r.   r+   r%   r&   r'   r8   r8   3   sI    "'B\"]L-]$T{KI}K"'Bc"dL-d$)$DY$ZNMZr&   r8   c                      e Zd ZU  edd      Zded<    edd      Zd	ed
<   dZded<    edd      Zded<    edd      Z	ded<   y)PaymentMethodTokenCreateSchema.Frontend iframe tokenr3   strpayment_method_tokenN4Payment method ID which will be used as reference_idr1   r   payment_method_idOptional[Dict[str, Any]]billing_infoCard details from frontend'Optional[PaymentMethodCardDetailsInput]card_detailsACH bank details from frontend&Optional[PaymentMethodAchDetailsInput]ach_details)
r   r    r!   r	   r>   r#   r@   rB   rE   rH   r%   r&   r'   r:   r:   :   sY     %c7N O#O',TG}'~}~-1L*1<A$\x<yL9y:?Zz:{K7{r&   r:   c                      e Zd ZU  edd      Zded<    edd      Zd	ed
<    edd      Zded<    edd      Zded<    edd      Z	ded<   dZ
ded<    edd      Zded<    edd      Zded<   y)PaymentMethodSaveSchema.r;   r<   r=   r>   Nr?   r1   r   r@   z&Customer id to link the payment methodOptional[int]customer_idz+Payer/contact id to link the payment methodpayer_idz-Payment request id associated with the methodpayment_request_idrA   rB   rC   rD   rE   rF   rG   rH   )r   r    r!   r	   r>   r#   r@   rL   rM   rN   rB   rE   rH   r%   r&   r'   rJ   rJ   B   s     %c7N O#O',TG}'~}~!&tAi!jKj#D>klHml(-dHw(xx-1L*1<A$\x<yL9y:?Zz:{K7{r&   rJ   c                  ~    e Zd ZU ded<   ded<   dZded<   dZded<   dZded<   dZded	<   dZd
ed<   dZ	ded<   ddiZ
y)PaymentMethodResponseSchemar=   providerprovider_payment_method_idNr   r   r4   r5   r6   rA   billingrK   payment_method_id_internalr   T)r   r    r!   r#   r   r4   r5   r6   rS   rT   r$   r%   r&   r'   rP   rP   M   sY    M ##E=E=#I}#"Hm"(,G%,044 	4Lr&   rP   c                      e Zd ZU dZded<   ded<   dZded<   d	Zd
ed<   ded<   dZded<   dZded<   ded<   dZ	ded<   dZ
ded<   dZded<   dZded<   dZded<   ded<   dZded<    ed      Zy)PaymentMethodSaveResponseSchemaz=Response schema for saved payment method with nested details.r   r   r=   methodNr   r@   Fr   is_connectedscoperK   rL   rM   merchant_idrN   card_details_idach_details_idz*Optional[PaymentMethodCardDetailsResponse]rE   z)Optional[PaymentMethodAchDetailsResponse]rH   r   r   r   
updated_atTr   )r   r    r!   r"   r#   r@   rX   rL   rM   rN   r[   r\   rE   rH   r]   r
   r$   r%   r&   r'   rV   rV   \   s    GGK'+}+L$J!%K%"Hm"(,,%)O])$(NM(?CL<C=AK:A%)J")d3Lr&   rV   c                  t   e Zd ZU dZ edd      Zded<    edd      Zded<    edd	      Zd
ed<    edd      Z	d
ed<    edd      Z
d
ed<    edd      Zd
ed<    edd      Zded<    edd      Zded<    ed      ed               Z ed      ed               Z ed      ed               Zy)PaymentMethodListFilterSchemaz1Schema for filtering payment method list queries.NzSearch across payment_method_idr<   r   searchz(Filter by payment method type (card/ach)rW   zFilter by customer IDrK   rL   zFilter by payer/contact IDrM   zFilter by payment request IDrN   z$Filter by merchant ID (auto-applied)rZ   r   zBFilter by connection status (0=all, 1=connected, -1=not connected)r   rX   z#Filter by scope (merchant/customer)rY   c                h    ||j                         dvrt        d      |r|j                         S |S )zValidate payment method type.)cardachchequez)Method must be 'card', 'ach', or 'cheque'lower
ValueErrorclsvs     r'   validate_methodz-PaymentMethodListFilterSchema.validate_method}   s6     =QWWY.GGHIIqwwy$1$r&   c                h    ||j                         dvrt        d      |r|j                         S |S )zValidate scope.)merchantcustomerz&Scope must be 'merchant' or 'customer're   rh   s     r'   validate_scopez,PaymentMethodListFilterSchema.validate_scope   s6     =QWWY.FFEFFqwwy$1$r&   c                $    |dvrt        d      |S )zValidate is_connected filter.)r      z5is_connected must be -1 (false), 0 (all), or 1 (true))rg   rh   s     r'   validate_is_connectedz3PaymentMethodListFilterSchema.validate_is_connected   s     JTUUr&   )r   r    r!   r"   r	   r`   r#   rW   rL   rM   rN   rZ   rX   rY   r   classmethodrk   ro   rs   r%   r&   r'   r_   r_   q   s    ;!$4UVFMV!$4^_FM_!&t9P!QKQ#D6RSHmS(-d@^(__!&t9_!`K`a-qrL#r 3XYE=YX%  % W%  % ^$  %r&   r_   N)
__future__r   typingr   r   r   r   pydanticr   r	   r
   r   r   r)   r0   r8   r:   rJ   rP   rV   r_   r%   r&   r'   <module>rx      s    " & &  B B4y 4"4i 4$`I `[9 [|Y ||i |) 4i 4*"I "r&   