- * Using specific amount values will trigger certain failure modes.
- *
- */
- public static final Long PAYMENT_AMOUNT = 10000L;
+ /**
+ * Replace with public key from Hub in Sandbox Environment, testing key for CVV Tokenization
+ */
+ public static final String PUBLIC_KEY_CVV_TOKENIZATION = "pk_6b30805a-1f3b-4c63-8b75-eb3030109173";
+ /**
+ * Replace with Secret key from Hub in Sandbox Environment
+ */
+ public static final String SECRET_KEY = "sk_test_568e6077-a08f-4692-9237-cc6c48dcf6aa";
+ /**
+ * Replace with Success/Failure Urls from Hub in Sandbox Environment
+ */
+ public static final String SUCCESS_URL = "https://httpstat.us/200?q=Success";
+ public static final String FAILURE_URL = "https://httpstat.us/200?q=Failure";
+ /**
+ * The payment amount to used when creating a payment for 3DS authentication.
+ *
+ * Using specific amount values will trigger certain failure modes.
+ *
+ */
+ public static final Long PAYMENT_AMOUNT = 10000L;
+
+
+ public static Long backgroundColor = 0XFFFFCDC2L;
}
diff --git a/app/src/main/java/checkout/checkout_android/viewmodels/CVVTokenizationViewModel.java b/app/src/main/java/checkout/checkout_android/viewmodels/CVVTokenizationViewModel.java
new file mode 100644
index 000000000..92ae29eda
--- /dev/null
+++ b/app/src/main/java/checkout/checkout_android/viewmodels/CVVTokenizationViewModel.java
@@ -0,0 +1,17 @@
+package checkout.checkout_android.viewmodels;
+
+import androidx.lifecycle.MutableLiveData;
+import androidx.lifecycle.ViewModel;
+
+public class CVVTokenizationViewModel extends ViewModel {
+
+ private final MutableLiveData isEnteredAMEXCVVValid = new MutableLiveData<>();
+
+ public MutableLiveData getIsEnteredAMEXCVVValid() {
+ return isEnteredAMEXCVVValid;
+ }
+
+ public void setIsAmexCVVValid(Boolean isCVVValid) {
+ isEnteredAMEXCVVValid.setValue(isCVVValid);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_checkout.xml b/app/src/main/res/layout/activity_checkout.xml
index 971abaffc..4a08aef21 100755
--- a/app/src/main/res/layout/activity_checkout.xml
+++ b/app/src/main/res/layout/activity_checkout.xml
@@ -44,19 +44,29 @@
-
+
+
+
-
+
diff --git a/app/src/main/res/layout/activity_cvv_tokenization.xml b/app/src/main/res/layout/activity_cvv_tokenization.xml
new file mode 100644
index 000000000..6349256bf
--- /dev/null
+++ b/app/src/main/res/layout/activity_cvv_tokenization.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 5f9736678..dd1918445 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -3,6 +3,8 @@
#000#303F9F#FF4081
+ #808080
+ #ffffff#711711#303F9F
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 118739851..92ec9de4d 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -2,5 +2,6 @@
5dp30dp
+ 60dp200dp
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e7c991f6a..fe11fd200 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,4 +1,9 @@
Checkout Frames
- Buy
+ Buy (Card tokenization) -
+ Custom CVV Component (AMEX scheme along with pay button validation)
+ Default CVV Component (unknown scheme along without pay button validation)
+ CVV Tokenization
+ CVV Tokenization
+ Pay
diff --git a/frames/src/main/java/com/checkout/frames/cvvinputfield/api/CVVComponentMediator.kt b/frames/src/main/java/com/checkout/frames/cvvinputfield/api/CVVComponentMediator.kt
index b4c0e6801..244066dcb 100644
--- a/frames/src/main/java/com/checkout/frames/cvvinputfield/api/CVVComponentMediator.kt
+++ b/frames/src/main/java/com/checkout/frames/cvvinputfield/api/CVVComponentMediator.kt
@@ -28,6 +28,15 @@ public interface CVVComponentMediator {
strategy: ViewCompositionStrategy = ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed,
): View
+ /**
+ * To Add CVV Component in XML/Dynamic layouts
+ *
+ * @param container - provide a view container to add cvvComponent
+ */
+ public fun provideCvvComponentContent(
+ container: View,
+ ): View
+
/**
* Creates a CVV token and invokes the provided [resultHandler] with the tokenization result.
*
diff --git a/frames/src/main/java/com/checkout/frames/cvvinputfield/api/InternalCVVComponentMediator.kt b/frames/src/main/java/com/checkout/frames/cvvinputfield/api/InternalCVVComponentMediator.kt
index 8d06fb8a0..8d80ecf45 100644
--- a/frames/src/main/java/com/checkout/frames/cvvinputfield/api/InternalCVVComponentMediator.kt
+++ b/frames/src/main/java/com/checkout/frames/cvvinputfield/api/InternalCVVComponentMediator.kt
@@ -57,6 +57,14 @@ internal class InternalCVVComponentMediator(
setContent { InternalCVVComponent() }
}
+ override fun provideCvvComponentContent(
+ container: View,
+ ): View = ComposeView(container.context).apply {
+ // Dispose of the Composition when the view's LifecycleOwner is destroyed
+ setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
+ setContent { InternalCVVComponent() }
+ }
+
@VisibleForTesting
internal fun getIsCVVComponentCalled() = isCVVComponentCalled
diff --git a/frames/src/main/java/com/checkout/frames/cvvinputfield/models/CVVComponentConfig.kt b/frames/src/main/java/com/checkout/frames/cvvinputfield/models/CVVComponentConfig.kt
index 6558d9880..33e88640d 100644
--- a/frames/src/main/java/com/checkout/frames/cvvinputfield/models/CVVComponentConfig.kt
+++ b/frames/src/main/java/com/checkout/frames/cvvinputfield/models/CVVComponentConfig.kt
@@ -12,7 +12,7 @@ import com.checkout.frames.style.component.base.InputFieldStyle
* So, based on isEnteredCVVValid value developer can decide to hit the tokenization for CVV component
* @param cvvInputFieldStyle - [InputFieldStyle] represent the input-field style for CVV Component
*/
-public data class CVVComponentConfig(
+public data class CVVComponentConfig @JvmOverloads constructor(
public val cardScheme: CardScheme = CardScheme.UNKNOWN,
public val onCVVValueChange: (isEnteredCVVValid: Boolean) -> Unit,
public var cvvInputFieldStyle: InputFieldStyle = DefaultCVVInputFieldStyle.create(),