Skip to content

Commit c9c5565

Browse files
authored
fix: utilisation de la v5 de l'api helloasso (#1152)
1 parent 7af8e86 commit c9c5565

File tree

14 files changed

+473
-367
lines changed

14 files changed

+473
-367
lines changed

app/Resources/views/admin/helloasso/_partial/campaign.html.twig

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,45 @@
11
{% if campaign %}
2-
<div class="card-panel {% if campaign.state == 'DISABLED' %}blue-grey{% elseif campaign.state == 'PRIVATE' %}blue{% else %}teal{% endif %} lighten-4">
2+
<div class="card-panel {% if campaign.state == 'Disabled' %}blue-grey{% elseif campaign.state == 'Private' %}blue{% else %}teal{% endif %} lighten-4">
33
<div class="">
4-
<h5 class="card-title">{{ campaign.name }}</h5>
4+
<h5 class="card-title">{{ campaign.title }}</h5>
55
<table>
66
<tr>
77
<td>type</td>
88
<td>
9-
{% if campaign.type == 'FUNDRAISER' %}
9+
{% if campaign.formType == 'CrowdFunding' %}
1010
<i class="material-icons">people</i>Crowdfounding
11-
{% elseif campaign.type == 'MEMBERSHIP' %}
11+
{% elseif campaign.formType == 'Membership' %}
1212
<i class="material-icons">card_membership</i>Adhésion
13-
{% elseif campaign.type == 'FORM' %}
13+
{% elseif campaign.formType == 'PaymentForm' %}
1414
Formulaire
1515
{% else %}
16-
{{ campaign.type }}
16+
{{ campaign.formType }}
1717
{% endif %}
1818
</td>
1919
</tr>
2020
<tr>
2121
<td>status</td>
2222
<td>
23-
{% if campaign.state == 'PRIVATE' %}
23+
{% if campaign.state == 'Private' %}
2424
<i class="material-icons tiny">visibility_off</i> privé
25-
{% elseif campaign.state == 'DISABLED' %}
25+
{% elseif campaign.state == 'Disabled' %}
2626
<i class="material-icons tiny">block</i> désactivé
27-
{% elseif campaign.state == 'PUBLIC' %}
27+
{% elseif campaign.state == 'Public' %}
2828
<i class="material-icons tiny">public</i> publique
2929
{% else %}
3030
{{ campaign.state }}
3131
{% endif %}
3232
</td>
3333
</tr>
34-
<tr>
35-
<td>chiffres</td>
36-
<td>
37-
{{ campaign.funding }}€ / {{ campaign.supporters }}<i class="material-icons tiny">person</i>
38-
</td>
39-
</tr>
40-
{% if campaign.state != 'DISABLED' %}
34+
{% if campaign.state != 'Disabled' %}
4135
<tr>
4236
<td>lien web</td>
4337
<td><i class="material-icons tiny">link</i><a href="{{ campaign.url }}" target="_blank" class=""><small>{{ campaign.url }}</small></a></td>
4438
</tr>
4539
{% endif %}
4640
</table>
4741
{% if no_link is not defined %}
48-
<a href="{{ path("helloasso_browser",{campaign:campaign.id}) }}" class="btn"><i class="material-icons tiny left">attach_money</i>Voir les paiments</a>
42+
<a href="{{ path("helloasso_campaign_details",{formType: campaign.formType, slug: campaign.formSlug}) }}" class="btn"><i class="material-icons tiny left">attach_money</i>Voir les paiments</a>
4943
{% endif %}
5044
</div>
5145
</div>

app/Resources/views/admin/helloasso/browser.html.twig

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<a href="{{ path('helloasso_browser') }}"><i class="material-icons">contact_mail</i>&nbsp;Liste des campagnes Helloasso</a>
77
{% if campaigns is not defined and campaign is defined %}
88
<i class="material-icons">chevron_right</i>
9-
<strong>{{ campaign.name }}</strong>
9+
<strong>{{ campaign.title }}</strong>
1010
{% endif %}
1111
{% endblock %}
1212

