1313
1414from pythonpro .mailchimp import facade as mailchimp_facade
1515from pythonpro .payments import facade as payment_facade
16+ from pythonpro .payments .facade import PYTOOLS_PRICE
1617
1718
1819def options (request ):
@@ -61,9 +62,23 @@ def _extract_boleto_params(dct):
6162 return {k : dct [k ] for k in ['boleto_barcode' , 'boleto_url' ]}
6263
6364
65+ @login_required
66+ def client_landing_page (request ):
67+ notification_url = reverse ('payments:pagarme_notification' , kwargs = {'user_id' : request .user .id })
68+ return render (
69+ request ,
70+ 'payments/client_landing_page.html' , {
71+ 'PAGARME_CRYPTO_KEY' : settings .PAGARME_CRYPTO_KEY ,
72+ 'price' : PYTOOLS_PRICE ,
73+ 'notification_url' : request .build_absolute_uri (
74+ notification_url
75+ )
76+ })
77+
78+
6479def pagarme_notification (request , user_id : int ):
6580 if request .method != 'POST' :
66- return HttpResponseNotAllowed (['POST' ])
81+ return HttpResponseNotAllowed ([request . method ])
6782
6883 paymento_ok = payment_facade .confirm_boleto_payment (
6984 user_id , request .POST , request .body .decode ('utf8' ), request .headers ['X-Hub-Signature' ])
@@ -78,7 +93,7 @@ def pagarme_notification(request, user_id: int):
7893 }
7994 )
8095 send_mail (
81- 'Inscrição no curso Pytool realizad, confira o link com detalhes! ' ,
96+ 'Inscrição no curso Pytool realizada! Confira o link com detalhes. ' ,
8297 msg ,
8398 settings .DEFAULT_FROM_EMAIL ,
8499 [user .email ]
0 commit comments