From 74b6e52025d33e34e4d619efa64f7e3cfea5ef87 Mon Sep 17 00:00:00 2001 From: Gurch Rai Date: Mon, 21 Nov 2016 13:10:16 -0800 Subject: [PATCH] Restrict addon to Finland only in wizard Refs SH-478 --- shuup_checkoutfi/admin_forms.py | 6 +++++- shuup_checkoutfi/locale/en/LC_MESSAGES/django.po | 6 ++++-- .../templates/shuup/checkoutfi/wizard_form.jinja | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/shuup_checkoutfi/admin_forms.py b/shuup_checkoutfi/admin_forms.py index 6f83fdf..6230a1a 100644 --- a/shuup_checkoutfi/admin_forms.py +++ b/shuup_checkoutfi/admin_forms.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- from django import forms - from shuup.admin.forms import ShuupAdminForm from shuup.admin.modules.service_providers.forms import (ServiceWizardForm, ServiceWizardFormDef) +from shuup.core.models import Shop from .models import CheckoutFiPaymentProcessor @@ -29,3 +29,7 @@ def __init__(self): form_class=CheckoutFiWizardForm, template_name="shuup/checkoutfi/wizard_form.jinja" ) + + def visible(self): + shop = Shop.objects.first() + return not shop or not shop.contact_address or shop.contact_address.country == "FI" diff --git a/shuup_checkoutfi/locale/en/LC_MESSAGES/django.po b/shuup_checkoutfi/locale/en/LC_MESSAGES/django.po index 99454f9..c1b1bcb 100644 --- a/shuup_checkoutfi/locale/en/LC_MESSAGES/django.po +++ b/shuup_checkoutfi/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-10-11 23:50+0000\n" +"POT-Creation-Date: 2016-11-21 21:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -54,7 +54,9 @@ msgstr "" #, python-format msgid "" -"Accept credit cards using Checkout.fi" +"Accept credit cards using Checkout.fi. " +"Checkout.fi is one of the largest Finnish payment service providers and " +"supports bank payments, Visa, and Mastercard." msgstr "" msgid "Don't have an account?" diff --git a/shuup_checkoutfi/templates/shuup/checkoutfi/wizard_form.jinja b/shuup_checkoutfi/templates/shuup/checkoutfi/wizard_form.jinja index a92faae..e9ff42a 100644 --- a/shuup_checkoutfi/templates/shuup/checkoutfi/wizard_form.jinja +++ b/shuup_checkoutfi/templates/shuup/checkoutfi/wizard_form.jinja @@ -3,7 +3,8 @@ {% call service_provider_section( identifier=form_def.name, header="Checkout.fi", - description=gettext("Accept credit cards using Checkout.fi", url="http://www.checkout.fi") + description=gettext("Accept credit cards using Checkout.fi. Checkout.fi is one of the largest Finnish payment service providers and supports bank payments, Visa, and Mastercard.", url="http://www.checkout.fi"), + allowed_countries="FI" )%} {% set form = pane.forms[form_def.name] %}