U
    ^c                     @   s   d dl mZmZ d dlmZ d dlZd dlZd dlmZ d dl	Z	d dl
Z
d dlmZ d dlmZ d dl mZmZ dd	lmZ d
d ZdS )    )renderredirect)datetimeN)JsonResponse)HttpResponseRedirect)HttpResponse)get_object_or_404r      )Paymentc                    sP  | j dd}| j dd}d}d}dd|i}tj||d}| }d}d}	d}
|D ]}||d	 krX| tt|d
  krXtj d	 fddt
dD }d}	| dkrd}
| dkrd}
| dkrd}
| dkrd}
| dkrd}
| dkrd}
t| qX|r>dd|i}tjd||dd|	dd}t|  |
rdd|i}tjd||dd|
dd}dd|i}tjd||dd d!d}tj }|d"}dd|i}tjd#||d$|d%d&d%d'|d(d}dd|i}tjd)|d$|dd*||d+||d,	d}|rDd-| d }tjd.d/d0|d1|d2d3d4d5d6	d7}d8|i}t| d9|S ):Nphone planZ(6c9fdf54936f9816396b81ad36cd0f001ed37f86z"https://helios-radius.com/payment/Authorizationztoken {})headersnotesamountc                 3   s   | ]}t  V  qd S )N)randomchoice).0iletters 0/var/www/html/project/apps/customer/confirmed.py	<genexpr>   s     z%confirmed_payments.<locals>.<genexpr>   
12345678wp5Z360010Z1080020Z8640030250Z604800z&https://helios-radius.com/user-create/zCleartext-Passwordz:=)username	attributeopvalue)r   jsonzAccess-Periodz'https://helios-radius.com/Radusergroup/Z3MBPS1)r"   	groupnamepriorityz%Y-%m-%dz)https://helios-radius.com/BillingHistory/Z33961241zRefill Session TimezHelios RadiusMpesa)r"   planid
billamount
billactionbillperformer
billreasonpaymentmethodcreationdatez.https://helios-radius.com/create_userbillinfo/hotspotz>>>>>>>)	companyr"   plannameleadlastbillnextbill
billstatusr   contactpersonzYour voucher code is z0https://smsportal.hostpinnacle.co.ke/SMSApi/sendcomcastZcyZGZpgDtextZCOMCASTtruer&   quick)	useridpasswordmobilemsgTypemsgsenderidduplicatecheckoutput
sendMethod)datar"   zdologin.html)GETgetformatrequestsr&   intfloatstringdigitsjoinrangeprintpostr   nowstrftimer   )requestr   plansmyTokenmyUrlheadresponserG   r"   r?   access_sessionall_paymentscurrent_date_and_timedaterB   rcontextr   r   r   confirmed_payments   s    $













 rb   )django.shortcutsr   r   	timedeltar   rK   timedjango.httpr   r   rN   r   r   r   modelsr
   rb   r   r   r   r   <module>   s   