Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions routes/participants/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ router.post('/', (req, res) => {
bank: config.get('contact.bank'),
token: result.token,
amount: new Intl.NumberFormat('de-DE', {minimumFractionDigits: '2'}).format(calculator.priceFor(newParticipant)),
free: calculator.priceFor(newParticipant) < 1,
editUrl: editUrlHelper.generateUrl(result.secureid),
startnr: result.startnr
}), err => res.render('failure', {
Expand Down
1 change: 1 addition & 0 deletions service/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ registration.sendConfirmationMail = (participant, paymentToken) => {
token: paymentToken,
bank: config.get('contact.bank'),
amount: calculator.priceFor(participant),
free: calculator.priceFor(participant) < 1,
editUrl: editUrlHelper.generateUrl(participant.secureID),
startnr: participant.start_number
},
Expand Down
47 changes: 45 additions & 2 deletions spec/registrationJourney.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
const helper = require('./journeyHelper');
const config = require('config');
const registration = require('../service/registration');
const couponcodes = require('../service/couponcodes');

describe('registration journey', () => {

Expand Down Expand Up @@ -67,13 +68,55 @@ describe('registration journey', () => {
})
.getText('span.amount')
.then((amount) => {
expect(amount).toMatch(/20.00/);
expect(amount).toMatch(/20.00/); // shirt and full price
})
.getText('span.startNumber')
.then((number) => {
expect(number).toMatch(/d*/);
})
.end(done);
.call(done);
});

it("doesn't display bank details and payment message when valid coupon code is used", (done) => {
couponcodes.create()
.then((code) => {
client.url(helper.paceUrl)
.click('a#registration')
.isVisible('form#registrationForm')
.setValue('input#firstname', 'Max')
.setValue('input#lastname', 'Mustermann')
.setValue('input#email', '[email protected]')
.selectByValue('select#category', 'f')
.setValue('input#birthyear', 2000)
.setValue('input#team', 'Crazy runners')
.selectByIndex('select#visibility', 1)
.selectByIndex('select#goal', 2)
.selectByIndex('select#discount', 2)
.isVisible('input#couponcode')
.then((isVisible) => {
expect(isVisible).toBe(true);
})
.setValue('input#couponcode', code.code)
.click('input#shirt')
.click('button#submit')
.isVisible('div.thanks')
.then((isVisible) => {
expect(isVisible).toBe(true);
})
.isVisible('a#editurl')
.then(function (isVisible) {
expect(isVisible).toBe(true);
})
.getText('span.amount')
.then((amount) => {
expect(amount).toMatch(/10.00/); // only tshirt price
})
.getText('span.startNumber')
.then((number) => {
expect(number).toMatch(/d*/);
})
.call(done);
});
});

it('allows to register without giving too much information', (done) => {
Expand Down
2 changes: 1 addition & 1 deletion views/registration/confirmationText.pug
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
h3 Hey #{name}!
h5 Danke für deine Registrierung.
if amount > 0
if !free
| Bitte überweise den Betrag von&nbsp;
span.amount #{amount}
| Euro auf folgendes Konto:
Expand Down