Skip to content

Commit

Permalink
Merge pull request #197 from FJNR-inc/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
RignonNoel authored Sep 26, 2019
2 parents e9abea1 + d93fd21 commit 718f12c
Show file tree
Hide file tree
Showing 13 changed files with 491 additions and 149 deletions.
53 changes: 37 additions & 16 deletions blitz_api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,30 +307,51 @@
# User specific settings

LOCAL_SETTINGS = {
'ORGANIZATION': config('ORGANIZATION', default='Blitz'),
'EMAIL_SERVICE': config('EMAIL_SERVICE', default=False, cast=bool),
'AUTO_ACTIVATE_USER': config('AUTO_ACTIVATE_USER', default=False,
cast=bool),
'ORGANIZATION': config(
'ORGANIZATION',
default='Blitz',
),
'EMAIL_SERVICE': config(
'EMAIL_SERVICE',
default=False,
cast=bool,
),
'AUTO_ACTIVATE_USER': config(
'AUTO_ACTIVATE_USER',
default=False,
cast=bool,
),
'FRONTEND_INTEGRATION': {
'ACTIVATION_URL': config('ACTIVATION_URL',
default='https://example.com/activate/{{token}}'),
'POLICY_URL': config(
'ACTIVATION_URL',
default='http://thesez-vous.org/policy',
),
'ACTIVATION_URL': config(
'ACTIVATION_URL',
default='https://example.com/activate/{{token}}',
),
'EMAIL_CHANGE_CONFIRMATION': config(
'EMAIL_CHANGE_CONFIRMATION',
default='https://example.com/validate/email/{{token}}'
),
'FORGOT_PASSWORD_URL': config('FORGOT_PASSWORD_URL',
default='https://example.com/reset-password/{{token}}'),
'RETREAT_INVITATION_URL':
config('RETREAT_INVITATION_URL',
default='https://example.com/retreat_invitation/{{token}}'),
'RETREAT_UNSUBSCRIBE_URL':
config('RETREAT_UNSUBSCRIBE_URL',
default='https://example.com/wait_queue/'
'{{wait_queue_id}}/unsubscribe'),
'FORGOT_PASSWORD_URL': config(
'FORGOT_PASSWORD_URL',
default='https://example.com/reset-password/{{token}}',
),
'RETREAT_INVITATION_URL': config(
'RETREAT_INVITATION_URL',
default='https://example.com/retreat_invitation/{{token}}',
),
'RETREAT_UNSUBSCRIBE_URL': config(
'RETREAT_UNSUBSCRIBE_URL',
default='https://example.com/wait_queue/{{wait_queue_id}}/unsubscribe',
),
},
'SELLING_TAX': 0.14975,
'RETREAT_NOTIFICATION_LIFETIME_DAYS': config(
'RETREAT_NOTIFICATION_LIFETIME_DAYS', default=30),
'RETREAT_NOTIFICATION_LIFETIME_DAYS',
default=30,
),
}

# Payment settings
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pycodestyle==2.5.0
coveralls==1.8.2
responses==0.10.6
six==1.12.0
awscli==1.16.238
awscli==1.16.240
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ django-cors-headers==3.1.0
django-filter==2.2.0
coreapi==2.3.3
factory-boy==2.12.0
Markdown==2.6.11
Pygments==2.4.2
Markdown==3.1.1
django-anymail==6.1.0
Pillow==6.1.0
django-simple-history==2.7.3
djangorestframework-filters==0.11.1
python-decouple==3.1
django-storages==1.7.2
dj_database_url==0.5.0
zappa==0.47.0
zappa==0.48.2
psycopg2==2.7.5
django-safedelete==0.5.2
-e git+https://github.com/Rhumbix/django-request-logging.git@9342ee6064e678fd162418b142d781550d23101c#egg=django_request_logging
Expand Down
16 changes: 6 additions & 10 deletions retirement/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,16 +802,7 @@ def update(self, instance, validated_data):
),
}

plain_msg = render_to_string("invoice.txt", merge_data)
msg_html = render_to_string("invoice.html", merge_data)

send_mail(
"Confirmation d'achat",
plain_msg,
settings.DEFAULT_FROM_EMAIL,
[order.user.email],
html_message=msg_html,
)
Order.send_invoice([order.user.email], merge_data)

# Send refund confirmation email
if need_refund:
Expand Down Expand Up @@ -853,6 +844,11 @@ def update(self, instance, validated_data):
'NEW_RETREAT': new_retreat,
'OLD_RETREAT': old_retreat,
}
if len(new_retreat.pictures.all()):
merge_data['RETREAT_PICTURE'] = "{0}{1}".format(
settings.MEDIA_URL,
new_retreat.pictures[0].picture.url
)

