generated from Kotlin/multiplatform-library-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
112 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package model.ad | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import model.Result | ||
|
||
@Serializable | ||
enum class TypeProduct { | ||
@SerialName("subscription") | ||
Subscription | ||
} | ||
|
||
enum class Currency { | ||
RUB | ||
} | ||
|
||
@Serializable | ||
enum class PaymentMethod { | ||
@SerialName("card") | ||
Card | ||
} | ||
|
||
@Serializable | ||
data class Ad( | ||
val offersBatchId: String? = null, | ||
val inAppProducts: List<AppProduct>, | ||
val nativeProducts: List<AppProduct>, | ||
val webPaymentUrl: String, | ||
val promoCodesEnabled: Boolean | ||
) : | ||
Result() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package model.ad | ||
|
||
import kotlinx.datetime.DateTimePeriod | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class AppProduct( | ||
val productId: String, | ||
val offersPositionId: String, | ||
val type: TypeProduct, | ||
val commonPeriodDuration: DateTimePeriod? = null, | ||
val duration: Int, | ||
val trialDuration: Int, | ||
val price: Price? = null, | ||
val plus: Boolean, | ||
val feature: String, | ||
val features: List<Feature>, | ||
val debug: Boolean = false, | ||
val buttonText: String = "", | ||
val buttonAdditionalText: String = "", | ||
val description: String, | ||
val paymentMethodTypes: List<PaymentMethod>, | ||
val available: Boolean, | ||
val vendorTrialAvailable: Boolean? = null, | ||
val familySub: Boolean? = null, | ||
val trialAvailable: Boolean? = null, | ||
val family: Boolean? = null | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package model.ad | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
enum class Feature { | ||
@SerialName("basic-plus") | ||
BasicPlus, | ||
|
||
@SerialName("basic-music") | ||
BasicMusic, | ||
|
||
@SerialName("basic-kinopoisk") | ||
BasicKinopoisk, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package model.ad | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class Price(val amount: Float, val currency: Currency) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
import dsl.client | ||
import io.getenv | ||
import kotlinx.coroutines.test.runTest | ||
import kotlin.test.Test | ||
|
||
class AdsTest { | ||
|
||
@Test | ||
fun gettingAds() = runTest { | ||
val ad = client { }.ads() | ||
|
||
val token = getenv("token") ?: return@runTest | ||
if (token == "") return@runTest | ||
client { this.token = token }.ads() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters