From aab3f615d9ab4947768f042cfa879c0d487f890c Mon Sep 17 00:00:00 2001 From: Laszlo Kocsis Date: Mon, 27 Mar 2023 13:19:45 +0200 Subject: [PATCH 1/5] fix(readme): fixed ci badge link --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f7eb099..8459980 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. From d5d46bf1b52d2788b705d87d5b0ae2dbd871bb1b Mon Sep 17 00:00:00 2001 From: Laszlo Kocsis Date: Mon, 27 Mar 2023 13:21:00 +0200 Subject: [PATCH 2/5] fix(ci): fixed ci command and dependency graph --- .github/workflows/AssembleOnMain.yml | 2 +- build.gradle | 2 +- kotlin_sdk/build.gradle | 2 +- sample/build.gradle | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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/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/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' From 1cfdd07174bafc4fecc6f006a8a17531a8b2a9fa Mon Sep 17 00:00:00 2001 From: Laszlo Kocsis Date: Mon, 27 Mar 2023 13:21:36 +0200 Subject: [PATCH 3/5] chore(*): enforced kotlin formatting --- .../view/ExtendableWhiteLabelComposable.kt | 12 ++++++++---- .../simple/view/WhiteLabelComposable.kt | 16 ++++++++-------- .../github/paylike/sample/view/SampleActivity.kt | 1 - 3 files changed, 16 insertions(+), 13 deletions(-) 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/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 From 7920d87d4a6b1b455a9653348af8846eb963b74b Mon Sep 17 00:00:00 2001 From: Laszlo Kocsis Date: Tue, 28 Mar 2023 12:53:27 +0200 Subject: [PATCH 4/5] fix(*): typo and unused log --- README.md | 2 +- .../java/com/github/paylike/sample/viewmodel/SampleViewModel.kt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 8459980..2e4ce21 100644 --- a/README.md +++ b/README.md @@ -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/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 } From cb36e82b9b185ada551679aede42f099173fb75d Mon Sep 17 00:00:00 2001 From: Laszlo Kocsis Date: Fri, 21 Apr 2023 12:34:59 +0200 Subject: [PATCH 5/5] chore(readme): added readme for the example app --- sample/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 sample/README.md 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.