diff --git a/.github/workflows/AssembleOnMain.yml b/.github/workflows/AssembleOnMain.yml index 86f9492..89420be 100644 --- a/.github/workflows/AssembleOnMain.yml +++ b/.github/workflows/AssembleOnMain.yml @@ -24,4 +24,4 @@ jobs: - name: Get secret and add to freshly created local.properties run: echo ${{ secrets.PAYLIKEMERCHANTAPIKEY }} > local.properties - name: Build APK - run: ./gradlew assemble + run: ./gradlew build diff --git a/README.md b/README.md index f7eb099..2e4ce21 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ - - + + This library includes the high level components providing complete payment forms to use the Paylike ecosystem. @@ -191,7 +191,7 @@ This form provides the simplest implementation of a payment flow. * webView to help TDS and * can receive custom theme definition. -Every field has a realtime sanitation and check if its acceptable. Pushing the pay button has a check if every field meets the requirements, if not refuses to trigger the payment flow. If every field exaushted the expected conditions then the payment flow starts, the fields become disabled and the button disappears. The webView appears when necessary, accepts user input to solve TDS, then disappears. This form does not show any sign of feedback about the flow. The navigation to and from the form is up to the developer. In case of any error at any time, the form jumps to the error state, but like success state, does not show any feedback. +Every field has a realtime sanitation and check if its acceptable. Pushing the pay button has a check if every field meets the requirements, if not refuses to trigger the payment flow. If every field exhausted the expected conditions then the payment flow starts, the fields become disabled and the button disappears. The webView appears when necessary, accepts user input to solve TDS, then disappears. This form does not show any sign of feedback about the flow. The navigation to and from the form is up to the developer. In case of any error at any time, the form jumps to the error state, but like success state, does not show any feedback. Theme has to be defined like built-in MaterialTheme. The white label view model has UI states what are used only by the Paylike style form. diff --git a/build.gradle b/build.gradle index 6298f1c..12e0ed3 100644 --- a/build.gradle +++ b/build.gradle @@ -23,4 +23,4 @@ spotless { endWithNewline() } } -assemble.dependsOn 'spotlessApply' +build.dependsOn 'spotlessCheck' diff --git a/kotlin_sdk/build.gradle b/kotlin_sdk/build.gradle index fac5e06..be7e830 100644 --- a/kotlin_sdk/build.gradle +++ b/kotlin_sdk/build.gradle @@ -70,7 +70,7 @@ spotless { endWithNewline() } } -assemble.dependsOn 'spotlessApply' +build.dependsOn 'spotlessCheck' afterEvaluate { publishing { diff --git a/kotlin_sdk/src/main/java/com/github/paylike/kotlin_sdk/whitelabel/extendable/view/ExtendableWhiteLabelComposable.kt b/kotlin_sdk/src/main/java/com/github/paylike/kotlin_sdk/whitelabel/extendable/view/ExtendableWhiteLabelComposable.kt index 297ebfd..fc008dd 100644 --- a/kotlin_sdk/src/main/java/com/github/paylike/kotlin_sdk/whitelabel/extendable/view/ExtendableWhiteLabelComposable.kt +++ b/kotlin_sdk/src/main/java/com/github/paylike/kotlin_sdk/whitelabel/extendable/view/ExtendableWhiteLabelComposable.kt @@ -53,12 +53,16 @@ fun ExtendableWhiteLabelComposable( ) { /** WebView to help TDS flow */ val displayMetrics = DisplayMetrics() - val windowManager = LocalContext.current.getSystemService(Context.WINDOW_SERVICE) as WindowManager + val windowManager = + LocalContext.current.getSystemService(Context.WINDOW_SERVICE) as WindowManager windowManager.defaultDisplay.getMetrics(displayMetrics) - webView.value.WebViewComposable(modifier = Modifier.fillMaxWidth(1f).height( - displayMetrics.heightPixels.dp / displayMetrics.density * 0.8f - ).focusable()) + webView.value.WebViewComposable( + modifier = + Modifier.fillMaxWidth(1f) + .height(displayMetrics.heightPixels.dp / displayMetrics.density * 0.8f) + .focusable() + ) /** Extender fields */ if (viewModel.extenderPaymentFormStateList.isNotEmpty()) { diff --git a/kotlin_sdk/src/main/java/com/github/paylike/kotlin_sdk/whitelabel/simple/view/WhiteLabelComposable.kt b/kotlin_sdk/src/main/java/com/github/paylike/kotlin_sdk/whitelabel/simple/view/WhiteLabelComposable.kt index 8991d0b..1c20dac 100644 --- a/kotlin_sdk/src/main/java/com/github/paylike/kotlin_sdk/whitelabel/simple/view/WhiteLabelComposable.kt +++ b/kotlin_sdk/src/main/java/com/github/paylike/kotlin_sdk/whitelabel/simple/view/WhiteLabelComposable.kt @@ -1,9 +1,7 @@ package com.github.paylike.kotlin_sdk.whitelabel.simple.view -import android.app.Activity import android.content.Context.WINDOW_SERVICE import android.util.DisplayMetrics -import android.util.Log import android.view.WindowManager import androidx.compose.foundation.background import androidx.compose.foundation.focusable @@ -15,7 +13,6 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusManager -import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.unit.dp @@ -58,13 +55,16 @@ fun WhiteLabelComposable( /** WebView to help TDS flow */ val displayMetrics = DisplayMetrics() - val windowManager = LocalContext.current.getSystemService(WINDOW_SERVICE) as WindowManager + val windowManager = + LocalContext.current.getSystemService(WINDOW_SERVICE) as WindowManager windowManager.defaultDisplay.getMetrics(displayMetrics) - webView.value.WebViewComposable(modifier = Modifier.fillMaxWidth(1f).height( - displayMetrics.heightPixels.dp / displayMetrics.density * 0.8f - ).focusable()) - + webView.value.WebViewComposable( + modifier = + Modifier.fillMaxWidth(1f) + .height(displayMetrics.heightPixels.dp / displayMetrics.density * 0.8f) + .focusable() + ) /** Form that contains the fields */ SimpleWhiteLabelFormComposable( diff --git a/sample/README.md b/sample/README.md new file mode 100644 index 0000000..12880c1 --- /dev/null +++ b/sample/README.md @@ -0,0 +1,20 @@ +# Example Application + +The purpose of the example application is to showcase the common use-cases of the SDK. + +## Setup + +To run the test application you need to add your sandbox public Merchant API Key to the `local.properties` file in the project root: + +> Important: Make sure to use a sandbox API Key! + +```properties +PaylikeMerchantApiKey="your-key-here" +``` + +## Usage + +After starting the application select a use-case from the list, and fill out the form. + +You can use test card information to complete the payment forms: +`4012 1111 1111 1111` with any valid expiry (eg.: `11/25`) and CVC. diff --git a/sample/build.gradle b/sample/build.gradle index ab8eb5c..2cc0253 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -95,4 +95,4 @@ spotless { endWithNewline() } } -assemble.dependsOn 'spotlessApply' +build.dependsOn 'spotlessCheck' diff --git a/sample/src/main/java/com/github/paylike/sample/view/SampleActivity.kt b/sample/src/main/java/com/github/paylike/sample/view/SampleActivity.kt index b4d9134..d022f76 100644 --- a/sample/src/main/java/com/github/paylike/sample/view/SampleActivity.kt +++ b/sample/src/main/java/com/github/paylike/sample/view/SampleActivity.kt @@ -17,7 +17,6 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ArrowDropDown import androidx.compose.runtime.* import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.rotate diff --git a/sample/src/main/java/com/github/paylike/sample/viewmodel/SampleViewModel.kt b/sample/src/main/java/com/github/paylike/sample/viewmodel/SampleViewModel.kt index a816d20..969a63a 100644 --- a/sample/src/main/java/com/github/paylike/sample/viewmodel/SampleViewModel.kt +++ b/sample/src/main/java/com/github/paylike/sample/viewmodel/SampleViewModel.kt @@ -1,7 +1,6 @@ package com.github.paylike.sample.viewmodel import android.os.Build -import android.util.Log import android.widget.Toast import androidx.compose.foundation.layout.* import androidx.compose.material.* @@ -58,7 +57,6 @@ class SampleViewModel : ViewModel() { mutableStateOf(Pair("Unsupported card scheme", errorCases["Unsupported card scheme"]!!)) private fun onPaymentTestDtoEntryChanged(newValue: Pair) { - Log.d("hello", "onchanged") paymentTestDtoEntry = newValue }