feat(CON-207) : [SDK] - Create mock for consentium api
This commit is contained in:
parent
3bfe96b1de
commit
f6f6a889fe
@ -18,11 +18,28 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
debug {
|
||||||
isMinifyEnabled = false
|
isMinifyEnabled = false
|
||||||
|
isShrinkResources = false
|
||||||
|
}
|
||||||
|
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = true
|
||||||
|
isShrinkResources = true
|
||||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
productFlavors {
|
||||||
|
create("prod") {
|
||||||
|
dimension = "data"
|
||||||
|
}
|
||||||
|
|
||||||
|
create("demo") {
|
||||||
|
dimension = "data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
targetCompatibility = JavaVersion.VERSION_11
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package fr.openium.consentium.api
|
||||||
|
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.Provides
|
||||||
|
import dagger.hilt.InstallIn
|
||||||
|
import dagger.hilt.components.SingletonComponent
|
||||||
|
import fr.openium.consentium.data.remote.ConsentiumApi
|
||||||
|
import fr.openium.consentium.api.mock.ConsentiumMockApi
|
||||||
|
|
||||||
|
@Module
|
||||||
|
@InstallIn(SingletonComponent::class)
|
||||||
|
internal class ApiModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
fun provideConsentiumApi(): ConsentiumApi {
|
||||||
|
return ConsentiumMockApi
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package fr.openium.consentium.api.mock
|
||||||
|
|
||||||
|
import fr.openium.consentium.data.remote.ConsentiumApi
|
||||||
|
import fr.openium.consentium.data.remote.model.GetConsent
|
||||||
|
import fr.openium.consentium.data.remote.model.PatchConsent
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import retrofit2.Response
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
internal object ConsentiumMockApi : ConsentiumApi {
|
||||||
|
|
||||||
|
private val consents = GetConsent.GetConsentPayloadDTO(
|
||||||
|
installationId = UUID.randomUUID().toString(),
|
||||||
|
purposes = listOf(
|
||||||
|
GetConsent.PurposeDTO(
|
||||||
|
identifier = "purpose-audience",
|
||||||
|
isRequired = true,
|
||||||
|
isAccepted = GetConsent.PurposeStatusDTO.ACCEPTED,
|
||||||
|
vendors = listOf(
|
||||||
|
GetConsent.VendorDTO(
|
||||||
|
identifier = "vendor-clarity",
|
||||||
|
isAccepted = true,
|
||||||
|
isRequired = true,
|
||||||
|
),
|
||||||
|
GetConsent.VendorDTO(
|
||||||
|
identifier = "vendor-matomo",
|
||||||
|
isAccepted = true,
|
||||||
|
isRequired = false,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
GetConsent.PurposeDTO(
|
||||||
|
identifier = "purpose-required",
|
||||||
|
isRequired = true,
|
||||||
|
isAccepted = GetConsent.PurposeStatusDTO.REJECTED,
|
||||||
|
vendors = null
|
||||||
|
),
|
||||||
|
),
|
||||||
|
isValid = true
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getConsents(applicationId: String, installationId: String): Response<GetConsent.GetConsentPayloadDTO> {
|
||||||
|
delay(500)
|
||||||
|
return Response.success(consents)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun setConsents(applicationId: String, patchConsent: PatchConsent.PatchConsentPayloadDTO): Response<Any> {
|
||||||
|
delay(500)
|
||||||
|
return Response.success(Unit)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user