Skip to content

Commit

Permalink
New version 3.0.0. Rebranded example to cm style
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardo.alonso authored and eduardo.alonso committed Jan 11, 2023
1 parent 2be73f8 commit a6e46f5
Show file tree
Hide file tree
Showing 279 changed files with 7,384 additions and 3,632 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
* PayPlaza ECR app 2.0

Version 2.0.1
The ECR application handles the merchant UI, QR-payments, and transaction result user guidance. The application is designated for Sunmi Android platform, but will work on other Android device and in the Android Emulator as well.

The ECR application handles the merchant UI, card payments and transaction result user guidance. The application is designated for Sunmi Android platform, but will work on other Android device and in the Android Emulator as well.

# Release notes

Release 2.0.0 includes a basic implementation of the [integration SDK](https://github.com/cmdotcom/android-pos-integration-sdk-kotlin) as an example.

### Compatibility table
| ECR | SDK | Terminal |

| ECR | SDK | Terminal |
| ----- | ----- | -------- |
| 3.0.0 | 1.1.2 | 2.0.0 |
| 2.1.0 | 1.1.0 | 1.2.0 |
| 2.0.1 | 1.0.1 | 1.1.1 |
| 2.0.0 | 1.0.0 | 1.1.1 |

### Versions
#### 3.0.0
- Rebrand from generic brand to CM brand
- Bug fixes

#### 2.1.0

Expand All @@ -40,13 +44,13 @@
## Hardware devices

* This app is designed and tested for Sunmi devices.
* This app has been tested in Sunmi P2 lite and Sunmi P2 Pro.
* This app has been tested in Sunmi P2 lite, Sunmi P2 Pro and Sunmi P2 mini.

## Prerequisites

* Payplaza [Terminal](https://payplaza.com/terminals/) application must be installed in the device. Version 1.1.1 or higher.
* Payplaza [Terminal](https://www.cm.com/payments/pos-payments/smartpos/) application must be installed in the device. Version 1.1.1 or higher.
* Android 7 (api 25) or higher.
* The device you'll use must have installed 'SunmiPayHardwareService'. Version v3.3.133 or higher.
* The device you'll use must have installed 'SunmiPayHardwareService'. Version v3.3.140 or higher.

## Installation

Expand Down
22 changes: 10 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'androidx.navigation.safeargs.kotlin'
id 'kotlin-kapt'
}

android {
compileSdk 31
compileSdk 33

defaultConfig {
minSdk 25
targetSdk 29
targetSdk 33
versionCode 1
versionName "2.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders.launcherTheme = "@style/Base.Launcher"
manifestPlaceholders.appIcon = "@mipmap/ic_launcher"

setProperty("archivesBaseName", "ecr-$versionName")
}

buildTypes {
debug {
// minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
manifestPlaceholders.appIcon = "@mipmap/ic_launcher_dev"
applicationIdSuffix = ".debug"
}
debug { }
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -78,8 +72,9 @@ dependencies {
debugImplementation "androidx.test.ext:junit:$rootProject.ext.androidx_junit"
debugImplementation "androidx.test.espresso:espresso-core:$rootProject.ext.espresso_core"
debugImplementation "androidx.test:runner:$rootProject.ext.espresso"
debugImplementation "androidx.test:rules:$rootProject.ext.espresso"
debugImplementation "androidx.test:core-ktx:$rootProject.ext.espresso"
debugImplementation "androidx.test:rules:$rootProject.ext.test_rules"
debugImplementation "androidx.test:core-ktx:$rootProject.ext.test_rules"
implementation "com.android.support.test.espresso:espresso-idling-resource:$rootProject.ext.espresso"
debugImplementation "androidx.fragment:fragment-testing:$rootProject.ext.fragment_testing"
debugImplementation "androidx.navigation:navigation-testing:$rootProject.ext.nav_version"

Expand All @@ -95,4 +90,7 @@ dependencies {

// Sunmi
implementation "com.sunmi:printerlibrary:$rootProject.ext.printer"

// Lottie animation
implementation "com.airbnb.android:lottie:$lottie_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class PaymentActivityTest: KoinComponent {
activityRule.scenario.onActivity { a ->
a.onSupportNavigateUp()
}
onView(withId(R.id.ecr_drawer)).check(matches(isDisplayed()))
onView(withId(R.id.ecr_navigation)).check(matches(isDisplayed()))
onView(withId(R.id.drawer)).check(matches(isDisplayed()))
onView(withId(R.id.ecr_preauth_expandible_list)).check(matches(isDisplayed()))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ class RefundActivityTest: KoinComponent {
onView(ViewMatchers.withId(R.id.keypad_button_3)).perform(ViewActions.click())
onView(ViewMatchers.withId(R.id.amount_view_amount)).check(ViewAssertions.matches(ViewMatchers.withText("*****")))
Thread.sleep(200)
onView(ViewMatchers.withId(R.id.keypad_button_confirm)).perform(ViewActions.click())
onView(ViewMatchers.withId(R.id.actionButton)).perform(ViewActions.click())
Thread.sleep(200)
onView(ViewMatchers.withId(R.id.keypad_button_1)).perform(ViewActions.click())
onView(ViewMatchers.withId(R.id.keypad_button_0)).perform(ViewActions.click())
onView(ViewMatchers.withId(R.id.keypad_button_0)).perform(ViewActions.click())
onView(ViewMatchers.withId(R.id.amount_view_amount)).check(ViewAssertions.matches(ViewMatchers.withText("1.00")))
Thread.sleep(200)
onView(ViewMatchers.withId(R.id.keypad_button_confirm)).perform(ViewActions.click())
onView(ViewMatchers.withId(R.id.actionButton)).perform(ViewActions.click())
Thread.sleep(200)
if("NL" != localDataRepository.getTerminalData()?.storeCountry) {
onView(ViewMatchers.withId(R.id.keypad_button_1)).perform(ViewActions.click())
Expand All @@ -82,7 +82,7 @@ class RefundActivityTest: KoinComponent {
onView(ViewMatchers.withId(R.id.keypad_button_6)).perform(ViewActions.click())
onView(ViewMatchers.withId(R.id.amount_view_amount)).check(ViewAssertions.matches(ViewMatchers.withText("123456")))
Thread.sleep(200)
onView(ViewMatchers.withId(R.id.keypad_button_confirm)).perform(ViewActions.click())
onView(ViewMatchers.withId(R.id.actionButton)).perform(ViewActions.click())
Thread.sleep(200)
onView(ViewMatchers.withId(R.id.date_component_view)).perform(ViewActions.click())
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package com.cm.payplaza.ecr_sdk_integration

import androidx.fragment.app.testing.FragmentScenario
import androidx.fragment.app.testing.launchFragmentInContainer
import androidx.lifecycle.Lifecycle
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.IdlingPolicies
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.cm.payplaza.ecr_sdk_integration.domain.repository.localData.LocalDataRepository
import com.cm.payplaza.ecr_sdk_integration.entity.Transaction
import com.cm.payplaza.ecr_sdk_integration.entity.TransactionError
import com.cm.payplaza.ecr_sdk_integration.entity.TransactionResponse
import com.cm.payplaza.ecr_sdk_integration.fragment.receiptView.ReceiptViewFragment
import com.cm.payplaza.ecr_sdk_integration.fragment.receiptView.ReceiptFragment
import org.junit.After
import org.junit.Before
import org.junit.Test
Expand All @@ -24,7 +23,7 @@ import java.util.concurrent.TimeUnit

@RunWith(AndroidJUnit4::class)
class TransactionResultActivityTest: KoinComponent {
private lateinit var fragmentScenario: FragmentScenario<ReceiptViewFragment>

private val localDataRepository: LocalDataRepository by inject()
private val purchaseTransaction: Transaction by inject(qualifier = named("purchaseTransaction"))
private val transactionResultSuccess: TransactionResponse by inject(qualifier = named("transactionResultSuccess"))
Expand All @@ -46,13 +45,10 @@ class TransactionResultActivityTest: KoinComponent {

@Test
fun showReceiptFragment() {
fragmentScenario = launchFragmentInContainer()
onView(withId(R.id.receipt_view_close_button)).check(matches(isDisplayed()))
onView(withId(R.id.receipt_view_close_button)).check(matches(isClickable()))
onView(withId(R.id.receipt_view_button_print)).check(matches(isClickable()))
onView(withId(R.id.textview_receipt)).check(matches(isDisplayed()))
Thread.sleep(2000)
onView(withId(R.id.receipt_view_close_button)).perform(ViewActions.click())
val fragmentScenario = launchFragmentInContainer<ReceiptFragment>(
initialState = Lifecycle.State.RESUMED, themeResId = R.style.AppTheme
)

onView(withId(R.id.textview_receipt)).check(matches(isDisplayed()))
Thread.sleep(2000)
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions app/src/genericBrand/res/drawable/ic_backspace.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M21,4C21.552,4 22,4.448 22,5L22,5L22,19C22,19.552 21.552,20 21,20L21,20L9.46,20C8.876,20 8.321,19.745 7.941,19.302L7.941,19.302L2.241,12.651C1.92,12.276 1.92,11.724 2.241,11.349L2.241,11.349L7.941,4.698C8.321,4.255 8.876,4 9.46,4L9.46,4ZM20,6L9.46,6L4.317,12L9.46,18L20,18L20,6ZM12.586,9.172L14,10.586L15.414,9.172C15.805,8.781 16.438,8.781 16.828,9.172C17.219,9.562 17.219,10.195 16.828,10.586L15.414,12L16.828,13.414C17.219,13.805 17.219,14.438 16.828,14.828C16.438,15.219 15.805,15.219 15.414,14.828L14,13.414L12.586,14.828C12.195,15.219 11.562,15.219 11.172,14.828C10.781,14.438 10.781,13.805 11.172,13.414L12.586,12L11.172,10.586C10.781,10.195 10.781,9.562 11.172,9.172C11.562,8.781 12.195,8.781 12.586,9.172Z"
android:strokeWidth="1"
android:fillColor="#0074E8"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
</vector>
Binary file removed app/src/genericBrand/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed app/src/genericBrand/res/mipmap-ldpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed app/src/genericBrand/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
9 changes: 6 additions & 3 deletions app/src/genericBrand/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primaryColor">#0077BA</color>
<color name="successGreen">#509ED8</color>
<color name="warningYellow">#F1E435</color>
<color name="errorRed">#DA420F</color>
<color name="green">#509ED8</color>
<color name="yellow">#F1E435</color>
<color name="red">#DA420F</color>

<color name="backspace_button">@color/blue_100</color>
<color name="progress_bar">@color/blue_100</color>
</resources>
10 changes: 10 additions & 0 deletions app/src/genericBrand/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Keypad.BackspaceButton" parent="Widget.Material3.Button.TextButton">
<item name="android:background">@null</item>
<item name="srcCompat">@drawable/ic_backspace</item>
<item name="iconTint">@color/blue_100</item>
<item name="iconSize">25dp</item>
<item name="iconGravity">textStart</item>
</style>
</resources>
39 changes: 32 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,46 @@
android:theme="${launcherTheme}"
android:fullBackupContent="true"
android:extractNativeLibs="true">

<service
android:name="androidx.appcompat.app.AppLocalesMetadataHolderService"
android:enabled="false"
android:exported="false">
<meta-data
android:name="autoStoreLocales"
android:value="true" />
</service>

<activity
android:name=".activity.payment.PaymentActivity"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.transactionResult.TransactionResultActivity"/>
<activity android:name=".activity.refund.RefundActivity"/>
<activity android:name=".activity.lastReceipt.LastReceiptActivity"/>
<activity android:name=".activity.totals.TotalsActivity"/>
<activity android:name=".activity.statuses.StatusesActivity"/>
<activity android:name=".activity.preauth.start.PreAuthActivity"/>
<activity android:name=".activity.preauth.finish.FinishPreauthActivity"/>
<activity
android:name=".activity.transactionResult.TransactionResultActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activity.refund.RefundActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activity.lastReceipt.LastReceiptActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activity.totals.TotalsActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activity.statuses.StatusesActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activity.preauth.start.PreAuthActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activity.preauth.finish.FinishPreauthActivity"
android:screenOrientation="portrait"/>
</application>

</manifest>
Loading

0 comments on commit a6e46f5

Please sign in to comment.