Skip to content

Commit

Permalink
feat(merchant-sdk): Duplicate HealthSDK into MerchantSDK
Browse files Browse the repository at this point in the history
  • Loading branch information
danicretu committed Jun 5, 2024
1 parent 593c074 commit a195b72
Show file tree
Hide file tree
Showing 236 changed files with 13,756 additions and 1 deletion.
5 changes: 5 additions & 0 deletions RELEASE-ORDER.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ Release order for :health-sdk:sdk 4.1.0:
2. :health-api-library:library 4.1.0
3. :health-sdk:sdk 4.1.0

Release order for :merchant-sdk:sdk 4.0.0:
1. :core-api-library:library 2.1.4
2. :health-api-library:library 4.0.0
3. :merchant-sdk:sdk 4.0.0

Release order for :capture-sdk:default-network 3.10.3:
1. :core-api-library:library 2.1.4
2. :bank-api-library:library 3.1.3
Expand Down
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ pmd = "6.0.0"
jacoco = "0.8.10"
hilt = "2.46.1"
navigation_component = "2.7.6"
navigationFragmentKtx = "2.7.7"
navigationUiKtx = "2.7.7"

[libraries]
android-gradle = { module = "com.android.tools.build:gradle", version.ref = "android-gradle-plugin" }
Expand Down Expand Up @@ -111,3 +113,5 @@ navigation_safe_args = { module = "androidx.navigation:navigation-safe-args-grad
datastore-preferences = "androidx.datastore:datastore-preferences:1.0.0"
tomlj = "org.tomlj:tomlj:1.1.1"
json-testing = "org.json:json:20231013"
androidx-navigation-fragment-ktx = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "navigationFragmentKtx" }
androidx-navigation-ui-ktx = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "navigationUiKtx" }
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/ghs_medium"
tools:context="net.gini.android.health.sdk.exampleapp.MainActivity">
tools:context="net.gini.android.merchant.sdk.exampleapp.MainActivity">

<ScrollView
android:layout_width="match_parent"
Expand Down
1 change: 1 addition & 0 deletions merchant-sdk/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Moved to https://developer.gini.net/gini-mobile-android/health-sdk/sdk/html/license.html
41 changes: 41 additions & 0 deletions merchant-sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
![Gini Health SDK for Android](./logo.png)

Gini Health SDK for Android
===========================

The Gini Health SDK for Android provides all the UI and functionality needed to use the Gini Health API in your app to
extract payment and health information from invoices. The payment information can be reviewed and then the invoice can
be paid using any available payment provider app (e.g., banking app).

The Gini Health API provides an information extraction service for analyzing health invoices. Specifically, it extracts
information such as the document sender or the payment relevant information (amount to pay, IBAN, etc.). In addition it
also provides a secure channel for sharing payment related information between clients.

Documentation
-------------

