diff --git a/database/migrations/2016_11_08_205823_create_orders_table.php b/database/migrations/2016_11_08_205823_create_orders_table.php index d2bc20e..36ca999 100644 --- a/database/migrations/2016_11_08_205823_create_orders_table.php +++ b/database/migrations/2016_11_08_205823_create_orders_table.php @@ -18,6 +18,7 @@ class CreateOrdersTable extends Migration $table->string('confirmation_number'); $table->integer('amount'); $table->string('email'); + $table->string('card_last_four'); $table->timestamps(); }); } diff --git a/database/migrations/2016_11_08_210440_create_tickets_table.php b/database/migrations/2016_11_08_210440_create_tickets_table.php index a173b5e..8a9f0ec 100644 --- a/database/migrations/2016_11_08_210440_create_tickets_table.php +++ b/database/migrations/2016_11_08_210440_create_tickets_table.php @@ -18,6 +18,7 @@ class CreateTicketsTable extends Migration $table->unsignedInteger('concert_id'); $table->unsignedInteger('order_id')->nullable(); $table->datetime('reserved_at')->nullable(); + $table->string('code'); $table->timestamps(); }); } diff --git a/resources/views/orders/show.blade.php b/resources/views/orders/show.blade.php index a899da5..0636508 100644 --- a/resources/views/orders/show.blade.php +++ b/resources/views/orders/show.blade.php @@ -7,17 +7,19 @@
- Order Total: $65.00 + Order Total: ${{ number_format($order->amount / 100, 2) }}
-Billed to Card #: **** **** **** 4242
+Billed to Card #: **** **** **** {{ $order->card_last_four }}
DTJKCVUA
-adam.wathan@example.com
-with Cruel Hand and Backtrack
-Admit one
-Sunday, October 16, 2011
-Doors at 8:00PM
-Music Hall of Williamsburg
-123 Main St. W
-Brooklyn, New York 14259
-MHVHELNB
+{{ $ticket->code }}
adam.wathan@example.com
Powered by TicketBeast
diff --git a/tests/features/ViewOrderTest.php b/tests/features/ViewOrderTest.php index 2a167be..7476043 100644 --- a/tests/features/ViewOrderTest.php +++ b/tests/features/ViewOrderTest.php @@ -18,11 +18,19 @@ class ViewOrderTest extends TestCase $concert = factory(Concert::class)->create(); $order = factory(Order::class)->create([ - 'confirmation_number' => 'ORDERCONFIRMATION1234' + 'confirmation_number' => 'ORDERCONFIRMATION1234', + 'card_last_four' => '1881', + 'amount' => 8500, ]); - $ticket = factory(Ticket::class)->create([ + $ticketA = factory(Ticket::class)->create([ 'concert_id' => $concert->id, 'order_id' => $order->id, + 'code' => 'TICKETCODE123' + ]); + $ticketB = factory(Ticket::class)->create([ + 'concert_id' => $concert->id, + 'order_id' => $order->id, + 'code' => 'TICKETCODE456' ]); // Visit the order confirmation page @@ -34,5 +42,11 @@ class ViewOrderTest extends TestCase $response->assertViewHas('order', function ($viewOrder) use ($order) { return $order->id === $viewOrder->id; }); + + $response->assertSee('ORDERCONFIRMATION1234'); + $response->assertSee('$85.00'); + $response->assertSee('**** **** **** 1881'); + $response->assertSee('TICKETCODE123'); + $response->assertSee('TICKETCODE456'); } }