From cf2444da450c5676479bbfa804f52cdce8c2ccfa Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Thu, 15 Dec 2016 18:44:27 -0500 Subject: [PATCH] (add TicketPurchasingService) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...only to be deleted in the very next commit! 😈 --- app/TicketPurchasingService.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 app/TicketPurchasingService.php diff --git a/app/TicketPurchasingService.php b/app/TicketPurchasingService.php new file mode 100644 index 0000000..5b80eb9 --- /dev/null +++ b/app/TicketPurchasingService.php @@ -0,0 +1,25 @@ +paymentGateway = $paymentGateway; + } + + public function purchaseTickets($concert, $ticketQuantity, $email, $paymentToken) + { + $reservation = $concert->reserveTickets($ticketQuantity, $email); + + $this->paymentGateway->charge($reservation->totalCost(), $paymentToken); + + return Order::forTickets($reservation->tickets(), $reservation->email(), $reservation->totalCost()); + } +}