From d13b8d0033bf046ada5bf7d7628dd438d4ed1177 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 26 Jan 2022 12:05:16 +0100 Subject: [PATCH 1/5] =?UTF-8?q?change=20standard=20text=20f=C3=BCr=20crati?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/locales/de.json | 2 +- admin/src/locales/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index b1a008eaf..0fc73f178 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -3,7 +3,7 @@ "bookmark": "bookmark", "confirmed": "bestätigt", "creation_form": { - "creation_for": "Schöpfung für", + "creation_for": "Aktives Grundeinkommen für ", "enter_text": "Text eintragen", "form": "Schöpfungsformular", "min_characters": "Mindestens 10 Zeichen eingeben", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index 2d2df4461..569b544eb 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -3,7 +3,7 @@ "bookmark": "Remember", "confirmed": "confirmed", "creation_form": { - "creation_for": "Creation for", + "creation_for": "Active Basic Income for", "enter_text": "Enter text", "form": "Creation form", "min_characters": "Enter at least 10 characters", From ee4f2a8d62aba88d53260a9a92d2469db8b80864 Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Wed, 26 Jan 2022 15:50:50 +0100 Subject: [PATCH 2/5] Update admin/src/locales/de.json Co-authored-by: Hannes Heine --- admin/src/locales/de.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 0fc73f178..d71b6cb25 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -3,7 +3,7 @@ "bookmark": "bookmark", "confirmed": "bestätigt", "creation_form": { - "creation_for": "Aktives Grundeinkommen für ", + "creation_for": "Aktives Grundeinkommen für", "enter_text": "Text eintragen", "form": "Schöpfungsformular", "min_characters": "Mindestens 10 Zeichen eingeben", From f3078b3cbd5c75c939b53da3a24b9c1fd9271a62 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 27 Jan 2022 21:29:18 +0100 Subject: [PATCH 3/5] use url encode bodyparser --- backend/src/server/createServer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/server/createServer.ts b/backend/src/server/createServer.ts index 916a07e54..1912d0b9e 100644 --- a/backend/src/server/createServer.ts +++ b/backend/src/server/createServer.ts @@ -55,8 +55,8 @@ const createServer = async (context: any = serverContext): Promise => { // bodyparser json app.use(express.json()) - // bodyparser text for elopage - app.use(express.text()) + // bodyparser urlencoded for elopage + app.use(express.urlencoded({ extended: true })) // Log every request /* From 65bc3479fa169920eff57b5a2fa662a4090d7364 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 27 Jan 2022 21:29:53 +0100 Subject: [PATCH 4/5] rewrote elopage hook to handle actual elopage hook --- backend/src/webhook/elopage.ts | 93 +++++++++++++--------------------- 1 file changed, 34 insertions(+), 59 deletions(-) diff --git a/backend/src/webhook/elopage.ts b/backend/src/webhook/elopage.ts index 9c5ba2aa7..4485a02b5 100644 --- a/backend/src/webhook/elopage.ts +++ b/backend/src/webhook/elopage.ts @@ -39,65 +39,40 @@ export const elopageWebhook = async (req: any, res: any): Promise => { res.status(200).end() // Responding is important const loginElopageBuyRepository = await getCustomRepository(LoginElopageBuysRepository) const loginElopageBuy = new LoginElopageBuys() - let firstName = '' - let lastName = '' - const entries = req.body.split('&') - entries.forEach((entry: string) => { - const keyVal = entry.split('=') - if (keyVal.length > 2) { - throw new Error(`Error parsing entry '${entry}'`) - } - const key = keyVal[0] - const val = decodeURIComponent(keyVal[1]).replace('+', ' ').trim() - switch (key) { - case 'product[affiliate_program_id]': - loginElopageBuy.affiliateProgramId = parseInt(val) - break - case 'publisher[id]': - loginElopageBuy.publisherId = parseInt(val) - break - case 'order_id': - loginElopageBuy.orderId = parseInt(val) - break - case 'product_id': - loginElopageBuy.productId = parseInt(val) - break - case 'product[price]': - // TODO: WHAT THE ACTUAL FUK? Please save this as float in the future directly in the database - loginElopageBuy.productPrice = Math.trunc(parseFloat(val) * 100) - break - case 'payer[email]': - loginElopageBuy.payerEmail = val - break - case 'publisher[email]': - loginElopageBuy.publisherEmail = val - break - case 'payment_state': - loginElopageBuy.payed = val === 'paid' - break - case 'success_date': - loginElopageBuy.successDate = new Date(val) - break - case 'event': - loginElopageBuy.event = val - break - case 'membership[id]': - // TODO this was never set on login_server - its unclear if this is the correct value - loginElopageBuy.elopageUserId = parseInt(val) - break - case 'payer[first_name]': - firstName = val - break - case 'payer[last_name]': - lastName = val - break - default: - // this is too spammy - // eslint-disable-next-line no-console - // console.log(`Unknown Elopage Value '${entry}'`) - break - } - }) + + const { + payer, + product, + publisher, + // eslint-disable-next-line camelcase + order_id, + // eslint-disable-next-line camelcase + product_id, + // eslint-disable-next-line camelcase + payment_state, + // eslint-disable-next-line camelcase + success_date, + event, + membership, + } = req.body + + loginElopageBuy.affiliateProgramId = parseInt(product.affiliate_program_id) + loginElopageBuy.publisherId = parseInt(publisher.id) + loginElopageBuy.orderId = parseInt(order_id) + loginElopageBuy.productId = parseInt(product_id) + // TODO: WHAT THE ACTUAL FUK? Please save this as float in the future directly in the database + loginElopageBuy.productPrice = Math.trunc(parseFloat(product.price) * 100) + loginElopageBuy.payerEmail = payer.email + loginElopageBuy.publisherEmail = publisher.email + // eslint-disable-next-line camelcase + loginElopageBuy.payed = payment_state === 'paid' + loginElopageBuy.successDate = new Date(success_date) + loginElopageBuy.event = event + // TODO this was never set on login_server - its unclear if this is the correct value + loginElopageBuy.elopageUserId = parseInt(membership.id) + + const firstName = payer.first_name + const lastName = payer.last_name // Do not process certain events if (['lesson.viewed', 'lesson.completed', 'lesson.commented'].includes(loginElopageBuy.event)) { From 87e0f056ef7259de6de22170d781c706a83152e4 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 27 Jan 2022 21:39:46 +0100 Subject: [PATCH 5/5] v1.6.1 --- CHANGELOG.md | 11 +++++++++++ admin/package.json | 2 +- backend/package.json | 2 +- database/package.json | 2 +- frontend/package.json | 2 +- package.json | 2 +- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f9487b4c..1872fabc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.6.1](https://github.com/gradido/gradido/compare/1.6.0...1.6.1) + +- Check if user email is activated to make a creation. [`#1356`](https://github.com/gradido/gradido/pull/1356) +- fix: Creation Confirmation User Ids [`#1345`](https://github.com/gradido/gradido/pull/1345) +- fix and improve test [`1c833d3`](https://github.com/gradido/gradido/commit/1c833d394f502a7aed2b5a648c0171a2fe4ee1e6) +- rewrote elopage hook to handle actual elopage hook [`65bc347`](https://github.com/gradido/gradido/commit/65bc3479fa169920eff57b5a2fa662a4090d7364) +- simple test for mass creation, improved test for single creation [`ffc4727`](https://github.com/gradido/gradido/commit/ffc4727e7a7105ac5dc97515b901be8dbe415627) + #### [1.6.0](https://github.com/gradido/gradido/compare/1.5.1...1.6.0) +> 27 January 2022 + +- v1.6.0 [`#1357`](https://github.com/gradido/gradido/pull/1357) - fix updatePendingCreation method [`#1346`](https://github.com/gradido/gradido/pull/1346) - klicktipp_config [`#1348`](https://github.com/gradido/gradido/pull/1348) - 1351 form to create incorrect due to change of bootstrap version [`#1352`](https://github.com/gradido/gradido/pull/1352) diff --git a/admin/package.json b/admin/package.json index 362c35fc7..e38d21af8 100644 --- a/admin/package.json +++ b/admin/package.json @@ -3,7 +3,7 @@ "description": "Administraion Interface for Gradido", "main": "index.js", "author": "Moriz Wahl", - "version": "1.6.0", + "version": "1.6.1", "license": "MIT", "private": false, "scripts": { diff --git a/backend/package.json b/backend/package.json index 049e921d8..a019b106a 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "gradido-backend", - "version": "1.6.0", + "version": "1.6.1", "description": "Gradido unified backend providing an API-Service for Gradido Transactions", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/backend", diff --git a/database/package.json b/database/package.json index b30f7699c..72ee807b9 100644 --- a/database/package.json +++ b/database/package.json @@ -1,6 +1,6 @@ { "name": "gradido-database", - "version": "1.6.0", + "version": "1.6.1", "description": "Gradido Database Tool to execute database migrations", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/database", diff --git a/frontend/package.json b/frontend/package.json index b78804c09..9677d73c9 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap-vue-gradido-wallet", - "version": "1.6.0", + "version": "1.6.1", "private": true, "scripts": { "start": "node run/server.js", diff --git a/package.json b/package.json index ee27b858b..1701fef64 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gradido", - "version": "1.6.0", + "version": "1.6.1", "description": "Gradido", "main": "index.js", "repository": "git@github.com:gradido/gradido.git",