Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
Jérôme Schneider | da554cf7c4 | |
Jérôme Schneider | a4dcdf0b09 | |
Jérôme Schneider | dcb878588c |
|
@ -1,4 +0,0 @@
|
|||
include MANIFEST.in
|
||||
include VERSION
|
||||
include README
|
||||
recursive-include tipi_payment_plugin/templates *.html
|
|
@ -0,0 +1,5 @@
|
|||
tipi-payment-plugin (0.1-1) unstable; urgency=low
|
||||
|
||||
* source package automatically created by stdeb 0.6.0+git
|
||||
|
||||
-- Jérôme Schneider <jschneider@entrouvert.com> Tue, 25 Mar 2014 15:27:40 +0100
|
|
@ -0,0 +1 @@
|
|||
7
|
|
@ -0,0 +1,15 @@
|
|||
Source: tipi-payment-plugin
|
||||
Maintainer: Jérôme Schneider <jschneider@entrouvert.com>
|
||||
Section: python
|
||||
Priority: optional
|
||||
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7)
|
||||
Standards-Version: 3.9.1
|
||||
X-Python-Version: >= 2.6
|
||||
|
||||
Package: python-tipi-payment-plugin
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, ${python:Depends},
|
||||
python-django-cms (>= 2.4),
|
||||
python-django-cms (< 3.0)
|
||||
Description: Plugin django CMS for tipi payment
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
%:
|
||||
dh $@ --with python2
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
3.0 (quilt)
|
|
@ -0,0 +1 @@
|
|||
extend-diff-ignore="\.egg-info"
|
121
setup.py
121
setup.py
|
@ -1,121 +0,0 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
''' Setup script for tipi-payment-plugin
|
||||
'''
|
||||
|
||||
import glob
|
||||
import re
|
||||
import sys
|
||||
import os
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.install_lib import install_lib as _install_lib
|
||||
from distutils.command.build import build as _build
|
||||
from distutils.command.sdist import sdist
|
||||
from distutils.cmd import Command
|
||||
|
||||
class compile_translations(Command):
|
||||
description = 'compile message catalogs to MO files via django compilemessages'
|
||||
user_options = []
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
from django.core.management.commands.compilemessages import \
|
||||
compile_messages
|
||||
for path in ['tipi_payment_plugin']:
|
||||
if path.endswith('.py'):
|
||||
continue
|
||||
if not os.path.isdir(os.path.join(path, 'locale')):
|
||||
continue
|
||||
curdir = os.getcwd()
|
||||
os.chdir(os.path.realpath(path))
|
||||
compile_messages(sys.stderr)
|
||||
os.chdir(curdir)
|
||||
except ImportError:
|
||||
print
|
||||
sys.stderr.write('!!! Please install Django >= 1.4 to build translations')
|
||||
print
|
||||
print
|
||||
|
||||
class build(_build):
|
||||
sub_commands = [('compile_translations', None)] + _build.sub_commands
|
||||
|
||||
class install_lib(_install_lib):
|
||||
def run(self):
|
||||
self.run_command('compile_translations')
|
||||
_install_lib.run(self)
|
||||
|
||||
class eo_sdist(sdist):
|
||||
|
||||
def run(self):
|
||||
if os.path.exists('VERSION'):
|
||||
os.remove('VERSION')
|
||||
version = get_version()
|
||||
if '.g' in version:
|
||||
print "creating VERSION file"
|
||||
version_file = open('VERSION', 'w')
|
||||
version_file.write(version)
|
||||
version_file.close()
|
||||
sdist.run(self)
|
||||
if os.path.exists('VERSION'):
|
||||
os.remove('VERSION')
|
||||
|
||||
def get_version():
|
||||
|
||||
version = None
|
||||
if os.path.exists('VERSION'):
|
||||
version_file = open('VERSION', 'r')
|
||||
version = version_file.read()
|
||||
version_file.close()
|
||||
return version
|
||||
for d in glob.glob('*'):
|
||||
if not os.path.isdir(d):
|
||||
continue
|
||||
module_file = os.path.join(d, '__init__.py')
|
||||
if not os.path.exists(module_file):
|
||||
continue
|
||||
for v in re.findall("""__version__ *= *['"](.*)['"]""",
|
||||
open(module_file).read()):
|
||||
assert version is None
|
||||
version = v
|
||||
if version:
|
||||
break
|
||||
assert version is not None
|
||||
if os.path.exists('.git'):
|
||||
import subprocess
|
||||
p = subprocess.Popen(['git','describe','--dirty','--match=v*'],
|
||||
stdout=subprocess.PIPE)
|
||||
result = p.communicate()[0]
|
||||
assert p.returncode == 0, 'git returned non-zero'
|
||||
new_version = result.split()[0][1:]
|
||||
assert new_version.split('-')[0] == version, '__version__ must match the last git annotated tag'
|
||||
version = new_version.replace('-', '.')
|
||||
return version
|
||||
|
||||
|
||||
setup(name="tipi-payment-plugin",
|
||||
version=get_version(),
|
||||
license="BSD license",
|
||||
description="",
|
||||
author="Entr'ouvert",
|
||||
author_email="info@entrouvert.org",
|
||||
maintainer="Serghei Mihai",
|
||||
maintainer_email="smihai@entrouvert.com",
|
||||
include_package_data=True,
|
||||
packages=find_packages(),
|
||||
setup_requires=[
|
||||
'django>=1.4',
|
||||
],
|
||||
install_requires=[
|
||||
'django-cms<3',
|
||||
],
|
||||
cmdclass={'build': build, 'install_lib': install_lib,
|
||||
'compile_translations': compile_translations,
|
||||
'sdist': eo_sdist},
|
||||
)
|
|
@ -1 +0,0 @@
|
|||
__version__ = "0.1"
|
|
@ -1,16 +0,0 @@
|
|||
from django.utils.translation import ugettext as _
|
||||
from cms.plugin_base import CMSPluginBase
|
||||
from cms.plugin_pool import plugin_pool
|
||||
|
||||
from .models import TipiPluginModel
|
||||
|
||||
class TipiPlugin(CMSPluginBase):
|
||||
model = TipiPluginModel
|
||||
name = _(u'Formulaire de paiement TIPI')
|
||||
render_template = 'tipi.html'
|
||||
|
||||
def render(self, context, instance, placeholder):
|
||||
context.update({'instance': instance})
|
||||
return context
|
||||
|
||||
plugin_pool.register_plugin(TipiPlugin)
|
|
@ -1,18 +0,0 @@
|
|||
#-*- coding: utf-8 -*-
|
||||
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from cms.models import CMSPlugin
|
||||
|
||||
SAISIES = (
|
||||
('T', 'T'),
|
||||
('M', 'M'),
|
||||
('X', 'X'),
|
||||
)
|
||||
|
||||
class TipiPluginModel(CMSPlugin):
|
||||
url = models.URLField(help_text=_(u'addresse de paiement sur le site de la DGFiP'))
|
||||
numero_client = models.CharField(max_length=64, help_text=_(u'le numéro de régie attribué par la DGFiP'))
|
||||
saisie = models.CharField(max_length=1, choices=SAISIES)
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
{% load sekizai_tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% addtoblock "js" %}
|
||||
<script type="text/javascript">
|
||||
var popup;
|
||||
var timer;
|
||||
|
||||
function checkpopup() {
|
||||
if(popup.closed) {
|
||||
document.getElementById('wip').style.display='none';
|
||||
document.forms['tipi'].reset();
|
||||
clearInterval(timer);
|
||||
}
|
||||
}
|
||||
|
||||
function tipi() {
|
||||
var params = {'refdet': function(value) {
|
||||
var refdet = value.trim();
|
||||
if(isNaN(refdet))
|
||||
return false;
|
||||
return refdet;
|
||||
}, 'montant': function(value) {
|
||||
var montant = value.trim();
|
||||
montant = parseFloat(montant);
|
||||
if (isNaN(montant) && montant > 9999.99)
|
||||
return false;
|
||||
return montant*100;
|
||||
}, 'mel': function(value) {
|
||||
var mel = value.trim();
|
||||
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
if(re.test(mel))
|
||||
return mel;
|
||||
return false;
|
||||
}};
|
||||
var tipi_url = '{{ instance.url }}?saisie={{ instance.saisie }}&numcli={{ instance.numero_client }}';
|
||||
var url_params = '&';
|
||||
|
||||
for (var field in params) {
|
||||
var valid = params[field](document.getElementById(field).value);
|
||||
if(!valid) {
|
||||
document.getElementById(field + '_error').style.display='inline';
|
||||
return false;
|
||||
} else {
|
||||
document.getElementById(field + '_error').style.display='none';
|
||||
url_params += field + '=' + valid + '&';
|
||||
}
|
||||
}
|
||||
|
||||
var url = tipi_url + url_params;
|
||||
popup = window.open(url, 'tipi', 'height=800, width=900, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
|
||||
document.getElementById('wip').style.display='block';
|
||||
timer = setInterval(checkpopup, 400);
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
{% endaddtoblock %}
|
||||
{% addtoblock "css" %}
|
||||
<style>
|
||||
#tipi {
|
||||
position: relative;
|
||||
}
|
||||
#tipi li {
|
||||
list-style-type: none;
|
||||
margin-bottom: .25em;
|
||||
}
|
||||
#tipi li label {
|
||||
float: left;
|
||||
width: 10em;
|
||||
font-weight: bold;
|
||||
}
|
||||
#tipi li label:after {
|
||||
content: ':'
|
||||
}
|
||||
#tipi li input[type=text] {
|
||||
border: 1px solid #bbb;
|
||||
}
|
||||
#tipi .error {
|
||||
color: #f00;
|
||||
font-size:.9em;
|
||||
display: none;
|
||||
}
|
||||
#tipi #wip {
|
||||
position: absolute;
|
||||
background: #fff;
|
||||
opacity: .8;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: none;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
{% endaddtoblock %}
|
||||
<div id="tipi">
|
||||
<div id="wip">
|
||||
<h3>{% trans "Paiement en cours..." %}</h3>
|
||||
</div>
|
||||
<form action='javascript:tipi()' name='tipi'>
|
||||
<ul>
|
||||
<li>
|
||||
<label>{% trans "Numéro de facture" %}</label>
|
||||
<input type='text' id='refdet' />
|
||||
<span class="error" id="refdet_error">{% trans "numéro invalide" %}</span>
|
||||
</li>
|
||||
<li>
|
||||
<label>{% trans "Montant" %}</label>
|
||||
<input type='text' id='montant' size="6" maxlength="6" placeholder="0000.00" /> €
|
||||
<span class="error" id="montant_error">{% trans "montant invalide" %}</span>
|
||||
</li>
|
||||
<li>
|
||||
<label>{% trans "Votre courriel" %}</label>
|
||||
<input type='email' id='mel' placeholder="{% trans "nom@domaine.com" %}" />
|
||||
<span class="error" id="mel_error">{% trans "courriel invalide" %}</span></li>
|
||||
<li>
|
||||
<input type='submit' value='{% trans "Payer" %}' />
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
Reference in New Issue