diff --git a/community_server/src/Controller/AppRequestsController.php b/community_server/src/Controller/AppRequestsController.php index 12dd8aa6e..136b75080 100644 --- a/community_server/src/Controller/AppRequestsController.php +++ b/community_server/src/Controller/AppRequestsController.php @@ -25,7 +25,10 @@ class AppRequestsController extends AppController $this->loadComponent('GradidoNumber'); //$this->loadComponent('JsonRpcRequestClient'); //$this->Auth->allow(['add', 'edit']); - $this->Auth->allow(['index', 'sendCoins', 'createCoins', 'getBalance', 'listTransactions', 'getDecayStartBlock']); + $this->Auth->allow([ + 'index', 'sendCoins', 'createCoins', 'getBalance', + 'listTransactions','listGDTTransactions', 'getDecayStartBlock' + ]); } @@ -271,8 +274,6 @@ class AppRequestsController extends AppController public function getBalance($session_id = 0) { $this->viewBuilder()->setLayout('ajax'); - $this->response = $this->response->withType('application/json'); - $login_result = $this->requestLogin($session_id, false); if($login_result !== true) { $this->set('body', $login_result); @@ -303,16 +304,12 @@ class AppRequestsController extends AppController } $body['decay_date'] = $now; - $this->addAdminError("AppRequests", "getBalance", $body, $user['id']); $this->set('body', $body); } public function listTransactions($page = 1, $count = 25, $orderDirection = 'ASC', $session_id = 0) { - $this->viewBuilder()->setLayout('ajax'); - $this->response = $this->response->withType('application/json'); - $startTime = microtime(true); $login_result = $this->requestLogin($session_id, false); @@ -409,6 +406,49 @@ class AppRequestsController extends AppController $this->set('body', $body); } + public function listGDTTransactions($page = 1, $count = 25, $orderDirection = 'ASC', $session_id = 0) + { + $timeBegin = microtime(true); + $gdtSum = 0; + $gdtCount = -1; + $this->viewBuilder()->setLayout('ajax'); + + $login_result = $this->requestLogin($session_id, false); + + if($login_result !== true) { + return $this->returnJson($login_result); + } + $session = $this->getRequest()->getSession(); + $user = $session->read('StateUser'); + + if(!$user) { + return $this->returnJson(['state' => 'error', 'msg' => 'user not found', 'details' => 'exist a valid session cookie?']); + } + + $gdtEntries = $this->JsonRequestClient->sendRequestGDT([ + 'email' => $user['email'], + 'page' => $page, + 'count' => $count, + 'orderDirection' => $orderDirection + ], 'GdtEntries' . DS . 'listPerEmailApi'); + + $transactions = []; + $result = ['state' => 'success']; + if('success' == $gdtEntries['state']) { + $timeEnd = microtime(true); + $gdtEntries['data']['timeUsed'] = $timeEnd - $timeBegin; + return $this->returnJson($gdtEntries['data']); + + } else { + if($user) { + $this->addAdminError('StateBalancesController', 'ajaxGdtOverview', $gdtEntries, $user['id']); + } else { + $this->addAdminError('StateBalancesController', 'ajaxGdtOverview', $gdtEntries, 0); + } + } + return $this->returnJson(['state' => 'error', 'msg' => 'error by requesting gdt server', 'details' => $gdtEntries]); + } + public function getDecayStartBlock() { $transactionsTable = TableRegistry::getTableLocator()->get('Transactions'); diff --git a/community_server/src/Controller/StateBalancesController.php b/community_server/src/Controller/StateBalancesController.php index 5dcc14f02..f150be489 100644 --- a/community_server/src/Controller/StateBalancesController.php +++ b/community_server/src/Controller/StateBalancesController.php @@ -65,36 +65,14 @@ class StateBalancesController extends AppController if($update_balance_result['success'] !== true) { $this->addAdminError('StateBalances', 'overview', $update_balance_result, $user['id']); } - - // sendRequestGDT - // listPerEmailApi - - $gdtSum = 0; - //if('admin' === $user['role']) { - $gdtEntries = $this->JsonRequestClient->sendRequestGDT(['email' => $user['email']], 'GdtEntries' . DS . 'sumPerEmailApi'); - //var_dump($gdtEntries); - if('success' == $gdtEntries['state'] && 'success' == $gdtEntries['data']['state']) { - $gdtSum = intval($gdtEntries['data']['sum']); - } else { - if($user) { - $this->addAdminError('StateBalancesController', 'overview', $gdtEntries, $user['id']); - } else { - $this->addAdminError('StateBalancesController', 'overview', $gdtEntries, 0); - } - } - //} - // - // + $stateBalancesTable = TableRegistry::getTableLocator()->get('StateBalances'); $stateUserTransactionsTable = TableRegistry::getTableLocator()->get('StateUserTransactions'); - $transactionsTable = TableRegistry::getTableLocator()->get('Transactions'); - + $transactionsTable = TableRegistry::getTableLocator()->get('Transactions'); $stateBalancesTable->updateBalances($user['id']); - $gdtSum = 0; $gdtEntries = $this->JsonRequestClient->sendRequestGDT(['email' => $user['email']], 'GdtEntries' . DS . 'sumPerEmailApi'); - if('success' == $gdtEntries['state'] && 'success' == $gdtEntries['data']['state']) { $gdtSum = intval($gdtEntries['data']['sum']); } else { diff --git a/configs/community_server/app.php b/configs/community_server/app.php index 5acd4ce51..d56a43cc0 100644 --- a/configs/community_server/app.php +++ b/configs/community_server/app.php @@ -419,7 +419,7 @@ return [ 'GroupAlias' => 'docker', 'GDTServer' => [ - //'host' => 'gdt' + 'host' => 'https://gdt.gradido.net' // staging ], 'API' => [ 'allowedCaller' => ['login-server'] diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 8a0295d61..0962f9bd2 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -71,6 +71,7 @@ services: - mariadb networks: - internal-net + - external-net volumes: - ./community_server/config/php-fpm/php-ini-overrides.ini:/etc/php/7.4/fpm/conf.d/99-overrides.ini - ./community_server/src:/var/www/cakephp/src diff --git a/docu/community-server.api.md b/docu/community-server.api.md index 64127dd81..5bdb468bb 100644 --- a/docu/community-server.api.md +++ b/docu/community-server.api.md @@ -125,6 +125,106 @@ Transaction: - `creation_amount`: only for creation transaction, created account before decay - `target_date`: only by creation transaction, target date for creation, start time for decay calculation (if < as global decay start time) +## List GDT Transactions +`GET http://localhost/api/listGDTTransactions/[1]/[25]/[DESC]/[session_id]` +Parts symbolized by [] are optional + - first parameter (1) is page for paging + - second parameter (25) is count for paging + - third parameter is ordering of resulting array, default is ASC + - fourth parameter is session_id (session will be searched in php session and GRADIDO_LOGIN cookie and if not found use this ) + +#### Paging +With count you say how many entrys you like to have in the result. +With page you say on which page you are. +For example 50 transactions are in db. +With 1/25 you get the first 25 transactions (1-25) +With 2/20 you get the second 20 transactions (21-40) + +### Response +Assuming session was valid and gdt server was setup correct +{ + "state": "success", + "count": 4, + "gdtEntries": [ + { + "id": 1, + "amount": 99, + "date": "2020-01-01T13:47:12+00:00", + "email": "dariofrodo@gmx.de", + "comment": "", + "coupon_code": null, + "gdt_entry_type_id": 1, + "factor": 18, + "amount2": 0, + "factor2": 1, + "gdt": 1782 + }, + { + "id": 10, + "amount": 100.12, + "date": "2021-07-28T13:58:00+00:00", + "email": "tester2@gmail.com", + "comment": null, + "coupon_code": "", + "gdt_entry_type_id": 4, + "factor": 15, + "amount2": 0, + "factor2": 0.05, + "gdt": 75.09000000000002 + }, + { + "id": 6, + "amount": 1782, + "date": "2021-07-30T13:21:46+00:00", + "email": "dariofrodo@gmx.de", + "comment": "Event 20-20", + "coupon_code": null, + "gdt_entry_type_id": 7, + "factor": 0.2, + "amount2": 0, + "factor2": 1, + "gdt": 356.40000000000006 + }, + { + "id": 8, + "amount": 10, + "date": "2021-07-31T13:58:00+00:00", + "email": "tester1@gmail.com", + "comment": null, + "coupon_code": "", + "gdt_entry_type_id": 4, + "factor": 15, + "amount2": 0, + "factor2": 0.05, + "gdt": 7.5 + } + ], + "gdtSum": 2220.99, + "timeUsed": 0.012517929077148438 +} + +- `count`: Count of total gdt transactions for user +- `gdtEntries`: array with gdt entries, sort by date + - `amount`: amount of payed money in euro, expect by gdt_entry_type_id = 7, then it is GDT Sum for Global Modificator time span + - `date`: date of transaction with let create gdt transaction, date for picking factor and Global Modificator + - `email`: email of user which has payed money, for gdt_entry_type_id = 4 it is the email of user who was recruited + - `comment`: custom comment or Global Modificator name if gdt_entry_type_id = 7 + - `gdt_entry_type_id`: type of gdt entry + (1) Form: Single GDT Entry directly created by admin via formular + (2) CVS: Created by importing a CVS-List with multiple GDT Entries + (3) Elopage: Automatic created by Elopage Transaction (with revenue > 0 and payment state success) + (4) Elopage Publisher: Automatic created by Elopage Transaction (with revenue > 0 and payment state success) for publisher + (5) Digistore: Automatic created by Digistore Transaction + (6) CVS2: Created by importing a CVS-List with multiple GDT Entries, other format (used by Bernds old Accounting Tool) + (7) Global Modificator: Global Modificator which grand percental bonus on GDT in possession in event time span + - `factor`: Mulitplication factor for calculating gdt, change(d) over time + - `amount2`: Bonus add amount for gdt, sparly used + - `factor2`: Bonus mulitplication factor used by elopage publisher entry + - `gdt`: GDT Value, calculatedt from other value: gdt = amount * factor * factor2 + amount2 +- `gdtSum`: Total GDT Sum of user +- `timeUsed`: GDT Server isn't optimized, this is for easy checking if it is still fast enough + + ## Creation transaction Makes a creation transaction to create new Gradido diff --git a/frontend/README.md b/frontend/README.md index d94034c15..e9ac0b097 100755 --- a/frontend/README.md +++ b/frontend/README.md @@ -342,7 +342,7 @@ Ein GDT Eintrag sieht so aus: ``` { "id": 8857, - "amount": 1000, // = 10,00 Euro + "amount": 1000, // GDT "date": "2020-06-17T14:12:00+00:00", "email": "foerderkreis-1@gradido.org", "comment": null, @@ -379,8 +379,10 @@ Bis zum 5. (Bernd ist 2.) Diese Beziehung wird durch die connectEntries dargestellt. Insbesondere durch den publishersPath, connect enthält einfach nur alle mögliche Daten. + # TODO TODO: Update GDT-Server um paging und Zugriff auf alle Einträge zu erhalten, optimierter Zugriff GET https://staging.gradido.net/state-balances/ajaxGdtTransactions Liefert wenn alles in Ordnung ist: +wenn nicht type 7 dann "amount" in euro ansonsten in GDT \ No newline at end of file diff --git a/frontend/public/img/icons/cards/bitcoin.png b/frontend/public/img/icons/cards/bitcoin.png deleted file mode 100755 index 9a4b04319..000000000 Binary files a/frontend/public/img/icons/cards/bitcoin.png and /dev/null differ diff --git a/frontend/public/img/icons/cards/mastercard.png b/frontend/public/img/icons/cards/mastercard.png deleted file mode 100755 index 8287feca9..000000000 Binary files a/frontend/public/img/icons/cards/mastercard.png and /dev/null differ diff --git a/frontend/public/img/icons/cards/paypal.png b/frontend/public/img/icons/cards/paypal.png deleted file mode 100755 index f8e460db1..000000000 Binary files a/frontend/public/img/icons/cards/paypal.png and /dev/null differ diff --git a/frontend/public/img/icons/cards/visa.png b/frontend/public/img/icons/cards/visa.png deleted file mode 100755 index 596545fc8..000000000 Binary files a/frontend/public/img/icons/cards/visa.png and /dev/null differ diff --git a/frontend/public/img/icons/common/github.svg b/frontend/public/img/icons/common/github.svg deleted file mode 100644 index 2227d5e0f..000000000 --- a/frontend/public/img/icons/common/github.svg +++ /dev/null @@ -1,12 +0,0 @@ - - \ No newline at end of file diff --git a/frontend/public/img/icons/common/google.svg b/frontend/public/img/icons/common/google.svg deleted file mode 100644 index 999a208c3..000000000 --- a/frontend/public/img/icons/common/google.svg +++ /dev/null @@ -1,17 +0,0 @@ - - \ No newline at end of file diff --git a/frontend/public/img/icons/flags/DE.png b/frontend/public/img/icons/flags/DE.png deleted file mode 100755 index 62798f3ef..000000000 Binary files a/frontend/public/img/icons/flags/DE.png and /dev/null differ diff --git a/frontend/public/img/icons/flags/GB.png b/frontend/public/img/icons/flags/GB.png deleted file mode 100755 index f5a50357e..000000000 Binary files a/frontend/public/img/icons/flags/GB.png and /dev/null differ diff --git a/frontend/public/img/icons/flags/US.png b/frontend/public/img/icons/flags/US.png deleted file mode 100755 index f0672464a..000000000 Binary files a/frontend/public/img/icons/flags/US.png and /dev/null differ diff --git a/frontend/public/img/icons/icons-translation.png b/frontend/public/img/icons/icons-translation.png deleted file mode 100644 index 3f06d0690..000000000 Binary files a/frontend/public/img/icons/icons-translation.png and /dev/null differ diff --git a/frontend/public/img/theme/angular.jpg b/frontend/public/img/theme/angular.jpg deleted file mode 100755 index d971d0c57..000000000 Binary files a/frontend/public/img/theme/angular.jpg and /dev/null differ diff --git a/frontend/public/img/theme/bootstrap.jpg b/frontend/public/img/theme/bootstrap.jpg deleted file mode 100755 index 775174f5b..000000000 Binary files a/frontend/public/img/theme/bootstrap.jpg and /dev/null differ diff --git a/frontend/public/img/theme/img-1-1000x600.jpg b/frontend/public/img/theme/img-1-1000x600.jpg deleted file mode 100755 index 8459a8bfb..000000000 Binary files a/frontend/public/img/theme/img-1-1000x600.jpg and /dev/null differ diff --git a/frontend/public/img/theme/img-1-1000x900.jpg b/frontend/public/img/theme/img-1-1000x900.jpg deleted file mode 100755 index 5c7086b1f..000000000 Binary files a/frontend/public/img/theme/img-1-1000x900.jpg and /dev/null differ diff --git a/frontend/public/img/theme/landing-1.png b/frontend/public/img/theme/landing-1.png deleted file mode 100755 index 9f653a444..000000000 Binary files a/frontend/public/img/theme/landing-1.png and /dev/null differ diff --git a/frontend/public/img/theme/landing-2.png b/frontend/public/img/theme/landing-2.png deleted file mode 100755 index 8663005dc..000000000 Binary files a/frontend/public/img/theme/landing-2.png and /dev/null differ diff --git a/frontend/public/img/theme/landing-3.png b/frontend/public/img/theme/landing-3.png deleted file mode 100755 index 6e901e1c8..000000000 Binary files a/frontend/public/img/theme/landing-3.png and /dev/null differ diff --git a/frontend/public/img/theme/profile-cover.jpg b/frontend/public/img/theme/profile-cover.jpg deleted file mode 100755 index bf4aa79f8..000000000 Binary files a/frontend/public/img/theme/profile-cover.jpg and /dev/null differ diff --git a/frontend/public/img/theme/react.jpg b/frontend/public/img/theme/react.jpg deleted file mode 100755 index 3c76e20c6..000000000 Binary files a/frontend/public/img/theme/react.jpg and /dev/null differ diff --git a/frontend/public/img/theme/sketch.jpg b/frontend/public/img/theme/sketch.jpg deleted file mode 100755 index 3569f2678..000000000 Binary files a/frontend/public/img/theme/sketch.jpg and /dev/null differ diff --git a/frontend/public/img/theme/team-1.jpg b/frontend/public/img/theme/team-1.jpg deleted file mode 100755 index 38efdd58c..000000000 Binary files a/frontend/public/img/theme/team-1.jpg and /dev/null differ diff --git a/frontend/public/img/theme/team-2.jpg b/frontend/public/img/theme/team-2.jpg deleted file mode 100755 index ba5dbc6ce..000000000 Binary files a/frontend/public/img/theme/team-2.jpg and /dev/null differ diff --git a/frontend/public/img/theme/team-3.jpg b/frontend/public/img/theme/team-3.jpg deleted file mode 100755 index 08baf2826..000000000 Binary files a/frontend/public/img/theme/team-3.jpg and /dev/null differ diff --git a/frontend/public/img/theme/team-4.jpg b/frontend/public/img/theme/team-4.jpg deleted file mode 100755 index 849c2407e..000000000 Binary files a/frontend/public/img/theme/team-4.jpg and /dev/null differ diff --git a/frontend/public/img/theme/team-5.jpg b/frontend/public/img/theme/team-5.jpg deleted file mode 100755 index 38efdd58c..000000000 Binary files a/frontend/public/img/theme/team-5.jpg and /dev/null differ diff --git a/frontend/public/img/theme/vue.jpg b/frontend/public/img/theme/vue.jpg deleted file mode 100755 index b8e5ad0bc..000000000 Binary files a/frontend/public/img/theme/vue.jpg and /dev/null differ diff --git a/frontend/src/apis/communityAPI.js b/frontend/src/apis/communityAPI.js index b2df337b8..4f151d3a2 100644 --- a/frontend/src/apis/communityAPI.js +++ b/frontend/src/apis/communityAPI.js @@ -40,8 +40,15 @@ const communityAPI = { `${CONFIG.COMMUNITY_API_URL}listTransactions/${firstPage}/${items}/${order}/${sessionId}`, ) }, - /* create: async (sessionId, email, amount, memo, target_date = new Date() ) => { - const payload = { + transactionsgdt: async (sessionId, firstPage = 1, items = 5, order = 'DESC') => { + return apiGet( + `${CONFIG.COMMUNITY_API_URL}listGDTTransactions/${firstPage}/${items}/${order}/${sessionId}`, + ) + }, + /* http://localhost/vue/public/json-example/admin_transactionGdt_list.json + http://localhost/state-balances/ajaxGdtOverview + create: async (sessionId, email, amount, memo, target_date = new Date() ) => { + const payload = { sessionId, email, amount, diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index daf2bf2e9..e1c56bd90 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -94,7 +94,9 @@ "show_all":"Alle {count} Transaktionen ansehen", "nullTransactions":"Du hast noch keine Transaktionen auf deinem Konto.", "more": "mehr", - "receiverNotFound":"Empfänger nicht gefunden" + "receiverNotFound":"Empfänger nicht gefunden", + "gdd-text":"Gradido Transaktionen", + "gdt-text":"Gradido Transform Transaktionen" }, "site": { "login": { @@ -165,5 +167,13 @@ "title": "Passwort zurücksetzen", "text": "Jetzt kannst du ein neues Passwort speichern, mit dem du dich zukünftig in der Gradido-App anmelden kannst.", "not-authenticated": "Leider konnten wir dich nicht authentifizieren. Bitte wende dich an den Support." + }, + "gdt": { + "gdt-received":"Gradido Transform (GDT) erhalten", + "factor":"Faktor", + "conversion-gdt-euro":"Umrechnung Euro / Gradido Transform (GDT)", + "calculation":"Berechnung der Gradido Transform", + "conversion":"Umrechnung", + "formula":"Berechungsformel" } } diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 9e574a9ce..dcbb38016 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -94,7 +94,9 @@ "show_all":"View all {count} transactions.", "nullTransactions":"You don't have any transactions on your account yet.", "more": "more", - "receiverNotFound":"Recipient not found" + "receiverNotFound":"Recipient not found", + "gdd-text":"Gradido Transactions", + "gdt-text":"Gradido Transform Transactions" }, "site": { "login": { @@ -166,5 +168,13 @@ "title": "Reset Password", "text": "Now you can save a new password to login to the Gradido-App in the future.", "not-authenticated": "Unfortunately we could not authenticate you. Please contact the support." - } + }, + "gdt": { + "gdt-received": "Gradido Transform (GDT) received", + "factor": "Factor", + "conversion-gdt-euro": "Conversion Euro / Gradido Transform (GDT)", + "calculation": "Calculation of Gradido Transform", + "conversion": "Conversion", + "formula": "Calculation formula" + } } diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index 1bde53e60..5e069aba3 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -49,7 +49,6 @@
{{ $t('transaction.gdd-text') }}
+ +{{ $t('transaction.gdt-text') }}
+ +