* [Integration Guide](https://developer.gini.net/gini-mobile-android/health-sdk/sdk)

Example Apps
------------

### Health Example App

You can see a sample usage of the Gini Health SDK in the `:health-sdk:example-app` module.

It requires Gini Health API credentials which are injected automatically if you create this file `health-sdk/example-app/local.properties` with the following properties:
```
clientId=*******
clientSecret=*******
```

### Bank Example App

An example bank app is available in the [Gini Bank SDK](https://github.com/gini/gini-mobile-android/tree/main/bank-sdk) called
[`example-app`](https://github.com/gini/gini-mobile-android/tree/main/bank-sdk/example-app).

License
-------

The Gini Health SDK for Android is available under a commercial license.
See the LICENSE file for more info.
1 change: 1 addition & 0 deletions merchant-sdk/example-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
client.properties
44 changes: 44 additions & 0 deletions merchant-sdk/example-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Gini Health SDK Example App
=========================

This example app provides you with a sample usage of the Gini Health SDK.

The Gini Health API Library is used for analyzing documents and creating payment requests.

Before using the Gini Health SDK example app, you need to set your Gini Health API client id and secret by creating a
`local.properties` file in this folder containing a `clientId` and a `clientSecret` property.

ProGuard
========

A sample ProGuard configuration file is included in the example app's directory called `proguard-rules.pro`.

The release build is configured to run ProGuard. You need a keystore with a key to sign it. Create a keystore with a key and provide them in
the `gradle.properties` or as arguments for the build command:

```
$ ./gradlew health-sdk:example-app:assembleRelease \
-PreleaseKeystoreFile=<path to keystore> \
-PreleaseKeystorePassword=<keystore password> \
-PreleaseKeyAlias=<key alias> \
-PreleaseKeyPassword=<key password> \
-PclientId=<Gini API client id> \
-PclientSecret=<Gini API client secret>
```

Flavors
=======

The example app has three flavors: `dev`, `prod` and `qa`. The `dev` flavor is used by default. The `prod` flavor
is used for creating release builds which can be shared with clients while the `qa` flavor is used for creating release builds
for QA purposes. The difference between `prod` and `qa` is that `qa` allows using custom SSL root certificates for
SSL proxies (e.g. Charles Proxy).

Payment Providers for testing the Health SDK
============================================

Payment Providers for testing are provided by the Gini Bank SDK's example app. Run `bundle exec fastlane install_test_payment_provider_apps` in the repository root to install test payment provider apps
on all running emulators and connected devices. You can run `bundle exec fastlane uninstall_test_payment_provider_apps`
to uninstall the test payment provider apps.

Please view the Gini Bank SDK example app's readme at `bank-sdk/example-app/README.md` for more details.
139 changes: 139 additions & 0 deletions merchant-sdk/example-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
import net.gini.gradle.CreatePropertiesTask
import net.gini.gradle.PropertiesPlugin
import net.gini.gradle.readLocalPropertiesToMap

plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
}

android {
namespace = "net.gini.android.merchant.sdk.exampleapp"
compileSdk = libs.versions.android.compileSdk.get().toInt()

// after upgrading to AGP 8, we need this to have the defaultConfig block
buildFeatures {
buildConfig = true
}
defaultConfig {
applicationId = "net.gini.android.merchant.sdk.exampleapp"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk =libs.versions.android.targetSdk.get().toInt()

versionName = version as String
versionCode = (properties["versionCode"] as? String)?.toInt() ?: 0

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

signingConfigs {
create("release") {
storeFile = file(properties["releaseKeystoreFile"] ?: "")
storePassword = (properties["releaseKeystorePassword"] as? String) ?: ""
keyAlias = (properties["releaseKeyAlias"] as? String) ?: ""
keyPassword = (properties["releaseKeyPassword"] as? String) ?: ""
}
}

buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")

signingConfig = signingConfigs.getByName("release")
}
}
flavorDimensions += "environment"
productFlavors {
create("prod") {
dimension = "environment"
}
create("dev") {
isDefault = true
dimension = "environment"
}
create("qa") {
dimension = "environment"
}
}
buildFeatures {
viewBinding = true
}
compileOptions {
sourceCompatibility(JavaVersion.VERSION_1_8)
targetCompatibility(JavaVersion.VERSION_1_8)
}
kotlinOptions {
jvmTarget = "1.8"
// Fix for "Inheritance from an interface with '@JvmDefault' members is only allowed with -Xjvm-default option"
// https://issuetracker.google.com/issues/217593040#comment6
freeCompilerArgs = listOf("-Xjvm-default=all")
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

// after upgrading to AGP 8, we need this, otherwise, gradle will complain to use the same jdk version as your machine (17 which is bundled with Android Studio)
// https://youtrack.jetbrains.com/issue/KT-55947/Unable-to-set-kapt-jvm-target-version
tasks.withType(type = org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask::class) {
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString()
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.ktx)
implementation(libs.androidx.fragment.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.lifecycle.viewmodel.ktx)
implementation(libs.material)
implementation(libs.androidx.constraintlayout)
implementation(libs.koin.androidx.scope)
implementation(libs.koin.androidx.viewmodel)
implementation(libs.koin.androidx.fragment)
implementation(libs.insetter)
implementation(libs.datastore.preferences)
implementation(libs.moshi.core)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(project(":merchant-sdk:sdk"))
kapt(libs.moshi.codegen)
implementation(libs.logback.android.core)
implementation(libs.logback.android.classic) {
// workaround issue #73
exclude(group = "com.google.android", module = "android")
}

testImplementation(libs.junit)

androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.test.espresso.core)
}

apply<PropertiesPlugin>()

tasks.register<CreatePropertiesTask>("injectClientCredentials") {
val propertiesMap = mutableMapOf<String, String>()

doFirst {
propertiesMap.clear()
propertiesMap.putAll(readLocalPropertiesToMap(project, listOf("clientId", "clientSecret")))
}

destinations.put(
file("src/main/resources/client.properties"),
propertiesMap
)
}

afterEvaluate {
tasks.filter { it.name.startsWith("assemble", ignoreCase = true) }.forEach {
it.dependsOn(tasks.getByName("injectClientCredentials"))
}
}
8 changes: 8 additions & 0 deletions merchant-sdk/example-app/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version=1.0.0
versionCode=1

# Signing
releaseKeystoreFile=health_sdk_example.jks
releaseKeystorePassword=***
releaseKeyAlias=health_sdk_example
releaseKeyPassword=***
Binary file added merchant-sdk/example-app/health_sdk_example.jks
Binary file not shown.
21 changes: 21 additions & 0 deletions merchant-sdk/example-app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.gini.pay.app

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("net.gini.pay.app", appContext.packageName)
}
}
6 changes: 6 additions & 0 deletions merchant-sdk/example-app/src/dev/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application android:networkSecurityConfig="@xml/network_security_config" />

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<network-security-config>
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>
Loading

0 comments on commit a195b72

Please sign in to comment.