6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit dc4007a4
Changed files
.gitignore | 4 + comwell_key_app/.gitignore | 2 +- comwell_key_app/assets/translations/da-DK.json | 1 + comwell_key_app/assets/translations/en-US.json | 1 + .../check_out/pages/check_out_success_page.dart | 20 ++- .../test/overview_test/overview_cubic_test.dart | 166 ++++++++++++--------- .../overview_test/overview_repository_test.dart | 19 ++- 7 files changed, 133 insertions(+), 80 deletions(-)
Diff
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..e9de8575
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+comwell_key_app/android/app/.cxx/Debug/
+comwell_key_app/ios/Runner/Runner.entitlements
+comwell_key_app/ios/Runner.xcodeproj/project.pbxproj
+comwell_key_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
diff --git a/comwell_key_app/.gitignore b/comwell_key_app/.gitignore
index 1b8a1682..eb436f4f 100644
--- a/comwell_key_app/.gitignore
+++ b/comwell_key_app/.gitignore
@@ -45,7 +45,7 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
-
+android/app/.cxx
# Project related
pubspec.lock
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index 22f97be5..3bae6582 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -176,6 +176,7 @@
"checkout_page_payment_dialog_cancel": "Nej",
"checkout_page_processing_success_title": "Check-out bekræftet",
"checkout_page_processing_success_subtitle": "Det check-out er nu bekræftet og du har nu 30 minutter til at forlade dit værelse. Herefter vil du ikke længere kunne bruge dit nøglekort.",
+ "checkout_page_processing_success_subtitle_no_digital_card": "Du er nu checket ud. Husk at aflevere din nøgle i lobbyen.",
"payment_cards_title": "Betalingskort",
"payment_cards_my_cards": "Mine kort",
"payment_cards_edit_card_title": "Redigér kort",
diff --git a/comwell_key_app/assets/translations/en-US.json b/comwell_key_app/assets/translations/en-US.json
index 4b6ae5df..ec9348a9 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -176,6 +176,7 @@
"checkout_page_payment_dialog_cancel": "No",
"checkout_page_processing_success_title": "Check-out confirmed",
"checkout_page_processing_success_subtitle": "You have 30 minutes to leave your room",
+ "checkout_page_processing_success_subtitle_no_digital_card": "You are now checked out. Please return your key to the reception",
"payment_cards_title": "Payment cards",
"payment_cards_my_cards": "My cards",
"payment_cards_confirm_remove_title": "You are removing the card",
diff --git a/comwell_key_app/lib/check_out/pages/check_out_success_page.dart b/comwell_key_app/lib/check_out/pages/check_out_success_page.dart
index a0cbf72a..514c6bf4 100644
--- a/comwell_key_app/lib/check_out/pages/check_out_success_page.dart
+++ b/comwell_key_app/lib/check_out/pages/check_out_success_page.dart
@@ -1,6 +1,8 @@
+import 'package:comwell_key_app/check_out/bloc/check_out_cubit.dart';
import 'package:comwell_key_app/check_out/components/check_out_countdown.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
class CheckOutSuccessPage extends StatelessWidget {
@@ -8,6 +10,8 @@ class CheckOutSuccessPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ final booking = context.read<CheckoutCubit>().booking;
+
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Padding(
@@ -17,7 +21,7 @@ class CheckOutSuccessPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(),
- const CheckOutCountdown(),
+ booking.digitalCard ? const CheckOutCountdown() : const SizedBox(),
Column(
children: [
Text(
@@ -28,7 +32,10 @@ class CheckOutSuccessPage extends StatelessWidget {
?.copyWith(color: Colors.white),
),
Text(
- "checkout_page_processing_success_subtitle".tr(),
+ booking.digitalCard
+ ? "checkout_page_processing_success_subtitle".tr()
+ : "checkout_page_processing_success_subtitle_no_digital_card"
+ .tr(),
style: Theme.of(context)
.textTheme
.bodySmall
@@ -43,11 +50,14 @@ class CheckOutSuccessPage extends StatelessWidget {
context.pop();
},
style: const ButtonStyle(
- backgroundColor: WidgetStatePropertyAll(Colors.white)
- ),
+ backgroundColor:
+ WidgetStatePropertyAll(Colors.white)),
child: Padding(
padding: const EdgeInsets.all(16.0),
- child: Text("generic_ok".tr(), style: const TextStyle(color: Colors.black),),
+ child: Text(
+ "generic_ok".tr(),
+ style: const TextStyle(color: Colors.black),
+ ),
)),
),
],
diff --git a/comwell_key_app/test/overview_test/overview_cubic_test.dart b/comwell_key_app/test/overview_test/overview_cubic_test.dart
index 51b5981c..f87e228b 100644
--- a/comwell_key_app/test/overview_test/overview_cubic_test.dart
+++ b/comwell_key_app/test/overview_test/overview_cubic_test.dart
@@ -28,23 +28,31 @@ void main() {
build: () {
when(() => mockOverviewRepository.fetchAllBookingsForUser('1'))
.thenAnswer((_) async => Bookings(
- current: [Booking(
- id: '1',
- status: BookingStatus.current,
- confirmationId: "s",
- userId: '1',
- roomNumber: '',
- startDate: DateTime(2021, 10, 10),
- endDate: DateTime(2021, 10, 10),
- image: '',
- hotelName: '',
- roomType: '',
- children: 2,
- adults: 2,
- hotelCode: '',
- booker: '',
- bookingDate: DateTime(2021, 10, 10),
- paymentDetails: const PaymentDetails(cardNumber: '1234414141', cardHolder: 'Nikolaj', expiryDate: '', cvc: '212', cardType: CardType.visa))],
+ current: [
+ Booking(
+ id: '1',
+ status: BookingStatus.current,
+ confirmationId: "s",
+ userId: '1',
+ roomNumber: '',
+ startDate: DateTime(2021, 10, 10),
+ endDate: DateTime(2021, 10, 10),
+ image: '',
+ hotelName: '',
+ roomType: '',
+ children: 2,
+ adults: 2,
+ hotelCode: '',
+ booker: '',
+ bookingDate: DateTime(2021, 10, 10),
+ paymentDetails: const PaymentDetails(
+ cardNumber: '1234414141',
+ cardHolder: 'Nikolaj',
+ expiryDate: '',
+ cvc: '212',
+ cardType: CardType.visa),
+ digitalCard: true)
+ ],
past: const [],
cancelled: const [],
));
@@ -55,23 +63,31 @@ void main() {
OverviewLoading(),
OverviewLoaded(
bookings: Bookings(
- current: [Booking(
- id: '1',
- status: BookingStatus.current,
- userId: '1',
- roomNumber: '',
- startDate: DateTime(2021, 10, 10),
- endDate: DateTime(2021, 10, 10),
- image: '',
- hotelName: '',
- confirmationId: "",
- roomType: '',
- children: 2,
- adults: 2,
- hotelCode: '',
- booker: '',
- bookingDate: DateTime(2021, 10, 10),
- paymentDetails: const PaymentDetails(cardNumber: '1234414141', cardHolder: 'Nikolaj', expiryDate: '', cvc: '212', cardType: CardType.visa))],
+ current: [
+ Booking(
+ id: '1',
+ status: BookingStatus.current,
+ userId: '1',
+ roomNumber: '',
+ startDate: DateTime(2021, 10, 10),
+ endDate: DateTime(2021, 10, 10),
+ image: '',
+ hotelName: '',
+ confirmationId: "",
+ roomType: '',
+ children: 2,
+ adults: 2,
+ hotelCode: '',
+ booker: '',
+ bookingDate: DateTime(2021, 10, 10),
+ paymentDetails: const PaymentDetails(
+ cardNumber: '1234414141',
+ cardHolder: 'Nikolaj',
+ expiryDate: '',
+ cvc: '212',
+ cardType: CardType.visa),
+ digitalCard: true)
+ ],
past: const [],
cancelled: const [],
),
@@ -106,42 +122,56 @@ void main() {
),
),
act: (cubit) => cubit.addBooking(Booking(
- id: '1',
- status: BookingStatus.current,
- userId: '1',
- roomNumber: '',
- startDate: DateTime(2021, 10, 10),
- endDate: DateTime(2021, 10, 10),
- confirmationId: "",
- image: '',
- hotelName: '',
- roomType: "",
- children: 2,
- adults: 2,
- hotelCode: '',
- booker: '',
- bookingDate: DateTime(2021, 10, 10),
- paymentDetails: const PaymentDetails(cardNumber: '1234414141', cardHolder: 'Nikolaj', expiryDate: '', cvc: '212', cardType: CardType.visa))),
+ id: '1',
+ status: BookingStatus.current,
+ userId: '1',
+ roomNumber: '',
+ startDate: DateTime(2021, 10, 10),
+ endDate: DateTime(2021, 10, 10),
+ confirmationId: "",
+ image: '',
+ hotelName: '',
+ roomType: "",
+ children: 2,
+ adults: 2,
+ hotelCode: '',
+ booker: '',
+ bookingDate: DateTime(2021, 10, 10),
+ paymentDetails: const PaymentDetails(
+ cardNumber: '1234414141',
+ cardHolder: 'Nikolaj',
+ expiryDate: '',
+ cvc: '212',
+ cardType: CardType.visa),
+ digitalCard: true)),
expect: () => [
OverviewLoaded(
bookings: Bookings(
- current: [Booking(
- id: '1',
- status: BookingStatus.current,
- userId: '1',
- roomNumber: '',
- startDate: DateTime(2021, 10, 10),
- endDate: DateTime(2021, 10, 10),
- image: '',
- hotelName: '',
- roomType: '',
- confirmationId: "",
- children: 2,
- adults: 2,
- hotelCode: '',
- booker: '',
- bookingDate: DateTime(2021, 10, 10),
- paymentDetails: const PaymentDetails(cardNumber: '1234414141', cardHolder: 'Nikolaj', expiryDate: '', cvc: '212', cardType: CardType.visa))],
+ current: [
+ Booking(
+ id: '1',
+ status: BookingStatus.current,
+ userId: '1',
+ roomNumber: '',
+ startDate: DateTime(2021, 10, 10),
+ endDate: DateTime(2021, 10, 10),
+ image: '',
+ hotelName: '',
+ roomType: '',
+ confirmationId: "",
+ children: 2,
+ adults: 2,
+ hotelCode: '',
+ booker: '',
+ bookingDate: DateTime(2021, 10, 10),
+ paymentDetails: const PaymentDetails(
+ cardNumber: '1234414141',
+ cardHolder: 'Nikolaj',
+ expiryDate: '',
+ cvc: '212',
+ cardType: CardType.visa),
+ digitalCard: true)
+ ],
past: const [],
cancelled: const [],
),
@@ -149,4 +179,4 @@ void main() {
],
);
});
-}
\ No newline at end of file
+}
diff --git a/comwell_key_app/test/overview_test/overview_repository_test.dart b/comwell_key_app/test/overview_test/overview_repository_test.dart
index f55c44ad..38185a48 100644
--- a/comwell_key_app/test/overview_test/overview_repository_test.dart
+++ b/comwell_key_app/test/overview_test/overview_repository_test.dart
@@ -42,6 +42,7 @@ void main() {
cvc: '123',
cardType: CardType.visa,
),
+ digitalCard: true,
),
],
past: const [],
@@ -54,7 +55,8 @@ void main() {
final result = await overviewRepository.fetchAllBookingsForUser(userId);
expect(result, bookings);
- verify(() => overviewRepository.fetchAllBookingsForUser(userId)).called(1);
+ verify(() => overviewRepository.fetchAllBookingsForUser(userId))
+ .called(1);
});
test('findBooking returns Booking', () async {
@@ -83,15 +85,18 @@ void main() {
cvc: '123',
cardType: CardType.visa,
),
+ digitalCard: true,
);
when(() => overviewRepository.findBooking(bookingReference, lastName))
.thenAnswer((_) async => booking);
- final result = await overviewRepository.findBooking(bookingReference, lastName);
+ final result =
+ await overviewRepository.findBooking(bookingReference, lastName);
expect(result, booking);
- verify(() => overviewRepository.findBooking(bookingReference, lastName)).called(1);
+ verify(() => overviewRepository.findBooking(bookingReference, lastName))
+ .called(1);
});
test('findBooking returns null when booking is not found', () async {
@@ -101,10 +106,12 @@ void main() {
when(() => overviewRepository.findBooking(bookingReference, lastName))
.thenAnswer((_) async => null);
- final result = await overviewRepository.findBooking(bookingReference, lastName);
+ final result =
+ await overviewRepository.findBooking(bookingReference, lastName);
expect(result, isNull);
- verify(() => overviewRepository.findBooking(bookingReference, lastName)).called(1);
+ verify(() => overviewRepository.findBooking(bookingReference, lastName))
+ .called(1);
});
});
-}
\ No newline at end of file
+}