Skip to content

Commit

Permalink
Drop all pos related code from public ecom repo
Browse files Browse the repository at this point in the history
We want the private pos repo and the public ecom repo to have the
ability to evolve separately accordingly their unique needs while
still sharing common code. The first step in this journey is to
make the public ecom repo completely unaware of the existence of
the private pos repo. We do that by deleting all of the pos code

Signed-off-by: Devin Morgan <[email protected]>

pos related files to delete

Signed-off-by: Devin Morgan <[email protected]>

Remove real sandbox creds from sample app

Signed-off-by: Devin Morgan <[email protected]>
  • Loading branch information
devinmorgan committed May 2, 2024
1 parent 6fdbaa2 commit 219ce40
Show file tree
Hide file tree
Showing 90 changed files with 17 additions and 7,247 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import com.joinforage.forage.android.network.data.CheckBalanceRepository
import com.joinforage.forage.android.network.data.DeferPaymentCaptureRepository
import com.joinforage.forage.android.network.data.DeferPaymentRefundRepository
import com.joinforage.forage.android.network.model.ForageApiResponse
import com.joinforage.forage.android.pos.PosRefundPaymentRepository
import com.joinforage.forage.android.pos.PosRefundService
import com.joinforage.forage.android.ui.AbstractForageElement
import com.joinforage.forage.android.ui.ForageConfig
import com.joinforage.forage.android.ui.ForagePINEditText
Expand Down Expand Up @@ -447,7 +445,6 @@ class ForageSDK : ForageSDKInterface {
private val paymentService by lazy { createPaymentService() }
private val messageStatusService by lazy { createMessageStatusService() }
private val pollingService by lazy { createPollingService() }
private val posRefundService by lazy { PosRefundService(config.apiBaseUrl, logger, okHttpClient) }

open fun createTokenizeCardService() = TokenizeCardService(
config.apiBaseUrl,
Expand Down Expand Up @@ -494,18 +491,6 @@ class ForageSDK : ForageSDKInterface {
)
}

open fun createRefundPaymentRepository(foragePinEditText: ForagePINEditText): PosRefundPaymentRepository {
return PosRefundPaymentRepository(
vaultSubmitter = createVaultSubmitter(foragePinEditText),
encryptionKeyService = encryptionKeyService,
paymentMethodService = paymentMethodService,
paymentService = paymentService,
pollingService = pollingService,
logger = logger,
refundService = posRefundService
)
}

private fun createVaultSubmitter(foragePinEditText: ForagePINEditText) = AbstractVaultSubmitter.create(
foragePinEditText = foragePinEditText,
logger = logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,3 @@ internal fun TypedArray.getBoxCornerRadius(styleIndex: Int, defaultBoxCornerRadi
val styledBoxCornerRadius = getDimension(styleIndex, 0f)
return if (styledBoxCornerRadius == 0f) defaultBoxCornerRadius else styledBoxCornerRadius
}

// This extension splits the path by "/" and adds each segment individually to the path.
// This is to prevent the URL from getting corrupted through internal OKHttp URL encoding.
internal fun HttpUrl.Builder.addPathSegmentsSafe(path: String): HttpUrl.Builder {
path.split("/").forEach { segment ->
if (segment.isNotEmpty()) {
this.addPathSegment(segment)
}
}
return this
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.joinforage.forage.android.network.model.ForageApiResponse
import com.joinforage.forage.android.network.model.ForageError
import com.joinforage.forage.android.network.model.PaymentMethodRequestBody
import com.joinforage.forage.android.network.model.RequestBody
import com.joinforage.forage.android.pos.PosPaymentMethodRequestBody
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.MediaType.Companion.toMediaTypeOrNull
Expand Down Expand Up @@ -39,19 +38,6 @@ internal class TokenizeCardService(
ForageApiResponse.Failure(listOf(ForageError(500, "unknown_server_error", ex.message.orEmpty())))
}

suspend fun tokenizePosCard(track2Data: String, reusable: Boolean = true): ForageApiResponse<String> = try {
logger.i("[POS] POST request for Payment Method with Track 2 data")
tokenizeCardCoroutine(
PosPaymentMethodRequestBody(
track2Data = track2Data,
reusable = reusable
)
)
} catch (ex: IOException) {
logger.e("[POS] Failed while tokenizing PaymentMethod", ex)
ForageApiResponse.Failure(listOf(ForageError(500, "unknown_server_error", ex.message.orEmpty())))
}

private suspend fun tokenizeCardCoroutine(requestBody: RequestBody): ForageApiResponse<String> {
val url = getTokenizeCardUrl()
val okHttpRequestBody = requestBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.joinforage.forage.android.network.PaymentMethodService
import com.joinforage.forage.android.network.PollingService
import com.joinforage.forage.android.network.model.ForageApiResponse
import com.joinforage.forage.android.network.model.Message
import com.joinforage.forage.android.pos.PosBalanceVaultSubmitterParams
import com.joinforage.forage.android.vault.AbstractVaultSubmitter
import com.joinforage.forage.android.vault.VaultSubmitter
import com.joinforage.forage.android.vault.VaultSubmitterParams
Expand Down Expand Up @@ -71,30 +70,6 @@ internal class CheckBalanceRepository(
}
}

suspend fun posCheckBalance(
merchantId: String,
paymentMethodRef: String,
posTerminalId: String,
sessionToken: String
): ForageApiResponse<String> {
return checkBalance(
merchantId = merchantId,
paymentMethodRef = paymentMethodRef,
sessionToken = sessionToken,
getVaultRequestParams = { encryptionKeys, paymentMethod ->
PosBalanceVaultSubmitterParams(
baseVaultSubmitterParams = buildVaultRequestParams(
merchantId = merchantId,
encryptionKeys = encryptionKeys,
paymentMethod = paymentMethod,
sessionToken = sessionToken
),
posTerminalId = posTerminalId
)
}
)
}

private fun buildVaultRequestParams(
merchantId: String,
encryptionKeys: EncryptionKeys,
Expand Down

This file was deleted.

Loading

0 comments on commit 219ce40

Please sign in to comment.