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

#657 implement code url #670

Merged
merged 29 commits into from
Jun 26, 2019
Merged

#657 implement code url #670

merged 29 commits into from
Jun 26, 2019

Conversation

syjer
Copy link
Member

@syjer syjer commented Jun 23, 2019

can be merged WIP: still some details to handle

@syjer syjer added this to the 2.0-M2 milestone Jun 23, 2019
@coveralls
Copy link

coveralls commented Jun 23, 2019

Coverage Status

Coverage increased (+0.9%) to 55.967% when pulling 5d5c280 on 657-implement-code-url into a8104fa on master.

@syjer
Copy link
Member Author

syjer commented Jun 24, 2019

note:

cleanup:

we can avoid the dance of passing the reservationId in bindToSession and then doing a select by using an update+returning clause.

private List<SpecialPrice> reserveTokens(String reservationId, TicketReservationWithOptionalCodeModification ticketReservation, PromoCodeDiscount discount) {
        try {
            int count = specialPriceRepository.bindToSession(reservationId, ticketReservation.getTicketCategoryId(), discount.getId(), ticketReservation.getAmount());
            if(count != ticketReservation.getAmount()) {
                throw new NotEnoughTicketsException();
            }
            return specialPriceRepository.findBySessionIdAndAccessCodeId(reservationId, discount.getId());
        } catch (Exception e) {
            log.trace("constraints violated", e);
            if(e instanceof NotEnoughTicketsException) {
                throw e;
            }
            throw new TooManyTicketsForDiscountCodeException();
        }
    }

@syjer syjer marked this pull request as ready for review June 26, 2019 13:14
@syjer syjer requested a review from cbellone June 26, 2019 16:08
@cbellone cbellone merged commit d2476b2 into master Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants