Skip to content

Commit

Permalink
Apply spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
devinmorgan committed May 10, 2024
1 parent 8dd8236 commit d6ea2f8
Show file tree
Hide file tree
Showing 48 changed files with 159 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ internal fun JSONObject.getStringOrNull(fieldName: String): String? {

internal fun JSONObject.hasNonNull(fieldName: String): Boolean {
return has(fieldName) && !isNull(fieldName)
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.joinforage.forage.android.core.services.forageapi.encryptkey

import com.joinforage.forage.android.core.services.ForageConstants
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.addTrailingSlash
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.network.ForageError
import com.joinforage.forage.android.core.services.forageapi.network.NetworkService
import com.joinforage.forage.android.core.services.telemetry.Log
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.OkHttpClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.joinforage.forage.android.core.services.forageapi.payment

import com.joinforage.forage.android.core.services.getStringOrNull
import com.joinforage.forage.android.core.services.hasNonNull
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.Balance
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.EbtBalance
import com.joinforage.forage.android.core.services.getStringOrNull
import com.joinforage.forage.android.core.services.hasNonNull
import org.json.JSONArray
import org.json.JSONObject

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.joinforage.forage.android.core.services.forageapi.payment

import com.joinforage.forage.android.core.services.ForageConstants
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.addTrailingSlash
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.network.ForageError
import com.joinforage.forage.android.core.services.forageapi.network.NetworkService
import com.joinforage.forage.android.core.services.telemetry.Log
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.OkHttpClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ data class PaymentMethod(
card = EbtCard(jsonObject.getJSONObject("card")),
reusable = jsonObject.optBoolean("reusable", true)
)
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.joinforage.forage.android.core.services.forageapi.paymentmethod

import com.joinforage.forage.android.core.services.ForageConstants
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.addTrailingSlash
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.network.ForageError
import com.joinforage.forage.android.core.services.forageapi.network.NetworkService
import com.joinforage.forage.android.core.services.telemetry.Log
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.OkHttpClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.joinforage.forage.android.core.services.forageapi.polling

import com.joinforage.forage.android.core.services.ForageConstants
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.addTrailingSlash
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.network.ForageError
import com.joinforage.forage.android.core.services.forageapi.network.NetworkService
import com.joinforage.forage.android.core.services.telemetry.Log
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.OkHttpClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.joinforage.forage.android.core.services.forageapi.polling

import com.joinforage.forage.android.core.services.launchdarkly.LDManager
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.network.ForageError
import com.joinforage.forage.android.core.services.getJitterAmount
import com.joinforage.forage.android.core.services.launchdarkly.LDManager
import com.joinforage.forage.android.core.services.telemetry.Log
import kotlinx.coroutines.delay

internal class PollingService(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.joinforage.forage.android.core.services.vault

import android.content.Context
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.telemetry.UserAction
import com.joinforage.forage.android.core.services.telemetry.VaultProxyResponseMonitor
import com.joinforage.forage.android.core.services.forageapi.encryptkey.EncryptionKeys
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethod
import com.joinforage.forage.android.core.services.ForageConstants
import com.joinforage.forage.android.core.services.VaultType
import com.joinforage.forage.android.core.services.forageapi.encryptkey.EncryptionKeys
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.network.ForageError
import com.joinforage.forage.android.core.services.forageapi.network.UnknownErrorApiResponse
import com.joinforage.forage.android.core.services.VaultType
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.EbtCard
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethod
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.telemetry.UserAction
import com.joinforage.forage.android.core.services.telemetry.VaultProxyResponseMonitor
import com.joinforage.forage.android.core.ui.element.ForagePinElement

internal val IncompletePinError = ForageApiResponse.Failure.fromError(
Expand All @@ -35,7 +35,7 @@ internal interface VaultSubmitter {
internal abstract class AbstractVaultSubmitter(
protected val context: Context,
protected val foragePinEditText: ForagePinElement,
protected val logger: Log,
protected val logger: Log
) : VaultSubmitter {

abstract val vaultType: VaultType
Expand Down Expand Up @@ -174,6 +174,5 @@ internal abstract class AbstractVaultSubmitter(

internal fun deferPaymentCapturePath(paymentRef: String) =
"/api/payments/$paymentRef/collect_pin/"

}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.joinforage.forage.android.core.services.vault

import com.joinforage.forage.android.core.services.forageapi.encryptkey.EncryptionKeyService
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethodService
import com.joinforage.forage.android.core.services.forageapi.payment.PaymentService
import com.joinforage.forage.android.core.services.forageapi.polling.PollingService
import com.joinforage.forage.android.core.services.telemetry.UserAction
import com.joinforage.forage.android.core.services.forageapi.encryptkey.EncryptionKeys
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.payment.Payment
import com.joinforage.forage.android.core.services.forageapi.payment.PaymentService
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethod
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethodService
import com.joinforage.forage.android.core.services.forageapi.polling.Message
import com.joinforage.forage.android.core.services.forageapi.polling.PollingService
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.telemetry.UserAction

internal class CapturePaymentRepository(
private val vaultSubmitter: VaultSubmitter,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.joinforage.forage.android.core.services.vault

import com.joinforage.forage.android.core.services.forageapi.encryptkey.EncryptionKeyService
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethodService
import com.joinforage.forage.android.core.services.forageapi.polling.PollingService
import com.joinforage.forage.android.core.services.telemetry.UserAction
import com.joinforage.forage.android.core.services.forageapi.encryptkey.EncryptionKeys
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethod
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethod
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethodService
import com.joinforage.forage.android.core.services.forageapi.polling.Message
import com.joinforage.forage.android.core.services.forageapi.polling.PollingService
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.telemetry.UserAction
import java.util.UUID

internal class CheckBalanceRepository(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.joinforage.forage.android.core.services.vault

import com.joinforage.forage.android.core.services.forageapi.encryptkey.EncryptionKeyService
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethodService
import com.joinforage.forage.android.core.services.forageapi.payment.PaymentService
import com.joinforage.forage.android.core.services.telemetry.UserAction
import com.joinforage.forage.android.core.services.forageapi.encryptkey.EncryptionKeys
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.payment.Payment
import com.joinforage.forage.android.core.services.forageapi.payment.PaymentService
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethod
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethodService
import com.joinforage.forage.android.core.services.telemetry.UserAction
import java.util.UUID

internal class DeferPaymentCaptureRepository(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.joinforage.forage.android.core.services.vault

import com.joinforage.forage.android.core.services.ForageConstants
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.addTrailingSlash
import com.joinforage.forage.android.core.services.forageapi.network.NetworkService
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.network.ForageError
import com.joinforage.forage.android.core.services.forageapi.network.NetworkService
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethodRequestBody
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.RequestBody
import com.joinforage.forage.android.core.services.telemetry.Log
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.MediaType.Companion.toMediaTypeOrNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ internal interface VaultResponseParser {

val vaultErrorMsg: String?
val rawResponse: String
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.joinforage.forage.android.core.ui

import android.content.res.TypedArray
import android.content.Context
import android.content.res.TypedArray
import android.util.TypedValue

internal fun getThemeAccentColor(context: Context): Int {
Expand Down Expand Up @@ -33,4 +33,4 @@ internal fun TypedArray.getBoxCornerRadiusTopStart(boxCornerRadius: Float): Floa
internal fun TypedArray.getBoxCornerRadius(styleIndex: Int, defaultBoxCornerRadius: Float): Float {
val styledBoxCornerRadius = getDimension(styleIndex, 0f)
return if (styledBoxCornerRadius == 0f) defaultBoxCornerRadius else styledBoxCornerRadius
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import android.util.TypedValue
import android.view.View
import android.widget.FrameLayout
import com.joinforage.forage.android.core.services.VaultType
import com.joinforage.forage.android.core.services.vault.AbstractVaultSubmitter
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.vault.AbstractVaultSubmitter
import com.joinforage.forage.android.core.ui.element.ForagePinElement
import com.joinforage.forage.android.core.ui.element.SimpleElementListener
import com.joinforage.forage.android.core.ui.element.StatefulElementListener
Expand Down Expand Up @@ -43,7 +43,7 @@ internal abstract class VaultWrapper @JvmOverloads constructor(
abstract fun getVaultSubmitter(
foragePinElement: ForagePinElement,
logger: Log
) : AbstractVaultSubmitter
): AbstractVaultSubmitter

fun getThemeAccentColor(context: Context): Int {
val outValue = TypedValue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,4 @@ abstract class ForagePanElement @JvmOverloads constructor(
// remove format spacing
return rawText.filter { it.isDigit() }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import android.widget.LinearLayout
import com.joinforage.forage.android.R
import com.joinforage.forage.android.core.ForageConfigNotSetException
import com.joinforage.forage.android.core.services.VaultType
import com.joinforage.forage.android.core.services.vault.AbstractVaultSubmitter
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.vault.AbstractVaultSubmitter
import com.joinforage.forage.android.core.ui.VaultWrapper
import com.joinforage.forage.android.core.ui.element.state.PinElementState
import com.joinforage.forage.android.core.ui.getLogoImageViewLayout
import com.joinforage.forage.android.core.ui.VaultWrapper

/**
* A [ForageElement] that securely collects a card PIN. You need a [ForagePINEditText] to call
Expand Down Expand Up @@ -104,7 +104,7 @@ abstract class ForagePinElement @JvmOverloads constructor(
}
}

internal abstract fun determineBackingVault(forageConfig: ForageConfig, logger: Log) : VaultWrapper
internal abstract fun determineBackingVault(forageConfig: ForageConfig, logger: Log): VaultWrapper

override fun initWithForageConfig(forageConfig: ForageConfig) {
// Must initialize DD at the beginning of each render function. DD requires the context,
Expand All @@ -130,7 +130,7 @@ abstract class ForagePinElement @JvmOverloads constructor(
vault.clearText()
}

internal fun getVaultSubmitter(logger: Log) : AbstractVaultSubmitter =
internal fun getVaultSubmitter(logger: Log): AbstractVaultSubmitter =
vault.getVaultSubmitter(this, logger)

// While the events that ForageElements expose mirrors the
Expand Down Expand Up @@ -183,4 +183,4 @@ abstract class ForagePinElement @JvmOverloads constructor(
override fun setBoxStrokeWidthFocused(boxStrokeWidth: Int) {
// no-ops for now
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ import com.joinforage.forage.android.core.ForageConfigNotSetException
import com.joinforage.forage.android.core.ForageSDKInterface
import com.joinforage.forage.android.core.TokenizeEBTCardParams
import com.joinforage.forage.android.core.services.EnvConfig
import com.joinforage.forage.android.core.ui.element.state.ElementState
import com.joinforage.forage.android.core.services.telemetry.CustomerPerceivedResponseMonitor
import com.joinforage.forage.android.core.services.telemetry.EventOutcome
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.telemetry.UserAction
import com.joinforage.forage.android.core.services.forageapi.encryptkey.EncryptionKeyService
import com.joinforage.forage.android.core.services.forageapi.polling.MessageStatusService
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.forageapi.network.OkHttpClientBuilder
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethodService
import com.joinforage.forage.android.core.services.forageapi.payment.PaymentService
import com.joinforage.forage.android.core.services.forageapi.paymentmethod.PaymentMethodService
import com.joinforage.forage.android.core.services.forageapi.polling.MessageStatusService
import com.joinforage.forage.android.core.services.forageapi.polling.PollingService
import com.joinforage.forage.android.core.services.vault.TokenizeCardService
import com.joinforage.forage.android.core.services.telemetry.CustomerPerceivedResponseMonitor
import com.joinforage.forage.android.core.services.telemetry.EventOutcome
import com.joinforage.forage.android.core.services.telemetry.Log
import com.joinforage.forage.android.core.services.telemetry.UserAction
import com.joinforage.forage.android.core.services.vault.CapturePaymentRepository
import com.joinforage.forage.android.core.services.vault.CheckBalanceRepository
import com.joinforage.forage.android.core.services.vault.DeferPaymentCaptureRepository
import com.joinforage.forage.android.core.services.forageapi.network.ForageApiResponse
import com.joinforage.forage.android.core.services.vault.TokenizeCardService
import com.joinforage.forage.android.core.ui.element.AbstractForageElement
import com.joinforage.forage.android.core.ui.element.ForageConfig
import com.joinforage.forage.android.core.ui.element.ForagePinElement
import com.joinforage.forage.android.core.ui.element.state.ElementState
import com.joinforage.forage.android.ecom.ui.ForagePINEditText

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BTResponseParser(btRes: Result<Any?>) : VaultResponseParser {
val resRegExp = BtResponseRegExp(vaultResponse)
return try {
// TODO: add DD metric to track frequency of proxy errors
if(resRegExp.containsProxyError) UnknownErrorApiResponse else null
if (resRegExp.containsProxyError) UnknownErrorApiResponse else null
} catch (_: Exception) {
null
}
Expand All @@ -52,11 +52,12 @@ class BTResponseParser(btRes: Result<Any?>) : VaultResponseParser {
}

private fun parseSuccessfulResponse(vaultResponse: Result<Any?>): ForageApiResponse.Success<String>? {
return if (!isSuccessful) null
else {
return if (!isSuccessful) {
null
} else {
// note: Result.toString() wraps the actual response as
// "Success(<actual-value-here>)"
ForageApiResponse.Success(vaultResponse.getOrNull().toString())
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ open class BaseResponseRegExp(res: Result<Any?>) {
statusCode = null
}
}
}
}
Loading

0 comments on commit d6ea2f8

Please sign in to comment.