Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ class CardPaymentTest {
.edit()
.apply {
putString("judo_id", BuildConfig.JUDO_ID)
putString("challengeRequestIndicator", "CHALLENGE_AS_MANDATE")
putString("challenge_request_indicator", "CHALLENGE_AS_MANDATE")
putBoolean("is_payment_session_enabled", false)
putString("token", BuildConfig.API_TEST_TOKEN)
putString("secret", BuildConfig.API_TEST_SECRET)
putString("amount", "0.15")
putString("currency", "GBP")
putBoolean("should_ask_for_csc", false)
putBoolean("is_recommendation_feature_enabled", false)
putBoolean("is_recommendation_enabled", false)
}.commit()
}

Expand Down Expand Up @@ -391,7 +391,7 @@ class CardPaymentTest {
sharedPrefs
.edit()
.apply {
putString("challengeRequestIndicator", CHALLENGE_NO_PREFERENCE)
putString("challenge_request_indicator", CHALLENGE_NO_PREFERENCE)
}.commit()

onView(withText(PAY_WITH_CARD_LABEL))
Expand All @@ -417,7 +417,7 @@ class CardPaymentTest {
sharedPrefs
.edit()
.apply {
putString("challengeRequestIndicator", CHALLENGE_NO_PREFERENCE)
putString("challenge_request_indicator", CHALLENGE_NO_PREFERENCE)
}.commit()

onView(withText(PAY_WITH_CARD_LABEL))
Expand All @@ -443,7 +443,7 @@ class CardPaymentTest {
sharedPrefs
.edit()
.apply {
putString("challengeRequestIndicator", CHALLENGE_NO_PREFERENCE)
putString("challenge_request_indicator", CHALLENGE_NO_PREFERENCE)
}.commit()

onView(withText(PAY_WITH_CARD_LABEL))
Expand Down Expand Up @@ -851,8 +851,8 @@ class CardPaymentTest {
sharedPrefs
.edit()
.apply {
putString("challengeRequestIndicator", CHALLENGE_NO_PREFERENCE)
putString("scaExemption", SCA_LOW_VALUE)
putString("challenge_request_indicator", CHALLENGE_NO_PREFERENCE)
putString("sca_exemption", SCA_LOW_VALUE)
}.commit()
onView(withText(PAY_WITH_CARD_LABEL))
.perform(click())
Expand Down Expand Up @@ -880,8 +880,8 @@ class CardPaymentTest {
sharedPrefs
.edit()
.apply {
putString("challengeRequestIndicator", CHALLENGE_NO_PREFERENCE)
putString("scaExemption", SCA_LOW_VALUE)
putString("challenge_request_indicator", CHALLENGE_NO_PREFERENCE)
putString("sca_exemption", SCA_LOW_VALUE)
}.commit()
onView(withText(PREAUTH_WITH_CARD_LABEL))
.perform(click())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class RavelinIntegrationTest {
putString("amount", "0.15")
putString("currency", "GBP")
putBoolean("should_ask`_for_csc", false)
putBoolean("is_recommendation_feature_enabled", true)
putBoolean("is_recommendation_enabled", true)
putString("rsa_key", BuildConfig.RSA_KEY)
putStringSet("payment_methods", setOf("CARD"))
putBoolean("is_address_enabled", false)
Expand Down Expand Up @@ -233,8 +233,8 @@ class RavelinIntegrationTest {
sharedPrefs
.edit()
.apply {
putString("challengeRequestIndicator", "DON_T_SET")
putString("scaExemption", "DON_T_SET")
putString("challenge_request_indicator", "DON_T_SET")
putString("sca_exemption", "DON_T_SET")
}.commit()

updateRecommendationUrlWith("71")
Expand Down Expand Up @@ -265,9 +265,9 @@ class RavelinIntegrationTest {
sharedPrefs
.edit()
.apply {
putString("challengeRequestIndicator", "CHALLENGE_AS_MANDATE")
putString("scaExemption", "TRANSACTION_RISK_ANALYSIS")
putBoolean("halt_transaction_in_case_of_any_error_enabled", false)
putString("challenge_request_indicator", "CHALLENGE_AS_MANDATE")
putString("sca_exemption", "TRANSACTION_RISK_ANALYSIS")
putBoolean("is_recommendation_halt_transaction_enabled", false)
}.commit()

onView(withText(PAY_WITH_CARD_LABEL))
Expand Down Expand Up @@ -319,7 +319,7 @@ class RavelinIntegrationTest {
sharedPrefs
.edit()
.apply {
putBoolean("halt_transaction_in_case_of_any_error_enabled", true)
putBoolean("is_recommendation_halt_transaction_enabled", true)
}.commit()

updateRecommendationUrlWith("5")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
}
}

fun fetchTransactionDetails(receiptId: String) {

Check failure on line 148 in judokit-android-examples/src/main/java/com/judokit/android/examples/feature/DemoFeatureListViewModel.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=Judopay_JudoKit-Android&issues=AZ7RCa52r2vl7tQObsHo&open=AZ7RCa52r2vl7tQObsHo&pullRequest=351
val judo = currentJudo ?: return
viewModelScope.launch {
try {
Expand Down Expand Up @@ -212,13 +212,13 @@
val initialRecurringPayment = prefs.getBoolean("is_initial_recurring_payment", false)
val delayedAuthorisation = prefs.getBoolean("is_delayed_authorisation_on", false)
val allowIncrement = prefs.getBoolean("is_allow_increment_on", false)
val mobileNumber = prefs.getString("mobile_number", null)
val phoneCountryCode = prefs.getString("phone_country_code", null)
val emailAddress = prefs.getString("email_address", null)
val challengeRequestIndicator = parseEnumPref<ChallengeRequestIndicator>("challengeRequestIndicator")
val scaExemption = parseEnumPref<ScaExemption>("scaExemption")
val threeDSTwoMaxTimeout = prefs.getString("threeDSTwoMaxTimeout", null)?.toInt()
val messageVersion = prefs.getString("threeDSTwoMessageVersion", null)
val mobileNumber = prefs.getString("address_mobile_number", null)
val phoneCountryCode = prefs.getString("address_phone_country_code", null)
val emailAddress = prefs.getString("address_email_address", null)
val challengeRequestIndicator = parseEnumPref<ChallengeRequestIndicator>("challenge_request_indicator")
val scaExemption = parseEnumPref<ScaExemption>("sca_exemption")
val threeDSTwoMaxTimeout = prefs.getString("three_ds_two_max_timeout", null)?.toInt()
val messageVersion = prefs.getString("three_ds_two_message_version", null)
val isDisableNetworkTokenisationOn = prefs.getBoolean("is_disable_network_tokenisation_on", false)

val extras =
Expand Down Expand Up @@ -369,13 +369,13 @@

private val recommendationConfiguration: RecommendationConfiguration?
get() {
if (!prefs.getBoolean("is_recommendation_feature_enabled", false)) return null
if (!prefs.getBoolean("is_recommendation_enabled", false)) return null
return RecommendationConfiguration
.Builder()
.setRsaPublicKey(prefs.getString("rsa_key", null))
.setUrl(prefs.getString("recommendation_url", null))
.setTimeout(prefs.getString("recommendation_timeout", null)?.toInt())
.setShouldHaltTransactionInCaseOfAnyError(prefs.getBoolean("halt_transaction_in_case_of_any_error_enabled", false))
.setShouldHaltTransactionInCaseOfAnyError(prefs.getBoolean("is_recommendation_halt_transaction_enabled", false))
.build()
}

Expand All @@ -386,7 +386,7 @@
UiConfiguration
.Builder()
.setAvsEnabled(prefs.getBoolean("is_avs_enabled", false))
.setShouldPaymentMethodsDisplayAmount(prefs.getBoolean("should_display_amount", true))
.setShouldPaymentMethodsDisplayAmount(prefs.getBoolean("should_payment_methods_display_amount", true))
.setShouldPaymentMethodsVerifySecurityCode(prefs.getBoolean("should_payment_methods_verify_security_code", true))
.setShouldAskForCSC(prefs.getBoolean("should_ask_for_csc", false))
.setShouldAskForCardholderName(prefs.getBoolean("should_ask_for_cardholder_name", false))
Expand Down Expand Up @@ -416,7 +416,7 @@
val billingAddressParams =
if (isBillingAddressRequired) {
GooglePayBillingAddressParameters(
format = GooglePayAddressFormat.valueOf(billingAddress ?: "FULL"),

Check warning on line 419 in judokit-android-examples/src/main/java/com/judokit/android/examples/feature/DemoFeatureListViewModel.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this useless elvis operation ?:, it always succeeds.

See more on https://sonarcloud.io/project/issues?id=Judopay_JudoKit-Android&issues=AZ7RCa52r2vl7tQObsHm&open=AZ7RCa52r2vl7tQObsHm&pullRequest=351
phoneNumberRequired = prefs.getBoolean("is_billing_address_phone_number_required", false),
)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ object SettingsImporter {
),
"recommendation" to
listOf(
"is_recommendation_feature_enabled",
"is_recommendation_enabled",
"recommendation_url",
"rsa_key",
"recommendation_timeout",
"halt_transaction_in_case_of_any_error_enabled",
"is_recommendation_halt_transaction_enabled",
),
"three_ds" to
listOf(
"should_ask_for_billing_information",
"challengeRequestIndicator",
"scaExemption",
"threeDSTwoMaxTimeout",
"challenge_request_indicator",
"sca_exemption",
"three_ds_two_max_timeout",
"connect_timeout",
"read_timeout",
"write_timeout",
"threeDSTwoMessageVersion",
"three_ds_two_message_version",
),
"three_ds_ui_customisation" to
listOf(
Expand Down Expand Up @@ -105,9 +105,9 @@ object SettingsImporter {
"address_billing_country",
"address_country_code",
"address_administrative_division",
"phone_country_code",
"mobile_number",
"email_address",
"address_phone_country_code",
"address_mobile_number",
"address_email_address",
),
"primary_account" to
listOf(
Expand Down Expand Up @@ -139,7 +139,7 @@ object SettingsImporter {
listOf(
"is_avs_enabled",
"should_payment_methods_verify_security_code",
"should_display_amount",
"should_payment_methods_display_amount",
"should_payment_button_display_amount",
"is_initial_recurring_payment",
"is_delayed_authorisation_on",
Expand Down
28 changes: 14 additions & 14 deletions judokit-android-examples/src/main/res/xml/root_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,37 +78,37 @@
<SwitchPreference
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="is_recommendation_feature_enabled"
app:key="is_recommendation_enabled"
app:summary="@string/is_recommendation_feature_enabled_summary"
app:title="@string/is_recommendation_feature_encryption_enabled_title" />

<EditTextPreference
app:dependency="is_recommendation_feature_enabled"
app:dependency="is_recommendation_enabled"
app:iconSpaceReserved="false"
app:key="recommendation_url"
app:summary="@string/reccomendation_url_key_summary"
app:title="@string/reccomendation_url_title" />

<EditTextPreference
app:dependency="is_recommendation_feature_enabled"
app:dependency="is_recommendation_enabled"
app:iconSpaceReserved="false"
app:key="rsa_key"
app:summary="@string/rsa_key_summary"
app:title="@string/rsa_key_title" />

<EditTextPreference
app:dependency="is_recommendation_feature_enabled"
app:dependency="is_recommendation_enabled"
app:defaultValue="30"
app:iconSpaceReserved="false"
app:key="recommendation_timeout"
app:summary="@string/recommendation_timeout_summary"
app:title="@string/recommendation_timeout_title" />

<SwitchPreference
app:dependency="is_recommendation_feature_enabled"
app:dependency="is_recommendation_enabled"
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="halt_transaction_in_case_of_any_error_enabled"
app:key="is_recommendation_halt_transaction_enabled"
app:summary="@string/recommendation_halt_transaction_in_case_of_any_error_summary"
app:title="@string/recommendation_halt_transaction_in_case_of_any_error_title" />

Expand All @@ -130,7 +130,7 @@
app:entries="@array/three_ds_two_challenge_request_indicator_entries"
app:entryValues="@array/three_ds_two_challenge_request_indicator_values"
app:iconSpaceReserved="false"
app:key="challengeRequestIndicator"
app:key="challenge_request_indicator"
app:summary="@string/challenge_request_indicator_summary"
app:title="@string/challenge_request_indicator_title"
app:useSimpleSummaryProvider="true" />
Expand All @@ -140,15 +140,15 @@
app:entries="@array/three_ds_two_sca_exemption_entries"
app:entryValues="@array/three_ds_two_sca_exemption_values"
app:iconSpaceReserved="false"
app:key="scaExemption"
app:key="sca_exemption"
app:summary="@string/sca_exemption_summary"
app:title="@string/sca_exemption_title"
app:useSimpleSummaryProvider="true" />

<EditTextPreference
app:defaultValue="30"
app:iconSpaceReserved="false"
app:key="threeDSTwoMaxTimeout"
app:key="three_ds_two_max_timeout"
app:summary="@string/three_ds2_max_timeout_summary"
app:title="@string/three_ds2_max_timeout_title"
app:useSimpleSummaryProvider="true" />
Expand All @@ -175,7 +175,7 @@
<EditTextPreference
app:defaultValue=""
app:iconSpaceReserved="false"
app:key="threeDSTwoMessageVersion"
app:key="three_ds_two_message_version"
app:summary="@string/three_ds2_protocol_message_version_summary"
app:title="@string/three_ds2_protocol_message_version_title" />

Expand Down Expand Up @@ -292,7 +292,7 @@
app:defaultValue="44"
app:dependency="is_address_enabled"
app:iconSpaceReserved="false"
app:key="phone_country_code"
app:key="address_phone_country_code"
app:summary="Your phone country code"
app:title="Phone country code"
app:useSimpleSummaryProvider="true" />
Expand All @@ -301,7 +301,7 @@
app:defaultValue="0799999999"
app:dependency="is_address_enabled"
app:iconSpaceReserved="false"
app:key="mobile_number"
app:key="address_mobile_number"
app:summary="Your mobile number"
app:title="Mobile number"
app:useSimpleSummaryProvider="true" />
Expand All @@ -310,7 +310,7 @@
app:defaultValue="email@address.com"
app:dependency="is_address_enabled"
app:iconSpaceReserved="false"
app:key="email_address"
app:key="address_email_address"
app:summary="Your email address"
app:title="Email address"
app:useSimpleSummaryProvider="true" />
Expand Down Expand Up @@ -504,7 +504,7 @@
<SwitchPreference
app:defaultValue="true"
app:iconSpaceReserved="false"
app:key="should_display_amount"
app:key="should_payment_methods_display_amount"
app:summary="@string/should_display_amount_summary"
app:title="@string/should_display_amount_title" />

Expand Down
Loading