mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-08 09:18:39 +01:00
Move common gradle config into convention plugins.
This commit is contained in:
@@ -1,59 +1,23 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'signal-library'
|
||||
id 'kotlin-parcelize'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'org.signal.donations'
|
||||
|
||||
buildToolsVersion BUILD_TOOL_VERSION
|
||||
compileSdkVersion COMPILE_SDK
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion MINIMUM_SDK
|
||||
targetSdkVersion TARGET_SDK
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
coreLibraryDesugaringEnabled true
|
||||
sourceCompatibility JAVA_VERSION
|
||||
targetCompatibility JAVA_VERSION
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
disable 'InvalidVectorPath'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
lintChecks project(':lintchecks')
|
||||
|
||||
implementation project(':core-util')
|
||||
|
||||
coreLibraryDesugaring libs.android.tools.desugar
|
||||
|
||||
implementation libs.androidx.core.ktx
|
||||
implementation libs.androidx.annotation
|
||||
implementation libs.androidx.appcompat
|
||||
|
||||
implementation libs.kotlin.stdlib.jdk8
|
||||
implementation libs.kotlin.reflect
|
||||
implementation libs.jackson.module.kotlin
|
||||
implementation libs.jackson.core
|
||||
|
||||
testImplementation testLibs.junit.junit
|
||||
testImplementation testLibs.assertj.core
|
||||
testImplementation (testLibs.robolectric.robolectric) {
|
||||
exclude group: 'com.google.protobuf', module: 'protobuf-java'
|
||||
}
|
||||
|
||||
api libs.google.play.services.wallet
|
||||
api libs.square.okhttp3
|
||||
api libs.rxjava3.rxjava
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ class CreditCardPaymentSource(
|
||||
override fun parameterize(): JSONObject = payload
|
||||
override fun getTokenId(): String = parameterize().getString("id")
|
||||
override fun email(): String? = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,4 +218,4 @@ class GooglePayApi(
|
||||
}
|
||||
|
||||
class GooglePayException(message: String?) : Exception(message)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@ class GooglePayPaymentSource(private val paymentData: PaymentData) : StripeApi.P
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,4 @@ internal object ResponseFieldLogger {
|
||||
Log.w(TAG, "Failed to produce key map.", true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,13 +90,15 @@ class StripeApi(
|
||||
Single.just(CreatePaymentIntentResult.AmountIsTooSmall(price))
|
||||
} else if (Validation.isAmountTooLarge(price)) {
|
||||
Single.just(CreatePaymentIntentResult.AmountIsTooLarge(price))
|
||||
} else if (!Validation.supportedCurrencyCodes.contains(price.currency.currencyCode.uppercase(Locale.ROOT))) {
|
||||
Single.just<CreatePaymentIntentResult>(CreatePaymentIntentResult.CurrencyIsNotSupported(price.currency.currencyCode))
|
||||
} else {
|
||||
paymentIntentFetcher
|
||||
.fetchPaymentIntent(price, level)
|
||||
.map<CreatePaymentIntentResult> { CreatePaymentIntentResult.Success(it) }
|
||||
}.subscribeOn(Schedulers.io())
|
||||
if (!Validation.supportedCurrencyCodes.contains(price.currency.currencyCode.uppercase(Locale.ROOT))) {
|
||||
Single.just<CreatePaymentIntentResult>(CreatePaymentIntentResult.CurrencyIsNotSupported(price.currency.currencyCode))
|
||||
} else {
|
||||
paymentIntentFetcher
|
||||
.fetchPaymentIntent(price, level)
|
||||
.map<CreatePaymentIntentResult> { CreatePaymentIntentResult.Success(it) }
|
||||
}.subscribeOn(Schedulers.io())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,7 +233,7 @@ class StripeApi(
|
||||
val tokenId = paymentSource.getTokenId()
|
||||
val parameters = mutableMapOf(
|
||||
"card[token]" to tokenId,
|
||||
"type" to "card",
|
||||
"type" to "card"
|
||||
)
|
||||
|
||||
return postForm("payment_methods", parameters)
|
||||
@@ -554,5 +556,4 @@ class StripeApi(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ data class StripeIntentAccessor(
|
||||
* noActionRequired is a safe default for when there was no 3DS required,
|
||||
* in order to continue a reactive payment chain.
|
||||
*/
|
||||
val NO_ACTION_REQUIRED = StripeIntentAccessor(ObjectType.NONE,"", "")
|
||||
val NO_ACTION_REQUIRED = StripeIntentAccessor(ObjectType.NONE, "", "")
|
||||
|
||||
private const val KEY_PAYMENT_INTENT = "payment_intent"
|
||||
private const val KEY_PAYMENT_INTENT_CLIENT_SECRET = "payment_intent_client_secret"
|
||||
@@ -51,4 +51,4 @@ data class StripeIntentAccessor(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,4 @@ enum class StripeIntentStatus(private val code: String) {
|
||||
@JsonCreator
|
||||
fun fromCode(code: String): StripeIntentStatus = StripeIntentStatus.values().first { it.code == code }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@ data class StripePaymentIntent @JsonCreator constructor(
|
||||
@JsonProperty("client_secret") val clientSecret: String,
|
||||
@JsonProperty("status") val status: StripeIntentStatus?,
|
||||
@JsonProperty("payment_method") val paymentMethod: String?
|
||||
)
|
||||
)
|
||||
|
||||
@@ -16,4 +16,4 @@ data class StripeSetupIntent @JsonCreator constructor(
|
||||
@JsonProperty("status") val status: StripeIntentStatus,
|
||||
@JsonProperty("payment_method") val paymentMethod: String?,
|
||||
@JsonProperty("customer") val customer: String?
|
||||
)
|
||||
)
|
||||
|
||||
@@ -32,7 +32,9 @@ class ResponseFieldLoggerTest {
|
||||
|
||||
@Test
|
||||
fun `Given non-empty, when I logFields, then I expect no crash`() {
|
||||
ResponseFieldLogger.logFields(ObjectMapper(), """
|
||||
ResponseFieldLogger.logFields(
|
||||
ObjectMapper(),
|
||||
"""
|
||||
{
|
||||
"id": "asdf",
|
||||
"client_secret": 12345,
|
||||
@@ -40,6 +42,7 @@ class ResponseFieldLoggerTest {
|
||||
"a": "a"
|
||||
}
|
||||
}
|
||||
""".trimIndent())
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,4 +36,4 @@ class StripeIntentAccessorTest {
|
||||
|
||||
assertEquals(expected, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,4 +67,4 @@ class StripeSetupIntentTest {
|
||||
assertEquals(intent.status, StripeIntentStatus.REQUIRES_PAYMENT_METHOD)
|
||||
assertEquals(intent.customer, "cus_Fh6d95jDS2fVSL")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user