Skip to content

Commit

Permalink
#1 handle {code} parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Jun 26, 2019
1 parent a46a930 commit 328724c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/app/event-display/event-display.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ export class EventDisplayComponent implements OnInit {
private analytics: AnalyticsService) { }

ngOnInit(): void {
this.route.params.subscribe(params => {

const code = this.route.snapshot.queryParams['code'];
const errors = this.route.snapshot.queryParams['errors'];
if (errors) {
this.globalErrors = errors.split(',');
}

this.route.params.subscribe(params => {
const eventShortName = params['eventShortName'];

zip(this.eventService.getEvent(eventShortName), this.eventService.getEventTicketsInfo(eventShortName)).subscribe( ([event, itemsByCat]) => {
Expand All @@ -79,6 +85,10 @@ export class EventDisplayComponent implements OnInit {

this.applyItemsByCat(itemsByCat);
this.analytics.pageView(event.analyticsConfiguration);

if(code) {
this.applyPromoCode(code);
}
});
})
}
Expand Down Expand Up @@ -148,6 +158,7 @@ export class EventDisplayComponent implements OnInit {

applyPromoCode(promoCode: string): void {

this.globalErrors = [];
this.eventCodeError = false;

if (promoCode === null || promoCode === undefined || promoCode.trim() === "") {
Expand Down
2 changes: 2 additions & 0 deletions src/app/model/reservation-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export class OrderSummary {
displayVat: boolean;
priceInCents: number;
descriptionForPayment: string;
totalVAT: string;
vatPercentage: string;
}

export class SummaryRow {
Expand Down

0 comments on commit 328724c

Please sign in to comment.