diff --git a/libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingsRestClient.kt b/libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingsRestClient.kt index 258fc5e52ce..59a3feb3531 100644 --- a/libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingsRestClient.kt +++ b/libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingsRestClient.kt @@ -69,7 +69,7 @@ class BookingsRestClient @Inject constructor( site: SiteModel, resourceId: Long ): WooPayload { - val endpoint = WOOCOMMERCE.resources.id(resourceId).pathV2Bookings + val endpoint = WOOCOMMERCE.resources.team_members.id(resourceId).pathV2Bookings val response = wooNetwork.executeGetGsonRequest( site = site, @@ -90,7 +90,7 @@ class BookingsRestClient @Inject constructor( BookingsFilterOption.AttendanceStatus -> TODO() BookingsFilterOption.PaymentStatus -> TODO() BookingsFilterOption.BookingType -> TODO() - is BookingsFilterOption.Customer -> filter.customerId?.let { set("customer", it.toString()) } + is BookingsFilterOption.Customer -> set("customer", filter.customerId.toString()) BookingsFilterOption.Location -> TODO() is BookingsFilterOption.DateRange -> { diff --git a/libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingsStore.kt b/libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingsStore.kt index 281c4a0c04c..9a26d5296cb 100644 --- a/libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingsStore.kt +++ b/libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/network/rest/wpcom/wc/bookings/BookingsStore.kt @@ -99,14 +99,16 @@ class BookingsStore @Inject internal constructor( response.isError -> WooResult(response.error) response.result != null -> { val bookingDto = response.result - val orderResult = orderStore.fetchSingleOrderSync(site, bookingDto.orderId) - if (orderResult.isError) { + val orderResult = bookingDto.orderId.takeIf { it != 0L }?.let { + orderStore.fetchSingleOrderSync(site, bookingDto.orderId) + } + if (orderResult?.isError == true) { return@withDefaultContext WooResult(orderResult.error) } val entity = with(bookingDtoMapper) { bookingDto.toEntity( localSiteId = site.localId(), - orderEntity = orderResult.model, + orderEntity = orderResult?.model, ) } bookingsDao.insertOrReplace(listOf(entity)) diff --git a/libs/fluxc-processor/src/main/resources/wc-wp-api-endpoints.txt b/libs/fluxc-processor/src/main/resources/wc-wp-api-endpoints.txt index 0e4aea43ba9..d0f44fbb861 100644 --- a/libs/fluxc-processor/src/main/resources/wc-wp-api-endpoints.txt +++ b/libs/fluxc-processor/src/main/resources/wc-wp-api-endpoints.txt @@ -137,4 +137,4 @@ /bookings /bookings// -/resources// +/resources/team-members//