Merge branch 'master' into 1319-email-optin

This commit is contained in:
Alexander Friedland 2022-01-28 00:32:52 +01:00 committed by GitHub
commit 0340bf1305
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 54 additions and 68 deletions

View File

@ -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)

View File

@ -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": {

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -55,8 +55,8 @@ const createServer = async (context: any = serverContext): Promise<any> => {
// 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
/*

View File

@ -39,65 +39,40 @@ export const elopageWebhook = async (req: any, res: any): Promise<void> => {
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)) {

View File

@ -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",

View File

@ -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",

View File

@ -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",