├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ ├── drawable │ │ │ │ └── img.png │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── zarinpal │ │ │ └── ewallets │ │ │ └── purchasesdk │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── zarinpal │ │ │ └── ewallets │ │ │ └── purchasesdk │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── zarinpal │ │ └── ewallets │ │ └── purchasesdk │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── purchase ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── zarinpal │ │ │ └── ewallets │ │ │ └── purchase │ │ │ ├── HttpRequestListener.java │ │ │ ├── OnCallbackVerificationPaymentListener.java │ │ │ ├── OnCallbackRequestPaymentListener.java │ │ │ ├── Payment.java │ │ │ ├── HttpQueue.java │ │ │ ├── SandboxPaymentRequest.java │ │ │ ├── VerificationPayment.java │ │ │ ├── PaymentRequest.java │ │ │ ├── ZarinPal.java │ │ │ └── HttpRequest.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── zarinpal │ │ │ └── ewallets │ │ │ └── purchase │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── zarinpal │ │ └── ewallets │ │ └── purchase │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── .idea ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── inspectionProfiles │ └── Project_Default.xml ├── compiler.xml ├── gradle.xml ├── codeStyles │ └── Project.xml └── misc.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── gradlew └── README.MD /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /purchase/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':purchase' 2 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Purchase SDK 3 | 4 | -------------------------------------------------------------------------------- /purchase/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | purchase 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZarinPal-Lab/Android-SDK-Payment/HEAD/app/src/main/res/drawable/img.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZarinPal-Lab/Android-SDK-Payment/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZarinPal-Lab/Android-SDK-Payment/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZarinPal-Lab/Android-SDK-Payment/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZarinPal-Lab/Android-SDK-Payment/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZarinPal-Lab/Android-SDK-Payment/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZarinPal-Lab/Android-SDK-Payment/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jan 01 11:37:15 IRST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /purchase/src/test/java/com/zarinpal/ewallets/purchase/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.zarinpal.ewallets.purchase; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/zarinpal/ewallets/purchasesdk/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.zarinpal.ewallets.purchasesdk; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /purchase/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /purchase/src/androidTest/java/com/zarinpal/ewallets/purchase/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.zarinpal.ewallets.purchase; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/zarinpal/ewallets/purchasesdk/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.zarinpal.ewallets.purchasesdk; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /purchase/src/main/java/com/zarinpal/ewallets/purchase/HttpRequestListener.java: -------------------------------------------------------------------------------- 1 | package com.zarinpal.ewallets.purchase; 2 | 3 | import org.json.JSONObject; 4 | 5 | /** 6 | * Android ZarinPal In App Purchase SDK Library v0.0.2 Beta Project. 7 | * Created by ImanX on 12/22/16. 8 | * Copyright Alireza Tarazani All Rights Reserved. 9 | */ 10 | public interface HttpRequestListener { 11 | void onSuccessResponse(JSONObject jsonObject, String contentResponse); 12 | 13 | void onFailureResponse(int httpStatusCode, String dataError); 14 | } 15 | -------------------------------------------------------------------------------- /purchase/src/main/java/com/zarinpal/ewallets/purchase/OnCallbackVerificationPaymentListener.java: -------------------------------------------------------------------------------- 1 | package com.zarinpal.ewallets.purchase; 2 | 3 | /** 4 | * Android ZarinPal In App Purchase SDK Library v0.0.2 Beta Project. 5 | * Created by ImanX on 12/22/16. 6 | * Copyright Alireza Tarazani All Rights Reserved. 7 | */ 8 | public interface OnCallbackVerificationPaymentListener { 9 | void onCallbackResultVerificationPayment(boolean isPaymentSuccess, 10 | String refID, 11 | PaymentRequest paymentRequest); 12 | } 13 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /purchase/src/main/java/com/zarinpal/ewallets/purchase/OnCallbackRequestPaymentListener.java: -------------------------------------------------------------------------------- 1 | package com.zarinpal.ewallets.purchase; 2 | 3 | 4 | import android.content.Intent; 5 | import android.net.Uri; 6 | 7 | /** 8 | * Android ZarinPal In App Purchase SDK Library v0.0.2 Beta Project. 9 | * Created by ImanX on 12/22/16. 10 | * Copyright Alireza Tarazani All Rights Reserved. 11 | */ 12 | public interface OnCallbackRequestPaymentListener { 13 | void onCallbackResultPaymentRequest(int status, 14 | String authority, 15 | Uri paymentGatewayUri, 16 | Intent intent); 17 | } 18 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Library/Android SDK/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /purchase/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Library/Android SDK/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /purchase/src/main/java/com/zarinpal/ewallets/purchase/Payment.java: -------------------------------------------------------------------------------- 1 | package com.zarinpal.ewallets.purchase; 2 | 3 | /** 4 | * Android ZarinPal In App Purchase SDK Library v0.0.2 Beta Project. 5 | * Created by ImanX on 12/22/16. 6 | * Copyright Alireza Tarazani All Rights Reserved. 7 | */ 8 | class Payment { 9 | public static final String MERCHANT_ID_PARAMS = "MerchantID"; 10 | public static final String AMOUNT_PARAMS = "Amount"; 11 | public static final String DESCRIPTION_PARAMS = "Description"; 12 | public static final String CALLBACK_URL_PARAMS = "CallbackURL"; 13 | public static final String MOBILE_PARAMS = "Mobile"; 14 | public static final String EMAIL_PARAMS = "Email"; 15 | public static final String AUTHORITY_PARAMS = "Authority"; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /purchase/src/main/java/com/zarinpal/ewallets/purchase/HttpQueue.java: -------------------------------------------------------------------------------- 1 | package com.zarinpal.ewallets.purchase; 2 | 3 | import android.content.Context; 4 | 5 | import com.android.volley.Request; 6 | import com.android.volley.RequestQueue; 7 | import com.android.volley.toolbox.Volley; 8 | 9 | 10 | /** 11 | * Android ZarinPal In App Purchase SDK Library v0.0.2 Beta Project. 12 | * Created by ImanX on 12/22/16. 13 | * Copyright Alireza Tarazani All Rights Reserved. 14 | */ 15 | class HttpQueue { 16 | private static HttpQueue instance; 17 | private static RequestQueue queue; 18 | 19 | public static HttpQueue getInstance(Context context) { 20 | if (instance == null) { 21 | instance = new HttpQueue(); 22 | queue = Volley.newRequestQueue(context); 23 | } 24 | return instance; 25 | } 26 | 27 | public void addToRequest(Request request) { 28 | request.setShouldCache(false); 29 | queue.getCache().clear(); 30 | queue.add(request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 24 | -------------------------------------------------------------------------------- /purchase/src/main/java/com/zarinpal/ewallets/purchase/SandboxPaymentRequest.java: -------------------------------------------------------------------------------- 1 | package com.zarinpal.ewallets.purchase; 2 | 3 | /** 4 | * Created by ImanX. 5 | * PurchaseSDK | Copyrights 2018 ZarinPal Crop. 6 | */ 7 | 8 | public class SandboxPaymentRequest extends PaymentRequest { 9 | 10 | private static final String SANDBOX = "sandbox."; 11 | private static final String WORLD_WIDE_WEB = "www."; 12 | 13 | @Override 14 | public String getPaymentRequestURL() { 15 | return String.format(PAYMENT_REQUEST_URL, SANDBOX) 16 | .replace(WORLD_WIDE_WEB, ""); 17 | } 18 | 19 | @Override 20 | public String getStartPaymentGatewayURL(String authority) { 21 | return String.format(PAYMENT_GATEWAY_URL, SANDBOX, authority, isZarinGateEnable() ? "ZarinGate" : "") 22 | .replace(WORLD_WIDE_WEB, ""); 23 | } 24 | 25 | @Override 26 | public String getVerificationPaymentURL() { 27 | return String.format(VERIFICATION_PAYMENT_URL, SANDBOX) 28 | .replace(WORLD_WIDE_WEB, ""); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | buildToolsVersion '26.0.3' 6 | 7 | lintOptions { 8 | abortOnError false 9 | } 10 | defaultConfig { 11 | multiDexEnabled true 12 | } 13 | 14 | dexOptions { 15 | javaMaxHeapSize "4g" 16 | } 17 | defaultConfig { 18 | applicationId "com.zarinpal.ewallets.purchasesdk" 19 | minSdkVersion 15 20 | targetSdkVersion 29 21 | versionCode 1 22 | versionName "1.0" 23 | } 24 | buildTypes { 25 | release { 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | } 31 | 32 | dependencies { 33 | implementation fileTree(dir: 'libs', include: ['*.jar']) 34 | testImplementation 'junit:junit:4.12' 35 | implementation 'com.android.support:appcompat-v7:28.0.0' 36 | 37 | // implementation 'com.zarinpal:purchase:0.0.9' 38 | 39 | 40 | implementation project (":purchase") 41 | 42 | 43 | 44 | // compile project(path: ':purchase') 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 17 | 18 | 19 |