amounts = self.monthlyamount_set if monthly else self.singleamount_set
amount = amounts.all().filter(amount__lte=amount).last()
return amount.description if amount is not None else ''
+
+ @property
+ def paypal_enabled(self):
+ print("ENABLED?", settings.PAYPAL_ENABLED)
+ return settings.PAYPAL_ENABLED
class SingleAmount(models.Model):
is_onetime = False
def invite_widget(self, schedule, request):
- return render_to_string(
- 'club/payment/paypal_invite.html',
- {
- 'schedule': schedule,
- },
- request=request
- )
+ if settings.PAYPAL_ENABLED:
+ return render_to_string(
+ 'club/payment/paypal_invite.html',
+ {
+ 'schedule': schedule,
+ },
+ request=request
+ )
+ else:
+ return ''
def initiate(self, request, schedule):
app = request.GET.get('app')
</form>
<div class="l-checkout__secure">
-<img src="{% static '2022/images/payments-padlock.png' %}" class="l-checkout__secure__padlock">
-Bezpieczne płatności zapewniają:
-<img src="{% static '2022/images/payments-2.png' %}" class="l-checkout__secure__img">
+ <img src="{% static '2022/images/payments-padlock.png' %}" class="l-checkout__secure__padlock">
+ Bezpieczne płatności zapewniają:
+ <img src="{% static '2022/images/payments-payu.png' %}" class="l-checkout__secure__img" alt="PayU Visa MasterCard">
+ {% if club.paypal_enabled %}
+ <img src="{% static '2022/images/payments-paypal.png' %}" class="l-checkout__secure__img" alt="PayPal">
+ {% endif %}
</div>
<div class="l-checkout__cols bt-w">
</div>
</div>
<div class="l-checkout__form__row confirm">
- <a href=".#{{ view.step1_hash }}">Powrót</a>
+ <a href="{% url 'donation_step1' schedule.key %}">Powrót</a>
<div class="l-checkout__input">
<button>Dalej</button>
</div>
<div class="l-checkout__secure">
<img src="{% static '2022/images/payments-padlock.png' %}" class="l-checkout__secure__padlock">
Bezpieczne płatności zapewniają:
- <img src="{% static '2022/images/payments-2.png' %}" class="l-checkout__secure__img">
+ <img src="{% static '2022/images/payments-payu.png' %}" class="l-checkout__secure__img" alt="PayU Visa MasterCard">
+ {% if club.paypal_enabled %}
+ <img src="{% static '2022/images/payments-paypal.png' %}" class="l-checkout__secure__img" alt="PayPal">
+ {% endif %}
</div>
{% endblock %}
{{ schedule.amount|floatformat }} zł
{% if schedule.monthly %}
<span>/mies.</span>
- {% endif %}</h3>
- <img src="{% static '2022/images/checkout-img-3.jpg' %}" alt="">
+ {% endif %}</h3>
+ <img src="{% static '2022/images/checkout-img-3.jpg' %}" alt="">
</div>
</div>
<div class="l-checkout__col">
</div>
</div>
<div class="l-checkout__form__row confirm">
- <a href="#">Powrót</a>
- <!-- div class="l-checkout__input">
- <a href="#">Dalej</a>
- </div-->
+ <a href="{% url 'donation_step2' schedule.key %}">Powrót</a>
</div>
</div>
</div>
</div>
- <img src="{% static '2022/images/checkout-footer.png' %}" alt="Bezpieczne płatności zapewniają" class="l-checkout__footer__img">
+ <div class="l-checkout__secure">
+ <img src="{% static '2022/images/payments-padlock.png' %}" class="l-checkout__secure__padlock">
+ Bezpieczne płatności zapewniają:
+ <img src="{% static '2022/images/payments-payu.png' %}" class="l-checkout__secure__img" alt="PayU Visa MasterCard">
+ {% if club.paypal_enabled %}
+ <img src="{% static '2022/images/payments-paypal.png' %}" class="l-checkout__secure__img" alt="PayPal">
+ {% endif %}
+ </div>
{% endblock %}
template_name = 'club/2022/donation_step2.html'
step = 2
+ def get_context_data(self, **kwargs):
+ c = super().get_context_data(**kwargs)
+ c['club'] = models.Club.objects.first()
+ return c
+
class JoinView(CreateView):
@property
'client_id': '',
'client_secret': '',
}
+PAYPAL_ENABLED = True
REST_FRAMEWORK = {
"DEFAULT_RENDERER_CLASSES": (