Skip to content

Commit 32ddac6

Browse files
davidbeigsubiabre
andauthored
Feat/new faqs (#626)
* Call to Exception from php global namespace (#601) * Add role "helper" with access to users and accounts (#602) * Allow accounts and users admin sub controller to be accessed via module perm * Add helper role with admin-module-users and admin-module-account perms * Fix/stripe refunds (#596) * Update stripe gateway responses data * Simplify stripe gateway sub request * Fix setting invest payment * Codefixes on stripe webhook controller * Cancel invest by transaction ref instead of payment ref * Fix participate invests from subscriptions (#595) * Generic logic to list and tell subscription payment methods * Change invest text on participate based on payment method subscription * Add translations * Add isSubscription method to payment method interface * Use invest method isSubscription in participate view * Fix typo * Avoid db call with shallow invest object on return array * Allow to filter backer invests by subscription based payment methods (#594) * Allow to filter backer invests by subscription based payment methods * Remove 'subscription_methods' filter * [feat] Antispam forms (#609) * Add FormHoneypot DB model * Add form honeypot in templates * Check for form honeypots in contact controller * Add timestamp to honeypot catches * Add datetime in model * [FEAT] Add project numeric ids to invests paid via Paypal (#608) * Project-based transaction ids in PayPal (#604) * Add transactionId same as CECA to PayPal * Call to Exception from php global namespace (#601) * Add role "helper" with access to users and accounts (#602) * Allow accounts and users admin sub controller to be accessed via module perm * Add helper role with admin-module-users and admin-module-account perms * Fix/stripe refunds (#596) * Update stripe gateway responses data * Simplify stripe gateway sub request * Fix setting invest payment * Codefixes on stripe webhook controller * Cancel invest by transaction ref instead of payment ref * Fix participate invests from subscriptions (#595) * Generic logic to list and tell subscription payment methods * Change invest text on participate based on payment method subscription * Add translations * Add isSubscription method to payment method interface * Use invest method isSubscription in participate view * Fix typo * Avoid db call with shallow invest object on return array * Allow to filter backer invests by subscription based payment methods (#594) * Allow to filter backer invests by subscription based payment methods * Remove 'subscription_methods' filter * Specify currency for PayPal in purchase step * Specify currency to purchase array data * Store generated transaction id with project num id + invest id in invest preapproval * Fix transactions id in payments to pool (#613) * fix use of project variable in Paypal payment method * WIP: refactor use of project in stripe metadata * change product description in stripe payment when there's no project * Left pad transaction ids with 0 --------- Co-authored-by: Daniel Subiabre <daniel.subiabre@platoniq.net> * [FIX] Product references on Stripe for wallet payments (#614) * fix use of project variable in Paypal payment method * WIP: refactor use of project in stripe metadata * change product description in stripe payment when there's no project * Left pad transaction ids with 0 * Fix references to project * Fix rediretions --------- Co-authored-by: David Igón <davidbenabarre@platoniq.net> * Fix style of honeypot input field to be of size true 0 (#611) * Fix node project get list return type (#615) * make nodeproject get list return not only arrays * change php doc definition of getList function * Move ajax loader to expected route (#618) * [fix] $dataSets variable naming (#617) * Fix $dataSets variable naming * Revert "Fix $dataSets variable naming" This reverts commit a06b2f0. * Add data sets to channel list projects route * add entries in robots.txt for new bots (#619) * [feature] project report updates (#621) * Fix code formatting * Add incomes table to project report * Add relevant associated ids to project report * Rename project num id to tracking number * [fix] report table raw invests (#622) * Pass raw invests data to report * Show full invests calcs on project report table * add migration and models to faq sections and subsections from feature/new-faq * fix faq test * create new admin modules for new faq models * change type of subsections and sections ids * make improvements based on review * refactor faqsection getfaqs function * create new admin modules for new faq models (cherry picked from commit 2caa326) * add missing copies * fixes on faq admin controller * remove unnecessary template * fix bug on faqsection admin controller * use of new methods from models and fixes * files from #400 related to the views of the new faqs * fix integration * add missing copies * refactor in partials of faq header and classes * change accordion to details tag * fix pagination in faq admin controller * add faq search action and views * not show faq subsections if empty * fixes in faq search * fixes on faq individuals styles and home colors * change date of new faqs migration * fixes on title in individual faq * fixes in styles for faqs * rename faq migration * update migration date * add drag and drop to faq forms * update migration date --------- Co-authored-by: Daniel Subiabre García <subiabrewd@gmail.com> Co-authored-by: Daniel Subiabre <daniel.subiabre@platoniq.net>
1 parent 3f1625c commit 32ddac6

File tree

107 files changed

+4054
-361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+4054
-361
lines changed

Resources/permissions.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# Full list of Permissions in Goteo
33
#
4-
# Some permission require to check if the user and the model.id is present in
4+
# Some permission require checking if the user and the model.id is present in
55
# a table.
66
#
77
# Example:
@@ -252,6 +252,10 @@ admin-module-communication: # Can access to module CommunicationAdminController
252252
model: null
253253
relational: null
254254

255+
admin-module-faqs: # Can access to module FaqAdminController
256+
model: null
257+
relational: null
258+
255259
receive-test-communications: # Can receive test communications
256260
model: null
257261
relational: null

Resources/roles.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ stats:
7272
- admin-module-stats # Can access to stats
7373
level: 40
7474

75+
helper:
76+
extends: user
77+
perms:
78+
- admin-module-users
79+
- admin-module-account
80+
level: 40
81+
7582
manager:
7683
extends: user
7784
perms:
@@ -81,6 +88,7 @@ manager:
8188
- edit-published-calls # Edit any published call
8289
- admin-module-blog # create/edit/delete non-project posts
8390
- admin-module-stories # create/edit/delete non-project posts
91+
- admin-module-faqs # create/edit/delete faqs
8492
- full-html-edit # Affects if the user is allowed dangerous tags (iframe,...) in posts
8593
- admin-module-stats # Can access to stats
8694
level: 50

Resources/templates/default/about/contact.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<div class="field">
5353
<label for="email"><?= $this->text('contact-email-field') ?></label><br />
5454
<input class="short" type="text" id="email" name="email" value="<?= $this->data['email'] ?>"/>
55+
<?= $this->insert($this->honeypot->template, $this->honeypot->params) ?>
5556
</div>
5657
</td>
5758
</tr>

Resources/templates/default/admin/projects/report.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
<?php $this->section('admin-project-content') ?>
44

5-
<?= Goteo\Core\View::get('project/report.html.php', array('project' => $this->project, 'account' => $this->account, 'Data' => $this->data, 'admin'=>true)) ?>
5+
<?= Goteo\Core\View::get('project/report.html.php', [
6+
'project' => $this->project,
7+
'account' => $this->account,
8+
'contract' => $this->contract,
9+
'invests' => $this->invests,
10+
'Data' => $this->data,
11+
'admin' => true
12+
]) ?>
613

714
<?php $this->replace() ?>
815

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
$style_hidden = "width: 0px; height: 0px; margin: 0px; padding: 0px; border: 0px; opacity: 0; display: block;"
3+
?>
4+
5+
<label for="<?= $this->trap ?>" style="<?= $style_hidden ?>">
6+
<?= $this->text('contact-email-field') ?>
7+
</label>
8+
<br style="<?= $style_hidden ?>" />
9+
<input id="<?= $this->trap ?>" name="<?= $this->trap ?>" value="" type="text" class="short" style="<?= $style_hidden ?>" />
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<?php
2+
$project = $vars['projects'];
3+
4+
$account = $vars['account'];
5+
if (!$account->vat) {
6+
$account->vat = 21;
7+
}
8+
9+
$projectFee = round($account->fee / 100, 2);
10+
11+
function countTotal($invests, $method)
12+
{
13+
$count = 0;
14+
15+
foreach ($invests as $invest) {
16+
if ($invest->status < 1) continue;
17+
if ($invest->method !== $method) continue;
18+
19+
$total = $count + 1;
20+
}
21+
22+
return $total;
23+
}
24+
25+
function calcTotal($invests, $method)
26+
{
27+
$total = 0;
28+
29+
foreach ($invests as $invest) {
30+
if ($invest->status < 1) continue;
31+
if ($invest->method !== $method) continue;
32+
33+
$total = $total + $invest->amount;
34+
}
35+
36+
return $total;
37+
}
38+
39+
$tpvTotal = calcTotal($vars['invests'], 'tpv');
40+
$tpvProjectFee = $tpvTotal * $projectFee;
41+
$tpvProjectVat = $tpvProjectFee * 0.21;
42+
$tpvGatewayFee = $tpvTotal * 0.008;
43+
$tpvGatewayVat = 0;
44+
45+
$paypalTotal = calcTotal($vars['invests'], 'paypal');
46+
$paypalProjectFee = $paypalTotal * $projectFee;
47+
$paypalProjectVat = $paypalProjectFee * 0.21;
48+
$paypalGatewayFee = ($paypalTotal * 0.034) + (countTotal($vars['invests'], 'paypal') * 0.35);
49+
$paypalGatewayVat = 0;
50+
51+
$poolTotal = calcTotal($vars['invests'], 'pool');
52+
$poolProjectFee = $poolTotal * $projectFee;
53+
$poolProjectVat = $poolProjectFee * 0.21;
54+
$poolGatewayFee = $poolTotal * 0.02;
55+
$poolGatewayVat = $poolGatewayFee * 0.21;
56+
57+
$cashTotal = calcTotal($vars['invests'], 'cash');
58+
$cashProjectFee = $cashTotal * $projectFee;
59+
$cashProjectVat = $cashProjectFee * 0.21;
60+
$cashGatewayFee = $cashTotal * 0.02;
61+
$cashGatewayVat = $cashGatewayFee * 0.21;
62+
63+
$totalTotal = $cashTotal + $poolTotal + $paypalTotal + $tpvTotal;
64+
$totalProjectFee = $cashProjectFee + $poolProjectFee + $paypalProjectFee + $tpvProjectFee;
65+
$totalProjectVat = $cashProjectVat + $poolProjectVat + $paypalProjectVat + $tpvProjectVat;
66+
$totalGatewayFee = $cashGatewayFee + $poolGatewayFee + $paypalGatewayFee + $tpvGatewayFee;
67+
$totalGatewayVat = $cashGatewayVat + $poolGatewayVat + $paypalGatewayVat + $tpvGatewayVat;
68+
69+
$reportData = [
70+
'TPV' => [
71+
'base' => \amount_format($tpvTotal, 2),
72+
'project_fee' => sprintf("%s (%s%%)", \amount_format($tpvProjectFee, 2), $account->fee,),
73+
'project_vat' => sprintf("%s (21%%)", \amount_format($tpvProjectVat, 2),),
74+
'gateway_fee' => sprintf("%s (0,8%%)", \amount_format($tpvGatewayFee, 2)),
75+
'gateway_vat' => sprintf("%s (21%%)", \amount_format($tpvGatewayVat, 2))
76+
],
77+
'PAYPAL' => [
78+
'base' => \amount_format($paypalTotal, 2),
79+
'project_fee' => sprintf("%s (%s%%)", \amount_format($paypalProjectFee, 2), $account->fee),
80+
'project_vat' => sprintf("%s (21%%)", \amount_format($paypalProjectVat, 2)),
81+
'gateway_fee' => sprintf("%s (3,4%% + 0,35 * trxs)", \amount_format($paypalGatewayFee, 2)),
82+
'gateway_vat' => sprintf("%s (21%%)", \amount_format($paypalGatewayVat, 2))
83+
],
84+
'MONEDERO' => [
85+
'base' => \amount_format($poolTotal, 2),
86+
'project_fee' => sprintf("%s (%s%%)", \amount_format($poolProjectFee, 2), $account->fee),
87+
'project_vat' => sprintf("%s (21%%)", \amount_format($poolProjectVat, 2)),
88+
'gateway_fee' => sprintf("%s (2%%)", \amount_format($poolGatewayFee, 2)),
89+
'gateway_vat' => sprintf("%s (21%%)", \amount_format($poolGatewayVat, 2))
90+
],
91+
'MANUAL' => [
92+
'base' => \amount_format($cashTotal, 2),
93+
'project_fee' => sprintf("%s (%s%%)", \amount_format($cashProjectFee, 2), $account->fee),
94+
'project_vat' => sprintf("%s (21%%)", \amount_format($cashProjectVat, 2)),
95+
'gateway_fee' => sprintf("%s (2%%)", \amount_format($cashGatewayFee, 2)),
96+
'gateway_vat' => sprintf("%s (21%%)", \amount_format($cashGatewayVat, 2)),
97+
],
98+
'TOTAL' => [
99+
'base' => \amount_format($totalTotal, 2),
100+
'project_fee' => sprintf("%s", \amount_format($totalProjectFee, 2)),
101+
'project_vat' => sprintf("%s", \amount_format($totalProjectVat, 2)),
102+
'gateway_fee' => sprintf("%s", \amount_format($totalGatewayFee, 2)),
103+
'gateway_vat' => sprintf("%s", \amount_format($totalGatewayVat, 2))
104+
]
105+
];
106+
107+
?>
108+
<table>
109+
<tr>
110+
<td></td>
111+
<td>RECAUDACIÓN</td>
112+
<td>COMISIÓN DE GOTEO</td>
113+
<td>IVA</td>
114+
<td>COMISIONES COBRADAS A GOTEO</td>
115+
<td>IVA</td>
116+
</tr>
117+
<?php foreach ($reportData as $key => $value): ?>
118+
<tr>
119+
<td><?= $key ?></td>
120+
<td><?= $value['base'] ?></td>
121+
<td><?= $value['project_fee'] ?></td>
122+
<td><?= $value['project_vat'] ?></td>
123+
<td><?= $value['gateway_fee'] ?></td>
124+
<td><?= $value['gateway_vat'] ?></td>
125+
</tr>
126+
<?php endforeach; ?>
127+
</table>

0 commit comments

Comments
 (0)