Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#980 implement subscription feature #981

Closed
wants to merge 150 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
746d644
#980 initial db work
syjer Dec 15, 2020
a2a2923
update schema
syjer Dec 16, 2020
3b12247
update schema, take 2
syjer Dec 16, 2020
70d9b4f
add row level security in new table
syjer Dec 16, 2020
8dd9be8
mapping
syjer Dec 17, 2020
d0400bd
add first piece of repository
syjer Dec 21, 2020
17b06e1
initial work for rest api controller
syjer Dec 21, 2020
77833b9
cleanup acces
syjer Dec 21, 2020
6059bfc
wire up creation too
syjer Dec 21, 2020
e924478
add integration test for create+list, fix some misc issue
syjer Dec 21, 2020
407fcf5
stubs for subscriptions admin
syjer Dec 21, 2020
1fd3f06
rename, add stub for listing subscription
syjer Dec 22, 2020
83283ce
stubs for listing subscriptions
syjer Dec 22, 2020
ed96681
stubs for listing subscriptions
syjer Dec 22, 2020
dad61d6
stubs for listing subscriptions
syjer Dec 22, 2020
0542cb1
add subscription status
syjer Dec 24, 2020
eb9945e
add vat information
cbellone Dec 26, 2020
3ab62f9
fix compilation issue
cbellone Dec 26, 2020
234c1fb
create subscription
cbellone Dec 26, 2020
7ad4cf1
expose public subscriptions
syjer Dec 27, 2020
e3cd41d
switch from bigserial -> uuid for subscription descriptor
syjer Dec 27, 2020
0227298
update subscription model
cbellone Dec 27, 2020
a2bee9c
fix query+add call in test
syjer Dec 28, 2020
b37ce64
update creation form
cbellone Dec 28, 2020
39369b7
fix error
cbellone Dec 28, 2020
d71eda1
fix typo
cbellone Dec 28, 2020
6604a45
expose some additional info in the subscription info
syjer Dec 28, 2020
b66581e
edit subscription
cbellone Dec 28, 2020
f786e95
admin: reload subscription route on navigating
syjer Dec 29, 2020
4304541
add some prop keys
syjer Dec 29, 2020
c15d2f3
expose subscription descriptor
syjer Dec 29, 2020
c8bce45
add view for statistics
cbellone Dec 29, 2020
e2b1221
misc fix
syjer Dec 30, 2020
9539f04
initial work for removing the event from the reservation url
syjer Dec 30, 2020
e37777b
when creating a reservation, set the organization id
syjer Dec 30, 2020
bfba9dc
remove event id not null constraint from reservation
syjer Dec 30, 2020
1073fc1
add TaxDescriptor
syjer Dec 30, 2020
e0a33f3
add LocalizedContent interface
syjer Dec 30, 2020
fd23a28
refactor: more use of taxdescriptor
syjer Dec 30, 2020
cba03a1
rename TaxDescriptor to Purchasable
syjer Dec 31, 2020
ae4f019
Add Configurable abstraction
syjer Dec 31, 2020
bf36821
switch from ConfigurationLevel.event(event) to event.getConfiguration…
syjer Dec 31, 2020
5ddad2b
switch to Configurable
syjer Dec 31, 2020
42ebe5b
switch to Configurable
syjer Dec 31, 2020
5ffa96b
add logo, terms and conditions and privacy policy
cbellone Jan 1, 2021
3a58ef4
consider subscriptions when cleaning up unused files
cbellone Jan 1, 2021
0d40206
subscription list
cbellone Jan 2, 2021
97be749
first stub for subscription/event link
cbellone Jan 2, 2021
37a2f79
subscription payment refactor (#985)
syjer Jan 3, 2021
56ebc94
display linked events
cbellone Jan 3, 2021
49d81d3
link subscription when creating event
cbellone Jan 3, 2021
791e59c
load linked subscriptions when loading event
cbellone Jan 3, 2021
2eca37a
update subscription links
cbellone Jan 4, 2021
a72af4a
continue work
syjer Jan 4, 2021
022d559
make getInfo work for both event and subscription
syjer Jan 4, 2021
58679d5
make getInfo work for both event and subscription
syjer Jan 4, 2021
f60526d
use enum directly as a path param
syjer Jan 4, 2021
c68fdba
add type in reservation
syjer Jan 4, 2021
4dc0cc2
Revert "add type in reservation"
syjer Jan 4, 2021
c7304d8
switch to search by reservation id
syjer Jan 4, 2021
de3d0c5
convert confirm overview api
syjer Jan 4, 2021
d4a80f4
Event -> Purchasable
syjer Jan 4, 2021
82632c7
refactor reservation api -> remove event
syjer Jan 4, 2021
ff3b749
refactor Purchasable->PurchaseContext
syjer Jan 5, 2021
fc6ad9a
remove event from validateToOverview
syjer Jan 5, 2021
43704ed
add first stub for creating a subscription reservation
syjer Jan 8, 2021
6014abe
create a reservation with a subscription
syjer Jan 8, 2021
6f00fbf
fix tset
syjer Jan 8, 2021
e3d3612
temporary code generation
syjer Jan 9, 2021
476d3c7
export subscription descriptor info
syjer Jan 10, 2021
7cbc1aa
handle cleanup with subscriptions
syjer Jan 10, 2021
2ef6bd2
expose info
syjer Jan 12, 2021
d964b4f
handle cancel reservation button in case of subscriptiong
syjer Jan 12, 2021
8ea14ef
save src price
syjer Jan 12, 2021
3b70895
advance
syjer Jan 12, 2021
c124233
fix
syjer Jan 12, 2021
9ce8544
fix
syjer Jan 12, 2021
3baa52b
expose more data
syjer Jan 13, 2021
0820c97
expose more info
syjer Jan 13, 2021
ef24ceb
subscription: go through the acquireitems flow
syjer Jan 14, 2021
0942f8f
expose org email
syjer Jan 17, 2021
aa01b6c
subscription list
cbellone Jan 17, 2021
08ecd54
update config, messages + db
cbellone Jan 19, 2021
399915a
update config, messages + db (take 2)
cbellone Jan 19, 2021
e2ee55b
update subscription layout
cbellone Jan 20, 2021
c4466c3
fix row level security target
syjer Jan 22, 2021
9e434de
on modal does not work
syjer Jan 22, 2021
9de964e
get begin
syjer Jan 25, 2021
94423be
move subscription link at reservation level
syjer Jan 26, 2021
84cfdbe
initial stubs for linking subscription to a reservation
syjer Jan 26, 2021
8a84075
enable image build on feature-subscription branch
cbellone Jan 27, 2021
918f200
update name
cbellone Jan 27, 2021
9005530
stubs
syjer Jan 28, 2021
ae46686
handle reservation cancellation
syjer Jan 29, 2021
93e2f6b
pass applied subscription
syjer Jan 29, 2021
3fde5fa
apply subscription discount of first lower cost ticket
syjer Jan 29, 2021
f934ceb
add summary row for sub
syjer Jan 29, 2021
9e5bccf
add remove subscription
syjer Jan 29, 2021
9bb2a04
prop text
syjer Jan 30, 2021
e0c8b74
fix subscription removal: decrement then cancel
syjer Jan 30, 2021
8d89f19
add message
syjer Jan 30, 2021
c9fd651
add message
syjer Jan 30, 2021
d54e7ea
update frontend version
cbellone Jan 30, 2021
284fc79
initial work for validation
syjer Feb 5, 2021
ba0b5fd
flow
syjer Feb 5, 2021
d096635
remove unused method
syjer Feb 7, 2021
3cefcd5
generalize pin generation
syjer Feb 7, 2021
2a075e9
generalize
syjer Feb 7, 2021
1da213f
generalize
syjer Feb 7, 2021
54ec12f
switch to pin
syjer Feb 8, 2021
ff382cb
add invariant check
syjer Feb 8, 2021
d0e420a
fix subscription creation
syjer Feb 9, 2021
e325935
expose subscription info in reservation info
syjer Feb 9, 2021
5b07972
export validation
syjer Feb 9, 2021
b8fecc6
filter events by subscription id, organizer and tags
cbellone Feb 11, 2021
20801cb
fix reservation summary when a subscription is applied
cbellone Feb 12, 2021
645001f
try to fetch subscription id by only using the partial id first, then…
syjer Feb 12, 2021
af03583
implement acquire subscription logic
syjer Feb 12, 2021
0ab8e27
add allocation status enum
syjer Feb 12, 2021
98cc8c5
validate subscription code
cbellone Feb 12, 2021
ab9ee56
add show-subscription header
cbellone Feb 13, 2021
4fbe79f
more specific error message
syjer Feb 13, 2021
f54e594
initial work on some basic validation
syjer Feb 13, 2021
78a945c
add validation notes
syjer Feb 13, 2021
c7d06f2
remove unused import
syjer Feb 14, 2021
4cf604c
refactor
syjer Feb 14, 2021
afa7c50
remove TODO
syjer Feb 14, 2021
ec6f11d
display linked subscriptions in event header
cbellone Feb 13, 2021
867ec44
update reservation-list to support purchase context
cbellone Feb 14, 2021
65fc98c
update reservation-list to support purchase context
cbellone Feb 14, 2021
ed9f3f5
display reservation list
cbellone Feb 14, 2021
edd9427
filter out past and not active events
cbellone Feb 19, 2021
63c6e58
fix extension engine
cbellone Feb 19, 2021
6fca15d
increase script timeout to 15s, do not JSON-serialize standard objects
cbellone Feb 19, 2021
d434ac4
fix org selector
cbellone Feb 19, 2021
869e30e
reload all data when saving event
cbellone Feb 19, 2021
ec09f82
WIP: refactor admin reservation view
cbellone Feb 19, 2021
2af9d3a
fix reservation redirect
cbellone Feb 20, 2021
10f8aa7
use UUID instead of String for subscription ID
cbellone Feb 20, 2021
34a42dc
load billing documents and auditing
cbellone Feb 20, 2021
adedc13
cancel subscription
cbellone Feb 20, 2021
0e78830
process pending email for subscriptions
cbellone Feb 20, 2021
236367c
update frontend version
cbellone Feb 20, 2021
ca9036e
send email message on confirmation
cbellone Feb 21, 2021
1c497d8
fix send email
cbellone Feb 24, 2021
80f75fb
disable on_site and offline payment methods for subscription
cbellone Feb 24, 2021
9aab2d2
do not duplicate rows when selecting compatible events
cbellone Feb 26, 2021
adad1af
update billing documents, update email messages
cbellone Feb 26, 2021
83c69cc
add pre-generation of subscriptions, add test for subscription applic…
cbellone Feb 28, 2021
42e2944
fix webhook confirmation
cbellone Mar 1, 2021
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
59 changes: 59 additions & 0 deletions .github/workflows/tmp-feature-subscription-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: tmp-feature-subscription-build

on:
push:
branches:
- feature-subscription

jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: alfio
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradlew-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Gradle
run: ./gradlew build distribution jacocoTestReport -Dspring.profiles.active=travis -Ddbenv=PGSQL-TRAVIS -Dpgsql${{ matrix.postgresql }}
- name: Configure Docker
if: ${{ github.repository == 'alfio-event/alf.io' }}
uses: docker/setup-buildx-action@v1
- name: Login to Container Registry
if: ${{ github.repository == 'alfio-event/alf.io' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}
- name: Push Docker image
if: ${{ github.repository == 'alfio-event/alf.io' }}
uses: docker/build-push-action@v2
with:
context: ./build/dockerize
tags: |
ghcr.io/alfio-event/alf.io/dev-feature-subscription:latest
push: true
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ junitVersion=5.1.0
systemProp.jdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2"

# https://jitpack.io/#alfio-event/alf.io-public-frontend -> go to commit tab, set the version
alfioPublicFrontendVersion=0c79c9907e
alfioPublicFrontendVersion=dfe4d8bb47
7 changes: 5 additions & 2 deletions src/main/java/alfio/config/WebSecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,16 @@ protected void configure(HttpSecurity http) throws Exception {
ADMIN_API + "/overridable-template/",
ADMIN_API + "/events/*/promo-code",
ADMIN_API + "/reservation/event/*/reservations/list",
ADMIN_API + "/events/*/email/",
ADMIN_API + "/event/*/email/",
ADMIN_API + "/event/*/waiting-queue/load",
ADMIN_API + "/events/*/pending-payments",
ADMIN_API + "/events/*/export",
ADMIN_API + "/events/*/sponsor-scan/export",
ADMIN_API + "/events/*/invoices/**",
ADMIN_API + "/reservation/event/*/*/audit"
ADMIN_API + "/reservation/*/*/*/audit",
ADMIN_API + "/subscription/*/email/",
ADMIN_API + "/organization/*/subscription/**",
ADMIN_API + "/reservation/subscription/**"
};

configurer.csrfTokenRepository(csrfTokenRepository)
Expand Down
38 changes: 32 additions & 6 deletions src/main/java/alfio/controller/IndexController.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
import alfio.model.TicketReservationStatusAndValidation;
import alfio.model.system.ConfigurationKeys;
import alfio.model.user.Role;
import alfio.repository.EventDescriptionRepository;
import alfio.repository.EventRepository;
import alfio.repository.FileUploadRepository;
import alfio.repository.TicketReservationRepository;
import alfio.repository.*;
import alfio.repository.user.OrganizationRepository;
import alfio.util.Json;
import alfio.util.MustacheCustomTag;
Expand Down Expand Up @@ -105,6 +102,7 @@ public class IndexController {
private final EventDescriptionRepository eventDescriptionRepository;
private final OrganizationRepository organizationRepository;
private final TicketReservationRepository ticketReservationRepository;
private final SubscriptionRepository subscriptionRepository;
private final EventLoader eventLoader;


Expand Down Expand Up @@ -152,6 +150,7 @@ public ResponseEntity<String> replyToK8s() {
*/
@GetMapping({
"/",
"/events-all",
"/event/{eventShortName}",
"/event/{eventShortName}/reservation/{reservationId}/book",
"/event/{eventShortName}/reservation/{reservationId}/overview",
Expand All @@ -165,11 +164,24 @@ public ResponseEntity<String> replyToK8s() {
"/event/{eventShortName}/ticket/{ticketId}/view",
"/event/{eventShortName}/ticket/{ticketId}/update",
//
// subscription
"/subscriptions-all",
"/subscription/{subscriptionId}",
"/subscription/{subscriptionId}/reservation/{reservationId}/book",
"/subscription/{subscriptionId}/reservation/{reservationId}/overview",
"/subscription/{subscriptionId}/reservation/{reservationId}/waitingPayment",
"/subscription/{subscriptionId}/reservation/{reservationId}/waiting-payment",
"/subscription/{subscriptionId}/reservation/{reservationId}/deferred-payment",
"/subscription/{subscriptionId}/reservation/{reservationId}/processing-payment",
"/subscription/{subscriptionId}/reservation/{reservationId}/success",
"/subscription/{subscriptionId}/reservation/{reservationId}/not-found",
"/subscription/{subscriptionId}/reservation/{reservationId}/error",
// poll
"/event/{eventShortName}/poll",
"/event/{eventShortName}/poll/{pollId}"
})
public void replyToIndex(@PathVariable(value = "eventShortName", required = false) String eventShortName,
@PathVariable(value = "subscriptionId", required = false) String subscriptionId,
@RequestHeader(value = "User-Agent", required = false) String userAgent,
@RequestParam(value = "lang", required = false) String lang,
ServletWebRequest request,
Expand Down Expand Up @@ -210,7 +222,7 @@ public void replyToIndex(@PathVariable(value = "eventShortName", required = fals
}

@GetMapping("/event/{eventShortName}/reservation/{reservationId}")
public String redirectToReservation(@PathVariable(value = "eventShortName") String eventShortName, @PathVariable(value = "reservationId") String reservationId) {
public String redirectEventToReservation(@PathVariable(value = "eventShortName") String eventShortName, @PathVariable(value = "reservationId") String reservationId) {
if (eventRepository.existsByShortName(eventShortName)) {
var reservationStatusUrlSegment = ticketReservationRepository.findOptionalStatusAndValidationById(reservationId)
.map(IndexController::reservationStatusToUrlMapping).orElse("not-found");
Expand All @@ -223,6 +235,20 @@ public String redirectToReservation(@PathVariable(value = "eventShortName") Stri
}
}

@GetMapping("/subscription/{subscriptionId}/reservation/{reservationId}")
public String redirectSubscriptionToReservation(@PathVariable("subscriptionId") String subscriptionId, @PathVariable("reservationId") String reservationId) {
if (subscriptionRepository.existsById(UUID.fromString(subscriptionId))) {
var reservationStatusUrlSegment = ticketReservationRepository.findOptionalStatusAndValidationById(reservationId)
.map(IndexController::reservationStatusToUrlMapping).orElse("not-found");

return "redirect:" + UriComponentsBuilder.fromPath("/subscription/{subscriptionId}/reservation/{reservationId}/{status}")
.buildAndExpand(Map.of("subscriptionId", subscriptionId, "reservationId", reservationId, "status",reservationStatusUrlSegment))
.toUriString();
} else {
return "redirect:/";
}
}

private static Element buildScripTag(String content, String type, String id, String param) {
var e = new Element("script");
e.appendChild(new Text(content));
Expand Down Expand Up @@ -259,7 +285,7 @@ private Document getOpenGraphPage(Document eventOpenGraph, String eventShortName

var baseUrl = configurationManager.getForSystem(ConfigurationKeys.BASE_URL).getRequiredValue();

var title = messageSourceManager.getMessageSourceForEvent(event).getMessage("event.get-your-ticket-for", new String[] {event.getDisplayName()}, locale);
var title = messageSourceManager.getMessageSourceFor(event).getMessage("event.get-your-ticket-for", new String[] {event.getDisplayName()}, locale);

var head = eventOpenGraph.getElementsByTagName("head").get(0);

Expand Down
Loading