Skip to content

Commit

Permalink
Feat/new faqs (#626)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people authored Nov 18, 2024
1 parent 3f1625c commit 32ddac6
Show file tree
Hide file tree
Showing 107 changed files with 4,054 additions and 361 deletions.
6 changes: 5 additions & 1 deletion Resources/permissions.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# Full list of Permissions in Goteo
#
# Some permission require to check if the user and the model.id is present in
# Some permission require checking if the user and the model.id is present in
# a table.
#
# Example:
Expand Down Expand Up @@ -252,6 +252,10 @@ admin-module-communication: # Can access to module CommunicationAdminController
model: null
relational: null

admin-module-faqs: # Can access to module FaqAdminController
model: null
relational: null

receive-test-communications: # Can receive test communications
model: null
relational: null
Expand Down
8 changes: 8 additions & 0 deletions Resources/roles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ stats:
- admin-module-stats # Can access to stats
level: 40

helper:
extends: user
perms:
- admin-module-users
- admin-module-account
level: 40

manager:
extends: user
perms:
Expand All @@ -81,6 +88,7 @@ manager:
- edit-published-calls # Edit any published call
- admin-module-blog # create/edit/delete non-project posts
- admin-module-stories # create/edit/delete non-project posts
- admin-module-faqs # create/edit/delete faqs
- full-html-edit # Affects if the user is allowed dangerous tags (iframe,...) in posts
- admin-module-stats # Can access to stats
level: 50
Expand Down
1 change: 1 addition & 0 deletions Resources/templates/default/about/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<div class="field">
<label for="email"><?= $this->text('contact-email-field') ?></label><br />
<input class="short" type="text" id="email" name="email" value="<?= $this->data['email'] ?>"/>
<?= $this->insert($this->honeypot->template, $this->honeypot->params) ?>
</div>
</td>
</tr>
Expand Down
9 changes: 8 additions & 1 deletion Resources/templates/default/admin/projects/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

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

<?= Goteo\Core\View::get('project/report.html.php', array('project' => $this->project, 'account' => $this->account, 'Data' => $this->data, 'admin'=>true)) ?>
<?= Goteo\Core\View::get('project/report.html.php', [
'project' => $this->project,
'account' => $this->account,
'contract' => $this->contract,
'invests' => $this->invests,
'Data' => $this->data,
'admin' => true
]) ?>

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

9 changes: 9 additions & 0 deletions Resources/templates/default/partials/form/honeypot.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
$style_hidden = "width: 0px; height: 0px; margin: 0px; padding: 0px; border: 0px; opacity: 0; display: block;"
?>

<label for="<?= $this->trap ?>" style="<?= $style_hidden ?>">
<?= $this->text('contact-email-field') ?>
</label>
<br style="<?= $style_hidden ?>" />
<input id="<?= $this->trap ?>" name="<?= $this->trap ?>" value="" type="text" class="short" style="<?= $style_hidden ?>" />
127 changes: 127 additions & 0 deletions Resources/templates/legacy/project/invests_table.html.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?php
$project = $vars['projects'];

$account = $vars['account'];
if (!$account->vat) {
$account->vat = 21;
}

$projectFee = round($account->fee / 100, 2);

function countTotal($invests, $method)
{
$count = 0;

foreach ($invests as $invest) {
if ($invest->status < 1) continue;
if ($invest->method !== $method) continue;

$total = $count + 1;
}

return $total;
}

function calcTotal($invests, $method)
{
$total = 0;

foreach ($invests as $invest) {
if ($invest->status < 1) continue;
if ($invest->method !== $method) continue;

$total = $total + $invest->amount;
}

return $total;
}

$tpvTotal = calcTotal($vars['invests'], 'tpv');
$tpvProjectFee = $tpvTotal * $projectFee;
$tpvProjectVat = $tpvProjectFee * 0.21;
$tpvGatewayFee = $tpvTotal * 0.008;
$tpvGatewayVat = 0;

$paypalTotal = calcTotal($vars['invests'], 'paypal');
$paypalProjectFee = $paypalTotal * $projectFee;
$paypalProjectVat = $paypalProjectFee * 0.21;
$paypalGatewayFee = ($paypalTotal * 0.034) + (countTotal($vars['invests'], 'paypal') * 0.35);
$paypalGatewayVat = 0;

$poolTotal = calcTotal($vars['invests'], 'pool');
$poolProjectFee = $poolTotal * $projectFee;
$poolProjectVat = $poolProjectFee * 0.21;
$poolGatewayFee = $poolTotal * 0.02;
$poolGatewayVat = $poolGatewayFee * 0.21;

$cashTotal = calcTotal($vars['invests'], 'cash');
$cashProjectFee = $cashTotal * $projectFee;
$cashProjectVat = $cashProjectFee * 0.21;
$cashGatewayFee = $cashTotal * 0.02;
$cashGatewayVat = $cashGatewayFee * 0.21;

$totalTotal = $cashTotal + $poolTotal + $paypalTotal + $tpvTotal;
$totalProjectFee = $cashProjectFee + $poolProjectFee + $paypalProjectFee + $tpvProjectFee;
$totalProjectVat = $cashProjectVat + $poolProjectVat + $paypalProjectVat + $tpvProjectVat;
$totalGatewayFee = $cashGatewayFee + $poolGatewayFee + $paypalGatewayFee + $tpvGatewayFee;
$totalGatewayVat = $cashGatewayVat + $poolGatewayVat + $paypalGatewayVat + $tpvGatewayVat;

$reportData = [
'TPV' => [
'base' => \amount_format($tpvTotal, 2),
'project_fee' => sprintf("%s (%s%%)", \amount_format($tpvProjectFee, 2), $account->fee,),
'project_vat' => sprintf("%s (21%%)", \amount_format($tpvProjectVat, 2),),
'gateway_fee' => sprintf("%s (0,8%%)", \amount_format($tpvGatewayFee, 2)),
'gateway_vat' => sprintf("%s (21%%)", \amount_format($tpvGatewayVat, 2))
],
'PAYPAL' => [
'base' => \amount_format($paypalTotal, 2),
'project_fee' => sprintf("%s (%s%%)", \amount_format($paypalProjectFee, 2), $account->fee),
'project_vat' => sprintf("%s (21%%)", \amount_format($paypalProjectVat, 2)),
'gateway_fee' => sprintf("%s (3,4%% + 0,35 * trxs)", \amount_format($paypalGatewayFee, 2)),
'gateway_vat' => sprintf("%s (21%%)", \amount_format($paypalGatewayVat, 2))
],
'MONEDERO' => [
'base' => \amount_format($poolTotal, 2),
'project_fee' => sprintf("%s (%s%%)", \amount_format($poolProjectFee, 2), $account->fee),
'project_vat' => sprintf("%s (21%%)", \amount_format($poolProjectVat, 2)),
'gateway_fee' => sprintf("%s (2%%)", \amount_format($poolGatewayFee, 2)),
'gateway_vat' => sprintf("%s (21%%)", \amount_format($poolGatewayVat, 2))
],
'MANUAL' => [
'base' => \amount_format($cashTotal, 2),
'project_fee' => sprintf("%s (%s%%)", \amount_format($cashProjectFee, 2), $account->fee),
'project_vat' => sprintf("%s (21%%)", \amount_format($cashProjectVat, 2)),
'gateway_fee' => sprintf("%s (2%%)", \amount_format($cashGatewayFee, 2)),
'gateway_vat' => sprintf("%s (21%%)", \amount_format($cashGatewayVat, 2)),
],
'TOTAL' => [
'base' => \amount_format($totalTotal, 2),
'project_fee' => sprintf("%s", \amount_format($totalProjectFee, 2)),
'project_vat' => sprintf("%s", \amount_format($totalProjectVat, 2)),
'gateway_fee' => sprintf("%s", \amount_format($totalGatewayFee, 2)),
'gateway_vat' => sprintf("%s", \amount_format($totalGatewayVat, 2))
]
];

?>
<table>
<tr>
<td></td>
<td>RECAUDACIÓN</td>
<td>COMISIÓN DE GOTEO</td>
<td>IVA</td>
<td>COMISIONES COBRADAS A GOTEO</td>
<td>IVA</td>
</tr>
<?php foreach ($reportData as $key => $value): ?>
<tr>
<td><?= $key ?></td>
<td><?= $value['base'] ?></td>
<td><?= $value['project_fee'] ?></td>
<td><?= $value['project_vat'] ?></td>
<td><?= $value['gateway_fee'] ?></td>
<td><?= $value['gateway_vat'] ?></td>
</tr>
<?php endforeach; ?>
</table>
Loading

0 comments on commit 32ddac6

Please sign in to comment.