plain_msg = render_to_string("exchange.txt", merge_data)
msg_html = render_to_string("exchange.html", merge_data)
Expand Down
58 changes: 46 additions & 12 deletions retirement/templates/reminder.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@
</div>
<div class="email__content">
<h1 class="email__content__title">
Plus qu'une semaine avant la retraite!
Plus que 7 jours avant la retraite!
</h1>
<p>
Nous sommes heureux de vous compter parmi nous à la retraite {{RETREAT.name}}. Nous profitons de ce rappel pour vous recommuniquer les informations relatives à l'événement!
Nous profitons de ce rappel pour vous recommuniquer les informations relatives à l'événement!
</p>

{% language 'fr' %}
Expand All @@ -91,20 +91,55 @@ <h1 class="email__content__title">
</ul>
{% endlanguage %}

{% if RETREAT.email_content %}
<h2 class="email__content__subtitle">
Ce que vous devez savoir
Planifier votre retraite de rédaction
</h2>
<p>
{{RETREAT.email_content}}
</p>
{% endif %}
<div class="email__content__summary">
Pour bien planifier votre retraite de rédaction, consultez la page "S'y préparer".
Vous y trouverez l'horaire, le matériel à apporter, ainsi que de précieuses indications pour établir
des objectifs de rédaction réalistes. Si vous prenez le temps de bien préparer votre retraite et vos
objectifs de rédaction, vous en profiterez d'avantage!
</div>
<center>
<table width="100%">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20" width="100%" style="font-size: 20px; line-height: 20px;">
&nbsp;
</td>
</tr>
</table>
<table border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">
<tbody>
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" style="margin:0 auto;">
<tr>
<td align="center" bgcolor="#142823" width="150" style="-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;">
<a href="http://www.thesez-vous.com/sypreparer.html" style="padding: 10px;width:150px;display: block;text-decoration: none;border:0;text-align: center;font-weight: bold;font-size: 15px;font-family: sans-serif;color: #F7EDD9;background: #142823;border: 1px solid #142823;-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;line-height:17px;" class="button_link">
S'y préparer
</a>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</center>

<h2 class="email__content__subtitle">
Formulaire
Important
</h2>
<div class="email__content__summary">
Si ce n'est pas déjà fait, veuillez remplir le formulaire suivant afin que nous puissions préparer votre arrivée!
Si ce n'est pas déjà fait à partir de votre profil sur la plateforme thesez-vous.org,
veuillez remplir le formulaire suivant qui permet de répartir les chambres selon
vos préférences.
</div>
<center>
<table width="100%">
Expand Down Expand Up @@ -142,8 +177,7 @@ <h2 class="email__content__subtitle">
L'équipe Thèsez-vous
</h2>
<p>
Thèsez-vous n'autorise pas d'échanges ou de remboursements.<br>
Thèsez-vous (Blitz Paradisio), 7640 Lajeunesse, Montréal, Quebec, H2R2J2<br>
Thèsez-vous (Blitz Paradisio), 7640 Lajeunesse, Montréal, Québec, H2R2J2<br>
[email protected], www.thesez-vous.com
</p>
</div>
Expand Down
42 changes: 24 additions & 18 deletions retirement/templates/reminder.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@


{% load static %}
{% load i18n %}


** PLUS QU'UNE SEMAINE AVANT LA RETRAITE!
------------------------------------------------------------
===================================
PLUS QUE 7 JOURS AVANT LA RETRAITE!
===================================

Nous sommes heureux de vous compter parmi nous à la retraite {{RETREAT.name}}. Nous profitons de ce rappel pour vous recommuniquer les informations relatives à l'événement!

Expand All @@ -16,27 +14,35 @@ Nous sommes heureux de vous compter parmi nous à la retraite {{RETREAT.name}}.
{% endlanguage %}


{% if RETREAT.email_content %} 
** CE QUE VOUS DEVEZ SAVOIR
------------------------------------------------------------
=====================================
Planifier votre retraite de rédaction
=====================================

{{RETREAT.email_content}}
{% endif %}
Pour bien planifier votre retraite de rédaction, consultez la page S'y
préparer. Vous y trouverez l’horaire, le matériel à apporter, ainsi que de
précieuses indications pour établir des objectifs de rédaction réalistes. Si
vous prenez le temps de bien préparer votre retraite et vos objectifs de
rédaction, vous en profiterez davantage!


** FORMULAIRE
------------------------------------------------------------
Lien de la page:

Si ce n'est pas déjà fait, veuillez remplir le formulaire suivant afin que nous puissions préparer votre arrivée!
http://www.thesez-vous.com/sypreparer.html


=========
IMPORTANT
=========

Formulaire ({{RETREAT.form_url}})
Si ce n'est pas déjà fait à partir de votre profil sur la plateforme thesez-vous.org,
veuillez remplir le formulaire suivant qui permet de répartir les chambres selon
vos préférences.

