Skip to content

Commit 2dc4991

Browse files
Merge pull request #13 from TapPay/PiWallet
PI Wallet is OK
2 parents 5e84d93 + e1ce9fd commit 2dc4991

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1329
-1
lines changed

AtomePayExample/app/libs/tpdirect.aar

17.7 KB
Binary file not shown.
17.7 KB
Binary file not shown.
17.7 KB
Binary file not shown.
17.7 KB
Binary file not shown.

JkosPayExample/app/libs/tpdirect.aar

17.7 KB
Binary file not shown.

LinePayExample/app/libs/tpdirect.aar

17.7 KB
Binary file not shown.

PiWalletExample/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

PiWalletExample/app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

PiWalletExample/app/build.gradle

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
plugins {
2+
id 'com.android.application'
3+
}
4+
5+
android {
6+
compileSdk 31
7+
8+
defaultConfig {
9+
applicationId "tech.cherri.piwalletexample"
10+
minSdk 21
11+
targetSdk 31
12+
versionCode 1
13+
versionName "1.0"
14+
15+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16+
}
17+
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
compileOptions {
25+
sourceCompatibility JavaVersion.VERSION_1_8
26+
targetCompatibility JavaVersion.VERSION_1_8
27+
}
28+
}
29+
30+
dependencies {
31+
32+
implementation 'androidx.appcompat:appcompat:1.4.1'
33+
implementation 'com.google.android.material:material:1.5.0'
34+
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
35+
implementation files('libs/tpdirect.aar')
36+
testImplementation 'junit:junit:4.+'
37+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
38+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
39+
}

PiWalletExample/app/libs/tpdirect.aar

424 KB
Binary file not shown.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package tech.cherri.piwalletexample;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
assertEquals("tech.cherri.piwalletexample", appContext.getPackageName());
25+
}
26+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="tech.cherri.piwalletexample">
5+
6+
<application
7+
tools:replace="android:allowBackup"
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:theme="@style/Theme.PiWalletExample">
14+
<activity
15+
android:name=".MainActivity"
16+
android:exported="true">
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN" />
19+
20+
<category android:name="android.intent.category.LAUNCHER" />
21+
</intent-filter>
22+
23+
<intent-filter android:autoVerify="true">
24+
<action android:name="android.intent.action.VIEW" />
25+
26+
<category android:name="android.intent.category.DEFAULT" />
27+
<category android:name="android.intent.category.BROWSABLE" />
28+
29+
<data
30+
android:scheme="piwalletexample"
31+
android:host="tech.cherri.piwalletexample" />
32+
33+
</intent-filter>
34+
35+
<intent-filter android:autoVerify="true">
36+
<action android:name="android.intent.action.VIEW" />
37+
38+
<category android:name="android.intent.category.DEFAULT" />
39+
<category android:name="android.intent.category.BROWSABLE" />
40+
41+
<data
42+
android:scheme="https"
43+
android:host="example.com"
44+
android:pathPrefix="/test" />
45+
</intent-filter>
46+
</activity>
47+
</application>
48+
<queries>
49+
<!-- for pi-wallet production app open -->
50+
<package android:name="tw.com.pchome.android.pi" />
51+
<!-- for pi-wallet test app open -->
52+
<!-- <package android:name="tw.com.pchome.android.pi.partner" />-->
53+
</queries>
54+
</manifest>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package tech.cherri.piwalletexample;
2+
3+
import tech.cherri.tpdirect.api.TPDServerType;
4+
5+
public class Constants {
6+
public static final TPDServerType SERVER_TYPE = TPDServerType.Production;
7+
// public static final TPDServerType SERVER_TYPE = TPDServerType.Sandbox; -- sandbox
8+
9+
public static final String TAPPAY_DOMAIN = "https://prod.tappaysdk.com/tpc";
10+
// public static final String TAPPAY_DOMAIN = "https://sandbox.tappaysdk.com/tpc"; --sandbox
11+
12+
public static final String TAPPAY_PAY_BY_PRIME_URL = "/payment/pay-by-prime";
13+
public static final String FRONTEND_REDIRECT_URL_EXAMPLE = "https://example.com/front-end-redirect";
14+
public static final String BACKEND_NOTIFY_URL_EXAMPLE = "https://example.com/back-end-notify";
15+
16+
public static final String PARTNER_KEY = "PARTNER KEY";
17+
public static final String APP_KEY = "APP KEY";
18+
public static final Integer APP_ID = -1; // your app id
19+
20+
public static final String MERCHANT_ID = "your merchant id";
21+
22+
public static final String RETURN_URL = "UNIVERSAL LINK"; // for universal links
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package tech.cherri.piwalletexample;
2+
3+
import android.app.ProgressDialog;
4+
import android.widget.TextView;
5+
6+
import tech.cherri.tpdirect.callback.TPDGetPrimeFailureCallback;
7+
8+
public class GetPrimeFailCallback implements TPDGetPrimeFailureCallback {
9+
private final TextView resultText;
10+
private final ProgressDialog progressDialog;
11+
12+
public GetPrimeFailCallback(TextView textView, ProgressDialog progressDialog) {
13+
resultText = textView;
14+
this.progressDialog = progressDialog;
15+
}
16+
17+
@Override
18+
public void onFailure(int status, String msg) {
19+
if (progressDialog != null && progressDialog.isShowing()) {
20+
progressDialog.dismiss();
21+
}
22+
this.resultText.setText(msg);
23+
}
24+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package tech.cherri.piwalletexample;
2+
3+
import android.os.AsyncTask;
4+
import android.widget.TextView;
5+
6+
import tech.cherri.tpdirect.callback.TPDPiWalletGetPrimeSuccessCallback;
7+
8+
public class GetPrimeSuccessCallback implements TPDPiWalletGetPrimeSuccessCallback {
9+
private final TextView resultText;
10+
private final MainActivity activity;
11+
12+
public GetPrimeSuccessCallback(MainActivity mainActivity) {
13+
resultText = mainActivity.resultText;
14+
this.activity = mainActivity;
15+
}
16+
17+
@Override
18+
public void onSuccess(String prime) {
19+
String text = "your prime is = " + prime;
20+
this.resultText.setText(text);
21+
activity.showProgressDialog();
22+
23+
String details = "[{\"item_id\": \"" + "item_1"
24+
+ "\",\"item_name\": \"" + "item_No_1"
25+
+ " \",\"item_quantity\":" + "1"
26+
+ ",\"item_price\":" + "100" + "}]";
27+
28+
PayByPrimeResultListener listener = activity.resultCallback;
29+
30+
MyPayByPrimeTaskForPiWallet payByPrimeTask =
31+
new MyPayByPrimeTaskForPiWallet(prime, listener, details);
32+
33+
payByPrimeTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
34+
35+
}
36+
37+
38+
}

0 commit comments

Comments
 (0)