@@ -20,8 +20,8 @@
2020
</div>
2121
{% endfor %}
2222
</div>
23-
{% elseif campaigns is defined and campaigns is not null %}
24-
<h5>campagne : <strong>{{ campaign.name }}</strong></h5>
23+
{% elseif campaign is defined and campaign is not null %}
24+
<h5>campagne : <strong>{{ campaign.title }}</strong></h5>
2525
{% include "admin/helloasso/_partial/campaign.html.twig" with { campaign: campaign, no_link: true } %}
2626
<table>
2727
<thead>
@@ -56,26 +56,26 @@
5656
{% for payment in payments %}
5757
<tr id="helloassopayment_{{ payment.id }}">
5858
<td>{{ payment.id }}</td>
59-
<td>{{ payment.date }}</td>
60-
<td>{{ payment.amount }}</td>
61-
<td>{{ payment.type }}</td>
62-
<td>{{ payment.payer_first_name }}</td>
63-
<td>{{ payment.payer_last_name }}</td>
59+
<td>{{ payment.date | date('d-m-Y')}}</td>
60+
<td>{{ payment.amount / 100 }}</td>
61+
<td>{{ payment.paymentMeans }}</td>
62+
<td>{{ payment.payer.firstName }}</td>
63+
<td>{{ payment.payer.lastName }}</td>
6464
<td>{% if payment.payer_city is defined %}{{ payment.payer_address }}{% endif %}</td>
6565
<td>{% if payment.payer_city is defined %}{{ payment.payer_zip_code }}{% endif %}</td>
6666
<td>{% if payment.payer_city is defined %}{{ payment.payer_city }}{% endif %}</td>
67-
<td>{{ payment.payer_country }}</td>
68-
<td>{{ payment.payer_email }}</td>
69-
<td>{{ payment.status }}</td>
67+
<td>{{ payment.payer.country }}</td>
68+
<td>{{ payment.payer.email }}</td>
69+
<td>{{ payment.state }}</td>
7070
<td>
7171
<ul>
72-
{% for key,action in payment.actions %}
73-
<li>#{{ action.id }} {{ action.amount }}€ ({{ action.type }})</li>
72+
{% for key,action in payment.items %}
73+
<li>#{{ action.id }} {{ action.amount / 100 }}€ ({{ action.type }})</li>
7474
{% endfor %}
7575
</ul>
7676
</td>
7777
<td>
78-
<form action="{{ path("helloasso_manual_paiement_add",{paiementId : payment.id }) }}" method="post">
78+
<form action="{{ path("helloasso_manual_paiement_add",{formType: campaign.formType, slug: campaign.formSlug, paymentId : payment.id }) }}" method="post">
7979
<input type="hidden" name="paiementId" value="{{ payment.id }}">
8080
<button class="btn red" type="submit"><i class="material-icons">save</i></button>
8181
</form>
@@ -87,15 +87,15 @@
8787
</table>
8888
<ul class="pagination">
8989
<li class="{% if(current_page==1) %}disabled{% else %}waves-effect{% endif %}">
90-
<a href="{% if(current_page==1) %}#!{% else %}{{ path("helloasso_browser",{campaign:campaign.id,'page':current_page-1}) }}{% endif %}">
90+
<a href="{% if(current_page==1) %}#!{% else %}{{ path("helloasso_campaign_details",{formType: campaign.formType, slug: campaign.formSlug, 'page':current_page-1}) }}{% endif %}">
9191
<i class="material-icons">chevron_left</i>
9292
</a>
9393
</li>
9494
{% for i in range(1, page_count) %}
95-
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="{{ path("helloasso_browser",{campaign:campaign.id,'page':i}) }}">{{ i }}</a></li>
95+
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="{{ path("helloasso_campaign_details",{formType: campaign.formType, slug: campaign.formSlug, 'page':i}) }}">{{ i }}</a></li>
9696
{% endfor %}
9797
<li class="{% if(current_page==page_count) %}disabled{% else %}waves-effect{% endif %}">
98-
<a href="{% if(current_page==page_count) %}#!{% else %}{{ path("helloasso_browser",{campaign:campaign.id,'page':current_page+1}) }}{% endif %}">
98+
<a href="{% if(current_page==page_count) %}#!{% else %}{{ path("helloasso_campaign_details",{formType: campaign.formType, slug: campaign.formSlug, 'page':current_page+1}) }}{% endif %}">
9999
<i class="material-icons">chevron_right</i>
100100
</a>
101101
</li>

app/config/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ framework:
3838
assets: ~
3939
php_errors:
4040
log: true
41+
cache:
42+
app: cache.adapter.filesystem
4143

4244
# Twig Configuration
4345
twig:

app/config/parameters.yml.dist

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,12 @@ parameters:
8484
registration_every_civil_year: false
8585
registration_manual_enabled: true
8686
helloasso_registration_campaign_url: https://www.helloasso.com/associations/my-local-coop/adhesions/re-adhesion
87-
helloasso_campaign_id:
88-
helloasso_api_key:
89-
helloasso_api_password:
90-
helloasso_api_base_url: https://api.helloasso.com/v3/
87+
helloasso_campaign_slug:
88+
helloasso_client_id:
89+
helloasso_client_secret:
90+
helloasso_organization_slug:
91+
helloasso_api_base_url: https://api.helloasso.com/v5/
92+
helloasso_api_auth_url: https://api.helloasso.com/oauth2/token
9193

9294
# Shifting configuration
9395
due_duration_by_cycle: 180

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
"egulias/email-validator": "^3.2",
2626
"friendsofsymfony/oauth-server-bundle": "^1.6",
2727
"friendsofsymfony/user-bundle": "^2.1",
28+
"guzzlehttp/guzzle": "^7.10",
2829
"incenteev/composer-parameter-handler": "^2.1",
2930
"knpuniversity/oauth2-client-bundle": "1.34",
31+
"league/oauth2-client": "^2.8",
3032
"liip/imagine-bundle": "^1.9",
3133
"michelf/php-markdown": "^1.9",
3234
"nesbot/carbon": "^2.62",

0 commit comments

Comments
 (0)