Skip to content

Commit

Permalink
0.0.40
Browse files Browse the repository at this point in the history
  • Loading branch information
PaysafeAutoCommitter committed Aug 1, 2024
1 parent afc8316 commit dbb3977
Show file tree
Hide file tree
Showing 69 changed files with 497 additions and 312 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.paysafe.android.hostedfields.PSCardFormController
import com.paysafe.android.hostedfields.domain.model.PSCardTokenizeOptions
import com.paysafe.android.tokenization.domain.model.paymentHandle.BillingDetails
import com.paysafe.android.tokenization.domain.model.paymentHandle.MerchantDescriptor
import com.paysafe.android.tokenization.domain.model.paymentHandle.RenderType
import com.paysafe.android.hostedfields.domain.model.RenderType
import com.paysafe.android.tokenization.domain.model.paymentHandle.ShippingDetails
import com.paysafe.android.tokenization.domain.model.paymentHandle.ShippingMethod
import com.paysafe.android.tokenization.domain.model.paymentHandle.TransactionType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import com.paysafe.android.hostedfields.PSCardFormController
import com.paysafe.android.hostedfields.domain.model.PSCardTokenizeOptions
import com.paysafe.android.tokenization.domain.model.paymentHandle.BillingDetails
import com.paysafe.android.tokenization.domain.model.paymentHandle.MerchantDescriptor
import com.paysafe.android.tokenization.domain.model.paymentHandle.RenderType
import com.paysafe.android.hostedfields.domain.model.RenderType
import com.paysafe.android.tokenization.domain.model.paymentHandle.ShippingDetails
import com.paysafe.android.tokenization.domain.model.paymentHandle.ShippingMethod
import com.paysafe.android.tokenization.domain.model.paymentHandle.TransactionType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class FragmentSelectPaymentMethod : Fragment() {
shippingDetails = provideShippingDetails(),
customUrlScheme = "customScheme",
venmoRequest = VenmoRequest(
consumerId = "ala-bala-portocala",
consumerId = "ala-bala-portocalaaaa",
merchantAccountId = "",
profileId = ""
)
Expand Down
5 changes: 3 additions & 2 deletions example/src/main/java/com/paysafe/example/util/Consts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import com.paysafe.android.core.domain.model.config.PSEnvironment

object Consts {
const val MERCHANT_BACKEND_API_KEY = ""
const val API_KEY = "T1QtOTE0MzAwOkItcWEyLTAtNjNjODRkYjktMS0zMDJjMDIxNDQ5NzM5NTI4YmIyMWM4NWFjZWRjZWJkMmI0ODI2MjIzZjEzODcxZWEwMjE0MmE0NjQxYTU4Zjk5OTFlZDlmMDRlMDY5OTRkNTViYzk2MTBiYmZkOQ"
const val API_KEY = ""
const val CARDS_ACCOUNT_ID = ""
const val VENMO_ACCOUNT_ID = "1002723680"
const val PAYPAL_ACCOUNT_ID = ""
const val VENMO_ACCOUNT_ID = ""
const val PROFILE_ID = ""

val environment: PSEnvironment = PSEnvironment.TEST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,8 @@ internal class PSGooglePayController internal constructor(

lifecycleScope.launchCatching(ioDispatcher) {
val paymentHandle = tokenizationService.tokenize(
googlePayTokenizeOptions.toPaymentHandleRequest(googlePayToken)
googlePayTokenizeOptions.toPaymentHandleRequest(googlePayToken),
null
).value()!!
tokenizationAlreadyInProgress = false

Expand Down
2 changes: 1 addition & 1 deletion gradle.deps
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4c427d9a9f1e238319dfb96fd530a0fb7d01bc6e5f1c51bb472bbd2e8b643569942bcf9dc162822cc0af40f8a07d0d230a90226b820f6b23c2d13da5d1fcf235f0ae8773e4774fe8420422388447df55dfec33cffda4e8d9dba826d7e850a0b48713b45fa8f0087c14953db48edb1157e236608ff2cf001829d70d48397ef23687ecdc56137f108f5e9153e376e1434ffb7d679d64279fbd54517400f5093e847f7518753b135d812f778517e930c7d9
4c427d9a9f1e238319dfb96fd530a0fb7d01bc6e5f1c51bb472bbd2e8b643569942bcf9dc162822cc0af40f8a07d0d230a90226b820f6b23c2d13da5d1fcf23590733f16246b3d0213ec710a599c616adfec33cffda4e8d9dba826d7e850a0b48713b45fa8f0087c14953db48edb1157e236608ff2cf001829d70d48397ef23687ecdc56137f108f5e9153e376e1434f1c020b3e5d6d8b61c3bcac45f7a2fb7d7f7518753b135d812f778517e930c7d9
3 changes: 3 additions & 0 deletions hosted-fields/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ android {

dependencies {
api(project(":tokenization"))
implementation(project(":threedsecure"))
implementation ("org.jetbrains.kotlin:kotlin-reflect:1.9.0")

val platformComposeBom = platform(Compose.bom)

Expand All @@ -106,6 +108,7 @@ dependencies {
implementation(Jetpack.testJUnit)
implementation(Jetpack.lifecycleLiveData)


// Debugging
debugImplementation(Compose.uiTooling)
debugImplementation(Compose.uiTestManifest)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package com.paysafe.android.hostedfields.cardnumber
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.input.OffsetMapping
import com.paysafe.android.hostedfields.model.CardNumberSeparator
import com.paysafe.android.hostedfields.domain.model.CardNumberSeparator
import com.paysafe.android.hostedfields.valid.CardNumberChecks.Companion.MAX_CHARS_FOR_AMEX_CARD
import com.paysafe.android.hostedfields.valid.CardNumberChecks.Companion.MAX_CHARS_FOR_CARD_NUMBERS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.MutableLiveData
import com.paysafe.android.hostedfields.PSTheme
import com.paysafe.android.hostedfields.R
import com.paysafe.android.hostedfields.model.CardNumberSeparator
import com.paysafe.android.hostedfields.domain.model.CardNumberSeparator
import com.paysafe.android.hostedfields.domain.model.PSCardFieldInputEvent
import com.paysafe.android.hostedfields.domain.model.PSCardNumberState
import com.paysafe.android.hostedfields.domain.model.PSCardNumberStateImpl

import com.paysafe.android.hostedfields.model.DefaultPSCardFieldEventHandler
import com.paysafe.android.hostedfields.model.PSCardFieldEventHandler
import com.paysafe.android.hostedfields.model.PSCardFieldInputEvent
import com.paysafe.android.hostedfields.model.PSCardNumberState
import com.paysafe.android.hostedfields.model.PSCardNumberStateImpl

import com.paysafe.android.hostedfields.provideDefaultPSTheme
import com.paysafe.android.hostedfields.util.CardPreview
import com.paysafe.android.hostedfields.util.PS_CARD_NUMBER_TEST_TAG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import com.paysafe.android.hostedfields.PSTheme
import com.paysafe.android.hostedfields.cvv.PSCvvView
import com.paysafe.android.hostedfields.model.CardNumberSeparator
import com.paysafe.android.hostedfields.domain.model.CardNumberSeparator
import com.paysafe.android.hostedfields.domain.model.PSCardNumberState

import com.paysafe.android.hostedfields.model.PSCardFieldEventHandler
import com.paysafe.android.hostedfields.model.PSCardFieldInputEvent
import com.paysafe.android.hostedfields.model.PSCardNumberState

import com.paysafe.android.hostedfields.util.PS_CARD_NUMBER_NO_ANIM_LABEL_TEST_TAG
import com.paysafe.android.hostedfields.util.TextLabelReplacement
import com.paysafe.android.hostedfields.util.WrapperToAvoidPaste
Expand All @@ -37,7 +38,6 @@ import com.paysafe.android.hostedfields.util.rememberCardNumberState
* @param placeholderText Helper placeholder shown inside [OutlinedTextField].
* @param animateTopLabelText If 'true' it will show the default animation for [OutlinedTextField], otherwise the label will remain in place.
* @param cardNumberLiveData Live data to store credit card type, bundled with [PSCvvView] and if card number is valid.
* @param onEvent Callback function that reacts to several [PSCardFieldInputEvent].
*/
@OptIn(ExperimentalComposeUiApi::class)
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.distinctUntilChanged
import com.paysafe.android.hostedfields.R
import com.paysafe.android.hostedfields.model.CardNumberSeparator
import com.paysafe.android.hostedfields.domain.model.CardNumberSeparator
import com.paysafe.android.hostedfields.domain.model.PSCardNumberStateImpl

import com.paysafe.android.hostedfields.model.DefaultPSCardFieldEventHandler
import com.paysafe.android.hostedfields.model.PSCardNumberStateImpl

import com.paysafe.android.hostedfields.valid.CardNumberChecks
import com.paysafe.android.hostedfields.view.PSCardView
import com.paysafe.android.paymentmethods.domain.model.PSCreditCardType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.MutableLiveData
import com.paysafe.android.hostedfields.PSTheme
import com.paysafe.android.hostedfields.R
import com.paysafe.android.hostedfields.domain.model.PSCardFieldInputEvent
import com.paysafe.android.hostedfields.domain.model.PSCvvState
import com.paysafe.android.hostedfields.domain.model.PSCvvStateImpl
import com.paysafe.android.hostedfields.model.DefaultPSCardFieldEventHandler
import com.paysafe.android.hostedfields.model.PSCardFieldEventHandler
import com.paysafe.android.hostedfields.model.PSCardFieldInputEvent
import com.paysafe.android.hostedfields.model.PSCvvState
import com.paysafe.android.hostedfields.model.PSCvvStateImpl

import com.paysafe.android.hostedfields.provideDefaultPSTheme
import com.paysafe.android.hostedfields.util.CardPreview
import com.paysafe.android.hostedfields.util.PS_CVV_TEST_TAG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.paysafe.android.hostedfields.PSTheme
import com.paysafe.android.hostedfields.domain.model.PSCvvState
import com.paysafe.android.hostedfields.model.PSCardFieldEventHandler
import com.paysafe.android.hostedfields.model.PSCardFieldInputEvent
import com.paysafe.android.hostedfields.model.PSCvvState
import com.paysafe.android.hostedfields.util.PS_CVV_NO_ANIM_LABEL_TEST_TAG
import com.paysafe.android.hostedfields.util.TextLabelReplacement
import com.paysafe.android.hostedfields.util.WrapperToAvoidPaste
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import androidx.compose.ui.platform.AbstractComposeView
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.paysafe.android.hostedfields.R
import com.paysafe.android.hostedfields.domain.model.PSCvvStateImpl
import com.paysafe.android.hostedfields.model.DefaultPSCardFieldEventHandler
import com.paysafe.android.hostedfields.model.PSCvvStateImpl
import com.paysafe.android.hostedfields.valid.CvvChecks
import com.paysafe.android.hostedfields.view.PSCardView
import com.paysafe.android.paymentmethods.domain.model.PSCreditCardType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
* Copyright (c) 2024 Paysafe Group
*/

package com.paysafe.android.tokenization.data.api
package com.paysafe.android.hostedfields.data.api

import com.paysafe.android.core.data.api.PaysafeApi
import com.paysafe.android.core.data.api.withBody
import com.paysafe.android.core.data.entity.PSApiRequest
import com.paysafe.android.core.data.entity.PSApiRequestType
import com.paysafe.android.core.domain.service.PSHttpClient
import com.paysafe.android.tokenization.data.entity.cardadapter.AuthenticationRequestSerializable
import com.paysafe.android.tokenization.data.entity.cardadapter.AuthenticationResponseSerializable
import com.paysafe.android.tokenization.data.entity.cardadapter.FinalizeAuthenticationResponseSerializable
import com.paysafe.android.hostedfields.data.entity.cardAdapter.AuthenticationRequestSerializable
import com.paysafe.android.hostedfields.data.entity.cardAdapter.AuthenticationResponseSerializable
import com.paysafe.android.hostedfields.data.entity.cardAdapter.FinalizeAuthenticationResponseSerializable


internal class CardAdapterAuthApi(httpClient: PSHttpClient) : PaysafeApi(httpClient) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2024 Paysafe Group
*/

package com.paysafe.android.tokenization.data.entity.cardadapter
package com.paysafe.android.hostedfields.data.entity.cardAdapter


import kotlinx.serialization.SerialName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2024 Paysafe Group
*/

package com.paysafe.android.tokenization.data.entity.cardadapter
package com.paysafe.android.hostedfields.data.entity.cardAdapter

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2024 Paysafe Group
*/

package com.paysafe.android.tokenization.data.entity.cardadapter
package com.paysafe.android.hostedfields.data.entity.cardAdapter


import kotlinx.serialization.SerialName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
* Copyright (c) 2024 Paysafe Group
*/

package com.paysafe.android.tokenization.data.mapper
package com.paysafe.android.hostedfields.data.mapper

import com.paysafe.android.tokenization.data.entity.cardadapter.AuthenticationRequestSerializable
import com.paysafe.android.tokenization.domain.model.cardadapter.AuthenticationRequest
import com.paysafe.android.hostedfields.domain.model.cardadapter.AuthenticationRequest

internal fun AuthenticationRequest.toData(
deviceFingerprintingId: String
) = AuthenticationRequestSerializable(
) = com.paysafe.android.hostedfields.data.entity.cardAdapter.AuthenticationRequestSerializable(
deviceFingerprintingId = deviceFingerprintingId,
merchantRefNum = merchantRefNum,
process = process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Copyright (c) 2024 Paysafe Group
*/

package com.paysafe.android.tokenization.data.mapper
package com.paysafe.android.hostedfields.data.mapper

import com.paysafe.android.tokenization.data.entity.cardadapter.AuthenticationResponseSerializable
import com.paysafe.android.tokenization.data.entity.cardadapter.FinalizeAuthenticationResponseSerializable
import com.paysafe.android.tokenization.domain.model.cardadapter.AuthenticationResponse
import com.paysafe.android.hostedfields.data.entity.cardAdapter.AuthenticationResponseSerializable
import com.paysafe.android.hostedfields.data.entity.cardAdapter.FinalizeAuthenticationResponseSerializable
import com.paysafe.android.hostedfields.domain.model.cardadapter.AuthenticationResponse
import com.paysafe.android.hostedfields.domain.model.cardadapter.FinalizeAuthenticationResponse
import com.paysafe.android.tokenization.domain.model.cardadapter.AuthenticationStatus
import com.paysafe.android.tokenization.domain.model.cardadapter.FinalizeAuthenticationResponse

internal fun AuthenticationResponseSerializable.toDomain() = AuthenticationResponse(
sdkChallengePayload = sdkChallengePayload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
* Copyright (c) 2024 Paysafe Group
*/

package com.paysafe.android.tokenization.data.repository
package com.paysafe.android.hostedfields.data.repository

import com.paysafe.android.core.data.entity.PSResult
import com.paysafe.android.core.data.service.PSApiClient
import com.paysafe.android.tokenization.data.api.CardAdapterAuthApi
import com.paysafe.android.tokenization.data.mapper.toData
import com.paysafe.android.tokenization.data.mapper.toDomain
import com.paysafe.android.tokenization.domain.model.cardadapter.AuthenticationRequest
import com.paysafe.android.tokenization.domain.model.cardadapter.AuthenticationResponse
import com.paysafe.android.tokenization.domain.model.cardadapter.FinalizeAuthenticationResponse
import com.paysafe.android.tokenization.domain.repository.CardAdapterAuthRepository
import com.paysafe.android.tokenization.exception.errorName
import com.paysafe.android.tokenization.exception.genericApiErrorException
import com.paysafe.android.hostedfields.data.api.CardAdapterAuthApi
import com.paysafe.android.hostedfields.data.mapper.toData
import com.paysafe.android.hostedfields.data.mapper.toDomain
import com.paysafe.android.hostedfields.domain.model.cardadapter.AuthenticationRequest
import com.paysafe.android.hostedfields.domain.model.cardadapter.AuthenticationResponse
import com.paysafe.android.hostedfields.domain.model.cardadapter.FinalizeAuthenticationResponse
import com.paysafe.android.hostedfields.domain.repository.CardAdapterAuthRepository
import com.paysafe.android.hostedfields.exception.errorName
import com.paysafe.android.hostedfields.exception.genericApiErrorException



internal class CardAdapterAuthRepositoryImpl(
private val cardAdapterAuthApi: CardAdapterAuthApi,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,43 @@
package com.paysafe.android.hostedfields.domain.mapper

import com.paysafe.android.hostedfields.domain.model.PSCardTokenizeOptions
import com.paysafe.android.hostedfields.domain.model.PaymentHandleRequestWithRenderType
import com.paysafe.android.tokenization.domain.model.paymentHandle.PaymentHandleRequest
import com.paysafe.android.tokenization.domain.model.paymentHandle.PaymentType

internal fun PSCardTokenizeOptions.toPaymentHandleRequest() = PaymentHandleRequest(
amount = amount,
currencyCode = currencyCode,
transactionType = transactionType,
merchantRefNum = merchantRefNum,
billingDetails = billingDetails,
profile = profile,
accountId = accountId,
merchantDescriptor = merchantDescriptor,
shippingDetails = shippingDetails,
paymentType = PaymentType.CARD,
singleUseCustomerToken = singleUseCustomerToken,
paymentHandleTokenFrom = paymentHandleTokenFrom,
renderType = renderType,
simulatorType = simulator,
threeDS = threeDS
)
internal fun PSCardTokenizeOptions.toPaymentHandleRequestWithRenderType() =
PaymentHandleRequestWithRenderType(
amount = amount,
currencyCode = currencyCode,
transactionType = transactionType,
merchantRefNum = merchantRefNum,
billingDetails = billingDetails,
profile = profile,
accountId = accountId,
merchantDescriptor = merchantDescriptor,
shippingDetails = shippingDetails,
paymentType = PaymentType.CARD,
singleUseCustomerToken = singleUseCustomerToken,
paymentHandleTokenFrom = paymentHandleTokenFrom,
renderType = renderType,
simulatorType = simulator,
threeDS = threeDS
)

internal fun PSCardTokenizeOptions.toPaymentHandleRequest() =
PaymentHandleRequest(
amount = amount,
currencyCode = currencyCode,
transactionType = transactionType,
merchantRefNum = merchantRefNum,
billingDetails = billingDetails,
profile = profile,
accountId = accountId,
merchantDescriptor = merchantDescriptor,
shippingDetails = shippingDetails,
paymentType = PaymentType.CARD,
singleUseCustomerToken = singleUseCustomerToken,
paymentHandleTokenFrom = paymentHandleTokenFrom,
simulatorType = simulator,
threeDS = threeDS
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2024 Paysafe Group
*/

package com.paysafe.android.hostedfields.model
package com.paysafe.android.hostedfields.domain.model

enum class CardNumberSeparator(val id: Int) {
WHITESPACE(0),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.paysafe.android.hostedfields.model

import androidx.lifecycle.MutableLiveData
import com.paysafe.android.hostedfields.domain.model.PSCardFieldInputEvent

fun interface PSCardFieldEventHandler {
fun handleEvent(event: PSCardFieldInputEvent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2024 Paysafe Group
*/

package com.paysafe.android.hostedfields.model
package com.paysafe.android.hostedfields.domain.model

enum class PSCardFieldInputEvent {
FOCUS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2024 Paysafe Group
*/

package com.paysafe.android.hostedfields.model
package com.paysafe.android.hostedfields.domain.model

import androidx.compose.runtime.Stable
import com.paysafe.android.paymentmethods.domain.model.PSCreditCardType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2024 Paysafe Group
*/

package com.paysafe.android.hostedfields.model
package com.paysafe.android.hostedfields.domain.model

import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down
Loading

0 comments on commit dbb3977

Please sign in to comment.