Formulaire: ({{RETREAT.form_url}})


** L'ÉQUIPE THÈSEZ-VOUS
------------------------------------------------------------
====================
L'ÉQUIPE THÈSEZ-VOUS
====================

Thèsez-vous n'autorise pas d'échanges ou de remboursements.
Thèsez-vous (Blitz Paradisio), 7640 Lajeunesse, Montréal, Quebec, H2R2J2
[email protected], www.thesez-vous.com
26 changes: 4 additions & 22 deletions retirement/templates/retreat_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
.email__content__details__picture {
flex: 1;
background-image: url('{{ STATIC_URL }}images/THES_retraite_40e.JPG');
background-image: url('{{ RETREAT_PICTURE }}');
background-size: cover;
margin-right: 20px;
}
Expand Down Expand Up @@ -180,15 +180,6 @@ <h4>{{RETREAT.name}}</h4>
{{RETREAT.end_time|date:"l j F Y "|capfirst}}{{RETREAT.end_time|date:"G"}}h{{RETREAT.end_time|date:"i"}}
</span>
</div>

<div class="email__content__details__text__info">
<span class="email__content__details__text__info__label">
Animation:
</span>
<span class="email__content__details__text__info__value">
{{RETREAT.animation}}
</span>
</div>
</div>
</div>

Expand All @@ -198,7 +189,7 @@ <h4>{{RETREAT.name}}</h4>
Planifier votre retraite de rédaction
</div>
<div class="email__content__content">
Pour bien planifier votre retraite de rédaction, consultez la page <a href="">S'y préparer</a>.
Pour bien planifier votre retraite de rédaction, consultez la page "S'y préparer".
Vous y trouverez l'horaire, le matériel à apporter, ainsi que de précieuses indications pour établir
des objectifs de rédaction réalistes. Si vous prenez le temps de bien préparer votre retraite et vos
objectifs de rédaction, vous en profiterez d'avantage!
Expand Down Expand Up @@ -262,7 +253,7 @@ <h4>{{RETREAT.name}}</h4>
Au plaisir de se retrouver et de rédiger tous ensemble!
</p>
<p class="email__content__footer__name">
Annie-Pier et toute l'équipe de Thèsez-vous
Toute l'équipe de Thèsez-vous
</p>
</div>
</div>
Expand Down Expand Up @@ -320,15 +311,6 @@ <h4>{{RETREAT.name}}</h4>
{{RETREAT.end_time|date:"G"}}h{{RETREAT.end_time|date:"i"}}
</span>
</div>

<div class="email__content__details__text__info">
<span class="email__content__details__text__info__label">
Animation:
</span>
<span class="email__content__details__text__info__value">
{{RETREAT.animation}}
</span>
</div>
</div>
</div>

Expand Down Expand Up @@ -413,7 +395,7 @@ <h4>{{RETREAT.name}}</h4>
With pleasure to write all together at this bilingual retreat!
</p>
<p class="email__content__footer__name">
Annie-Pier and the team of Thèsez-Vous?
Thèsez-Vous Team
</p>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions retirement/templates/retreat_info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Faire une annonce :

Au plaisir de se retrouver et de rédiger tous ensemble!

Annie-Pier et toute l'équipe de Thèsez-Vous?
Toute l'équipe de Thèsez-Vous?

© 2019, Thèsez-vous.

Expand Down Expand Up @@ -126,6 +126,6 @@ address: [email protected].

With pleasure to write all together at this bilingual retreat!

Annie-Pier and the team of Thèsez-Vous?
Thèsez-Vous Team

© 2019, Thèsez-vous.
19 changes: 19 additions & 0 deletions store/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation
)
from django.core.mail import send_mail
from django.contrib.contenttypes.models import ContentType
from django.template.loader import render_to_string

from safedelete.models import SafeDeleteModel

Expand Down Expand Up @@ -98,6 +100,23 @@ def total_ticket(self):
def __str__(self):
return str(self.authorization_id)

@staticmethod
def send_invoice(to, merge_data):
if 'POLICY_URL' not in merge_data.keys():
merge_data['POLICY_URL'] = settings.\
LOCAL_SETTINGS['FRONTEND_INTEGRATION']['POLICY_URL']

plain_msg = render_to_string("invoice.txt", merge_data)
msg_html = render_to_string("invoice.html", merge_data)

send_mail(
"Confirmation d'achat",
plain_msg,
settings.DEFAULT_FROM_EMAIL,
to,
html_message=msg_html,
)

def applying_coupon(self, coupon, user):
from store.services import validate_coupon_for_order
coupon_info = validate_coupon_for_order(coupon, self)
Expand Down
Loading

0 comments on commit 718f12c

Please sign in to comment.