6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 3615b412
Changed files
comwell_key_app/lib/check_out/bloc/check_out_cubit.dart | 4 +++- comwell_key_app/lib/check_out/bloc/check_out_state.dart | 2 +- comwell_key_app/lib/overview/models/booking.dart | 2 +- comwell_key_app/lib/pregistration/pregistration_repository.dart | 3 +++ comwell_key_app/lib/services/api.dart | 6 ++++++ comwell_key_app/lib/services/utils/api_endpoints.dart | 1 + 6 files changed, 15 insertions(+), 3 deletions(-)
Diff
diff --git a/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart b/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart
index 7db31fec..07c3e95f 100644
--- a/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart
+++ b/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart
@@ -112,9 +112,11 @@ class CheckoutCubit extends Cubit<CheckoutState> {
void createSession() async {
try {
// Price should be in cents/øre, so we multiply with 100
+ final bookingPrice = booking.totalCharge.toInt();
+ print("qqq bookingPrice=$bookingPrice");
final priceInCents = state.totalPriceAfterDiscount * 100;
final amount = Amount(
- value: priceInCents,
+ value: bookingPrice,
currency: "DKK",
);
final paymentConfigurations = await preregistrationRepository
diff --git a/comwell_key_app/lib/check_out/bloc/check_out_state.dart b/comwell_key_app/lib/check_out/bloc/check_out_state.dart
index 037f11a4..f41a71f2 100644
--- a/comwell_key_app/lib/check_out/bloc/check_out_state.dart
+++ b/comwell_key_app/lib/check_out/bloc/check_out_state.dart
@@ -44,7 +44,7 @@ class CheckoutState extends Equatable {
}) : _items = items;
CheckoutState.initial()
- : _items = _mockItems(),
+ : _items = [],
isTermsAccepted = false,
page = CheckoutPage.confirmation,
showTermsError = false,
diff --git a/comwell_key_app/lib/overview/models/booking.dart b/comwell_key_app/lib/overview/models/booking.dart
index 3c973c4b..b3e4ca2f 100644
--- a/comwell_key_app/lib/overview/models/booking.dart
+++ b/comwell_key_app/lib/overview/models/booking.dart
@@ -55,7 +55,7 @@ class Booking extends Equatable {
@override
String toString() {
- return "Booking(id: $id, confirmationId: $confirmationId, roomNumber: $roomNumber, startDate: $startDate, endDate: $endDate, status: $status, image: $image, hotelName: $hotelName, hotelCode: $hotelCode, roomType: $roomType, adults: $adults, children: $children, booker: $booker, bookingDate: $bookingDate, digitalCard: $digitalCard, guests: $guests)";
+ return "Booking(id: $id, confirmationId: $confirmationId, roomNumber: $roomNumber, startDate: $startDate, endDate: $endDate, status: $status, image: $image, hotelName: $hotelName, hotelCode: $hotelCode, roomType: $roomType, adults: $adults, children: $children, booker: $booker, bookingDate: $bookingDate, digitalCard: $digitalCard, guests: $guests, totalCharge: $totalCharge)";
}
@override
diff --git a/comwell_key_app/lib/pregistration/pregistration_repository.dart b/comwell_key_app/lib/pregistration/pregistration_repository.dart
index 655fdc10..40fce427 100644
--- a/comwell_key_app/lib/pregistration/pregistration_repository.dart
+++ b/comwell_key_app/lib/pregistration/pregistration_repository.dart
@@ -21,6 +21,8 @@ class PreregistrationRepository {
final sessionResponse = response["sessionResponse"];
final id = sessionResponse["id"] as String;
final sessionData = sessionResponse["sessionData"] as String;
+ print("qqq $response");
+
final session = await AdyenCheckout.session.create(
sessionId: id,
sessionData: sessionData,
@@ -33,6 +35,7 @@ class PreregistrationRepository {
cardComponentConfiguration(amount, clientKey),
applePayConfiguration:
_applePayComponentConfiguration(clientKey, amount));
+
}
Future<dynamic> createPreregistration(String confirmationId) async {
diff --git a/comwell_key_app/lib/services/api.dart b/comwell_key_app/lib/services/api.dart
index cb67c81c..3a53f4f1 100644
--- a/comwell_key_app/lib/services/api.dart
+++ b/comwell_key_app/lib/services/api.dart
@@ -195,6 +195,12 @@ class Api {
return response.data!;
}
+ Future<Json> adyenNotificationWebhook(Json body) async {
+ final json = jsonEncode(body);
+ final response = await dio.post<Json>(ApiEndpoints.adyenNotificationWebhook, data: json);
+ return response.data!;
+ }
+
Future<String> createEndpointRegistration() async {
final response =
await dio.post<String>(ApiEndpoints.createEndpointRegistration);
diff --git a/comwell_key_app/lib/services/utils/api_endpoints.dart b/comwell_key_app/lib/services/utils/api_endpoints.dart
index c32de0f2..171bba69 100644
--- a/comwell_key_app/lib/services/utils/api_endpoints.dart
+++ b/comwell_key_app/lib/services/utils/api_endpoints.dart
@@ -10,6 +10,7 @@ class ApiEndpoints {
// Payment endpoints
static const String storedPaymentMethods = '/Payment/v1/stored-payment-methods';
static const String createAdyenSession = '/Payment/v1/CreateAdyenSession';
+ static const String adyenNotificationWebhook = '/Payment/v1/AdyenNotificationWebhook';
static const String adyenPayments = 'https://checkout-test.adyen.com/v71/payments';
static const String adyenPaymentsDetails = 'https://checkout-test.adyen.com/v71/payments/details';