├── .gitignore ├── 3DSView ├── .gitignore ├── bintray-publish.gradle ├── build.gradle ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── eu │ │ │ └── livotov │ │ │ └── labs │ │ │ └── android │ │ │ └── d3s │ │ │ ├── D3SRegexUtils.java │ │ │ ├── D3SSViewAuthorizationListener.java │ │ │ └── D3SView.java │ └── res │ │ └── layout │ │ └── dialog_3ds.xml │ └── test │ └── java │ └── eu │ └── livotov │ └── labs │ └── android │ └── d3s │ └── D3SRegexUtilsTest.java ├── 3DSViewSample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── eu │ │ └── livotov │ │ └── labs │ │ └── android │ │ └── d3s │ │ └── sample │ │ └── MainActivity.java │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ └── activity_main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── values-night │ └── themes.xml │ └── values │ ├── colors.xml │ ├── strings.xml │ └── themes.xml ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── maven.properties └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | .idea 4 | *.iml 5 | *.jpr 6 | .DS_Store 7 | /build 8 | maven.secret.properties -------------------------------------------------------------------------------- /3DSView/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /3DSView/bintray-publish.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.github.dcendents.android-maven' 2 | apply plugin: 'com.jfrog.bintray' 3 | 4 | Properties properties = new Properties() 5 | Properties propertiesSecret = new Properties() 6 | propertiesSecret.load(project.rootProject.file('maven.secret.properties').newDataInputStream()) 7 | properties.load(project.rootProject.file('maven.properties').newDataInputStream()) 8 | 9 | group properties.getProperty("maven.group") 10 | version properties.getProperty("maven.version") 11 | 12 | 13 | install { 14 | repositories.mavenInstaller { 15 | // This generates POM.xml with proper parameters 16 | pom { 17 | project { 18 | packaging 'aar' 19 | groupId properties.getProperty("maven.group") 20 | artifactId properties.getProperty("maven.artifact") 21 | version properties.getProperty("maven.version") 22 | name properties.getProperty("maven.info") 23 | url properties.getProperty("maven.url.home") 24 | 25 | // Set your license 26 | licenses { 27 | license { 28 | name properties.getProperty("maven.license.name") 29 | url properties.getProperty("maven.license.url") 30 | } 31 | } 32 | developers { 33 | developer { 34 | id properties.getProperty("maven.developer.id") 35 | name properties.getProperty("maven.developer.name") 36 | email properties.getProperty("maven.developer.email") 37 | } 38 | } 39 | scm { 40 | connection properties.getProperty("maven.url.vcs") 41 | developerConnection properties.getProperty("maven.url.vcs") 42 | url properties.getProperty("maven.url.home") 43 | 44 | } 45 | } 46 | } 47 | } 48 | } 49 | 50 | bintray { 51 | user = propertiesSecret.getProperty("maven.bintray.user") 52 | key = propertiesSecret.getProperty("bintray.apikey") 53 | 54 | configurations = ['archives'] 55 | pkg { 56 | repo = propertiesSecret.getProperty("maven.bintray.repo") 57 | name = properties.getProperty("maven.name") 58 | desc = properties.getProperty("maven.info") 59 | userOrg = propertiesSecret.getProperty("maven.bintray.org") 60 | websiteUrl = properties.getProperty("maven.url.home") 61 | vcsUrl = properties.getProperty("maven.url.vcs") 62 | issueTrackerUrl = properties.getProperty("maven.url.issues") 63 | licenses = ["Apache-2.0"] 64 | labels = ['orm', 'sqlite', 'android', 'aar'] 65 | publish = true 66 | version { 67 | name = properties.getProperty("maven.version") 68 | desc = properties.getProperty("maven.info") 69 | released = new Date(); 70 | vcsTag = properties.getProperty("maven.version.tag") 71 | gpg { 72 | sign = true 73 | passphrase = propertiesSecret.getProperty("gpg.secret.password") 74 | } 75 | } 76 | } 77 | } 78 | 79 | task sourcesJar(type: Jar) { 80 | from android.sourceSets.main.java.srcDirs 81 | classifier = 'sources' 82 | } 83 | 84 | task javadoc(type: Javadoc) { 85 | source = android.sourceSets.main.java.srcDirs 86 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 87 | failOnError false 88 | } 89 | 90 | task javadocJar(type: Jar, dependsOn: javadoc) { 91 | classifier = 'javadoc' 92 | from javadoc.destinationDir 93 | } 94 | 95 | artifacts { 96 | archives javadocJar 97 | archives sourcesJar 98 | } -------------------------------------------------------------------------------- /3DSView/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 30 5 | 6 | defaultConfig { 7 | minSdkVersion 10 8 | targetSdkVersion 30 9 | versionCode 1 10 | versionName "3DSView" 11 | } 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | compileOptions { 19 | sourceCompatibility JavaVersion.VERSION_1_8 20 | targetCompatibility JavaVersion.VERSION_1_8 21 | } 22 | } 23 | 24 | dependencies { 25 | implementation 'androidx.annotation:annotation:1.1.0' 26 | testImplementation 'junit:junit:4.13.1' 27 | testImplementation 'com.google.truth:truth:1.1' 28 | } -------------------------------------------------------------------------------- /3DSView/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 /Users/dlivotov/Developer/Android/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 | -------------------------------------------------------------------------------- /3DSView/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /3DSView/src/main/java/eu/livotov/labs/android/d3s/D3SRegexUtils.java: -------------------------------------------------------------------------------- 1 | package eu.livotov.labs.android.d3s; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.annotation.Nullable; 5 | 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | import static java.util.regex.Pattern.CASE_INSENSITIVE; 10 | import static java.util.regex.Pattern.DOTALL; 11 | import static java.util.regex.Pattern.compile; 12 | 13 | /** 14 | * Utilities to find 3DS values in ACS webpages. 15 | */ 16 | final class D3SRegexUtils { 17 | 18 | /** 19 | * Pattern to find the value of an attribute named value from an html tag with an attribute named name and a value of MD. 20 | */ 21 | private static final Pattern mdFinder = compile("]+?value=\"([^\"]+?)\")[^<>]+?name=\"MD\"[^<>]+?>", DOTALL | CASE_INSENSITIVE); 22 | 23 | /** 24 | * Pattern to find the value of an attribute named value from an html tag with an attribute named name and a value of PaRes. 25 | */ 26 | private static final Pattern paresFinder = compile("]+?value=\"([^\"]+?)\")[^<>]+?name=\"PaRes\"[^<>]+?>", DOTALL | CASE_INSENSITIVE); 27 | 28 | /** 29 | * Pattern to find the value of an attribute named value from an html tag with an attribute named name and a value of CRes. 30 | */ 31 | private static final Pattern cresFinder = Pattern.compile("]+?value=\"([^\"]+?)\")[^<>]+?name=\"CRes\"[^<>]+?>", Pattern.DOTALL | Pattern.CASE_INSENSITIVE); 32 | 33 | /** 34 | * Pattern to find the value of an attribute named value from an html tag with an attribute named name and a value of threeDSSessionData. 35 | */ 36 | private static final Pattern threeDSSessionDataFinder = Pattern.compile("]+?value=\"([^\"]+?)\")[^<>]+?name=\"threeDSSessionData\"[^<>]+?>", Pattern.DOTALL | Pattern.CASE_INSENSITIVE); 37 | 38 | /** 39 | * Finds the MD in an html page. 40 | *

41 | * Note: If more than one MD is found in a page only the first will be returned. 42 | * 43 | * @param html String representation of the html page to search within. 44 | * @return MD or null if not found 45 | */ 46 | @Nullable 47 | public static String findMd(@NonNull String html) { 48 | if (html.trim().isEmpty()) return null; 49 | 50 | String md = null; 51 | Matcher paresMatcher = mdFinder.matcher(html); 52 | if (paresMatcher.find()) { 53 | md = paresMatcher.group(1); 54 | } 55 | 56 | return md; 57 | } 58 | 59 | /** 60 | * Finds the PaRes in an html page. 61 | *

62 | * Note: If more than one PaRes is found in a page only the first will be returned. 63 | * 64 | * @param html String representation of the html page to search within. 65 | * @return PaRes or null if not found 66 | */ 67 | @Nullable 68 | static String findPaRes(@NonNull String html) { 69 | if (html.trim().isEmpty()) return null; 70 | 71 | String paRes = null; 72 | Matcher paresMatcher = paresFinder.matcher(html); 73 | if (paresMatcher.find()) { 74 | paRes = paresMatcher.group(1); 75 | } 76 | 77 | return paRes; 78 | } 79 | 80 | /** 81 | * Finds the CRes in an html page. 82 | *

83 | * Note: If more than one CRes is found in a page only the first will be returned. 84 | * 85 | * @param html String representation of the html page to search within. 86 | * @return CRes or null if not found 87 | */ 88 | @Nullable 89 | public static String findCRes(@NonNull String html) { 90 | if (html.trim().isEmpty()) return null; 91 | 92 | String cRes = null; 93 | Matcher cresMatcher = cresFinder.matcher(html); 94 | if (cresMatcher.find()) { 95 | cRes = cresMatcher.group(1); 96 | } 97 | 98 | return cRes; 99 | } 100 | 101 | /** 102 | * Finds the threeDSSessionData in an html page. 103 | *

104 | * Note: If more than one threeDSSessionData is found in a page only the first will be returned. 105 | * 106 | * @param html String representation of the html page to search within. 107 | * @return threeDSSessionData or null if not found 108 | */ 109 | @Nullable 110 | public static String findThreeDSSessionData(@NonNull String html) { 111 | if (html.trim().isEmpty()) return null; 112 | 113 | String cRes = null; 114 | Matcher threeDSSessionDataMatcher = threeDSSessionDataFinder.matcher(html); 115 | if (threeDSSessionDataMatcher.find()) { 116 | cRes = threeDSSessionDataMatcher.group(1); 117 | } 118 | 119 | return cRes; 120 | } 121 | } -------------------------------------------------------------------------------- /3DSView/src/main/java/eu/livotov/labs/android/d3s/D3SSViewAuthorizationListener.java: -------------------------------------------------------------------------------- 1 | package eu.livotov.labs.android.d3s; 2 | 3 | /** 4 | * (c) Livotov Labs Ltd. 2013 5 | * Alex Askerov, Dmitri Livotov 6 | *

7 | * Date: 20/09/2013 8 | *

9 | * Callback interface to receive authorization events 10 | */ 11 | public interface D3SSViewAuthorizationListener 12 | { 13 | 14 | /** 15 | * Called when remote banking ACS server finishes 3DS authorization. Now you may pass the returned 16 | * MD and PaRes parameters to your credit card processing gateway for finalizing the transaction. 17 | * 18 | * This is called when 3-D Secure v1 completes 19 | * 20 | * @param md MD parameter, sent by ACS server 21 | * @param paRes paRes parameter, sent by ACS server 22 | */ 23 | @Deprecated // 3-D Secure v1 ... this will disappear by the end of 2020 24 | void onAuthorizationCompleted(final String md, final String paRes); 25 | 26 | /** 27 | * Called when remote banking ACS server finishes 3DS authorization. You must 28 | * pass the CRes value to the payment processing gateway to complete the transaction. 29 | * 30 | * This is called when 3-D Secure v2 completes 31 | * 32 | * @param cres 33 | * @param threeDSSessionData - session data from request that's been reflected back in the callback 34 | */ 35 | void onAuthorizationCompleted3dsV2(final String cres, final String threeDSSessionData); 36 | 37 | /** 38 | * Called when authorization process is started and web page from ACS server is being loaded. 39 | * For isntace, you may display progress now, etc... 40 | * 41 | * @param view reference for the DDDSView instance 42 | */ 43 | void onAuthorizationStarted(D3SView view); 44 | 45 | /** 46 | * Called to update the ACS web page loading progress. 47 | * 48 | * @param progress current loading progress from 0 to 100. 49 | */ 50 | void onAuthorizationWebPageLoadingProgressChanged(int progress); 51 | 52 | /** 53 | * Called if a loading error occurs 54 | * 55 | * @param errorCode 56 | * @param description 57 | * @param failingUrl 58 | */ 59 | void onAuthorizationWebPageLoadingError(int errorCode, String description, String failingUrl); 60 | 61 | } 62 | -------------------------------------------------------------------------------- /3DSView/src/main/java/eu/livotov/labs/android/d3s/D3SView.java: -------------------------------------------------------------------------------- 1 | package eu.livotov.labs.android.d3s; 2 | 3 | import android.content.Context; 4 | import android.text.TextUtils; 5 | import android.util.AttributeSet; 6 | import android.webkit.WebChromeClient; 7 | import android.webkit.WebResourceResponse; 8 | import android.webkit.WebView; 9 | import android.webkit.WebViewClient; 10 | 11 | import java.io.UnsupportedEncodingException; 12 | import java.net.URLEncoder; 13 | import java.util.Locale; 14 | import java.util.concurrent.atomic.AtomicBoolean; 15 | 16 | 17 | /** 18 | * (c) Livotov Labs Ltd. 2013 19 | * Alex Askerov, Dmitri Livotov 20 | *

21 | * Date: 20/09/2013 22 | *

23 | *

Intro

24 | *

25 | *

This is the 3DSecure WebView component. It can be used to perform 3D-Secure authorizations when processing internet 26 | * payments in apps. The technology is also named Verified By Visa and MasterCard Secure Code.

27 | *

28 | *

The main idea is to route cardholder to the card issuer financial institution where cardholder will be required to 29 | * answer extra security question or enter one-time sms or token code in order to confirm the card transaction.

30 | *

31 | *

How to use

32 | *

33 | *

Add DDDSView to your layout, set custom (if required) postback url and authorization results listener via the 34 | * corresponding setters. Then invoke the authorize(...) method to start 3D-Secure authorization. You will need to 35 | * provide payment data, which will be issued by your card processor in attempt to make a transaction with the 3DS-capable 36 | * credit card.

37 | *

38 | *

Once user completes the authorization, the authorization listener's onAuthorizationCompleted() method will be called 39 | * with the parameters, came from banking ACS server. Now you can use those parameters in your bckend processing server 40 | * to finalize the payment.

41 | */ 42 | public class D3SView extends WebView { 43 | 44 | /** 45 | * Namespace for JS bridge 46 | */ 47 | private static String JavaScriptNS = "D3SJS"; 48 | 49 | /** 50 | * Url that will be used by ACS server for posting result data on authorization completion. We will be monitoring 51 | * this URL in WebView handler to intercept its loading and grabbing the resulting data from POST message instead. 52 | */ 53 | private String postbackUrl = "https://www.google.com"; 54 | 55 | private AtomicBoolean postbackHandled = new AtomicBoolean(false); 56 | 57 | /** 58 | * 3-D Secure v2 (AKA Strong Customer Authentication). 59 | * This is an indicator as to whether the payment is 3-D Secure v1 or v2 is being performed, so the library has a 60 | * hint to know what field(s) to search for (and avoid unnecessary regular expressions) 61 | */ 62 | private boolean is3dsV2; 63 | 64 | /** 65 | * Callback to send authorization events to 66 | */ 67 | private D3SSViewAuthorizationListener authorizationListener = null; 68 | 69 | 70 | public D3SView(final Context context) { 71 | super(context); 72 | initUI(); 73 | } 74 | 75 | private void initUI() { 76 | getSettings().setJavaScriptEnabled(true); 77 | getSettings().setBuiltInZoomControls(true); 78 | addJavascriptInterface(new D3SJSInterface(), JavaScriptNS); 79 | 80 | setWebViewClient(new WebViewClient() { 81 | 82 | @Override 83 | public WebResourceResponse shouldInterceptRequest(WebView view, String url) { 84 | if (isPostbackUrl(url)) { 85 | // Wait for the form data to be processed in the other thread. 86 | // 1.5s should be more than enough 87 | // 88 | // If for whatever reason the form data isn't captured successfully, this carries on and posts to 89 | // the callback URL (AKA postback URL) 90 | try { 91 | Thread.sleep(1500); 92 | } catch (InterruptedException e) { 93 | // Ignore 94 | } 95 | } 96 | return null; 97 | } 98 | 99 | /* 100 | * In this lifecycle hook the HTML is available, although all resources (CSS, Images etc) may not be 101 | * We are merely processing the HTML though, so hooking in here is fine 102 | */ 103 | @Override 104 | public void onPageCommitVisible(WebView view, String url) { 105 | 106 | if (!isPostbackUrl(url)) { 107 | view.loadUrl(String.format("javascript:window.%s.processHTML(document.getElementsByTagName('html')[0].innerHTML);", JavaScriptNS)); 108 | } 109 | 110 | super.onPageCommitVisible(view, url); 111 | } 112 | 113 | // 114 | public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { 115 | if (!isPostbackUrl(failingUrl)) { 116 | authorizationListener.onAuthorizationWebPageLoadingError(errorCode, description, failingUrl); 117 | } 118 | } 119 | 120 | private boolean isPostbackUrl(String url) { 121 | return url.toLowerCase().startsWith(postbackUrl.toLowerCase()); 122 | } 123 | 124 | }); 125 | 126 | setWebChromeClient(new WebChromeClient() { 127 | 128 | public void onProgressChanged(WebView view, int newProgress) { 129 | if (authorizationListener != null) { 130 | authorizationListener.onAuthorizationWebPageLoadingProgressChanged(newProgress); 131 | } 132 | } 133 | }); 134 | } 135 | 136 | public D3SView(final Context context, final AttributeSet attrs) { 137 | super(context, attrs); 138 | initUI(); 139 | } 140 | 141 | public D3SView(final Context context, final AttributeSet attrs, final int defStyle) { 142 | super(context, attrs, defStyle); 143 | initUI(); 144 | } 145 | 146 | public D3SView(final Context context, final AttributeSet attrs, final int defStyle, final boolean privateBrowsing) { 147 | super(context, attrs, defStyle); 148 | initUI(); 149 | } 150 | 151 | private void completeAuthorizationIfPossible(final String html) { 152 | 153 | // Process HTML in a thread to improve performance 154 | Runnable runnable = () -> { 155 | // If the postback has already been handled, stop now 156 | if (postbackHandled.get()) { 157 | return; 158 | } 159 | 160 | if (is3dsV2) { 161 | match3DSV2Parameters(html); 162 | } else { 163 | match3DSV1Parameters(html); 164 | } 165 | 166 | }; 167 | Thread thread = new Thread(runnable); 168 | thread.start(); 169 | 170 | } 171 | 172 | private void match3DSV2Parameters(String html) { 173 | // Try and find the CRes and threeDSSessionData form elements in the supplied html 174 | final String cRes = D3SRegexUtils.findCRes(html); 175 | if (cRes == null) return; 176 | 177 | final String threeDSSessionData = D3SRegexUtils.findThreeDSSessionData(html); 178 | if (threeDSSessionData == null) return; 179 | 180 | // If we get to this point, we've definitely got values for both the CRes and threeDSSessionData 181 | 182 | // The postbackHandled check is just to ensure we've not already called back. 183 | // We don't want onAuthorizationCompleted to be called twice. 184 | if (postbackHandled.compareAndSet(false, true) && authorizationListener != null) { 185 | authorizationListener.onAuthorizationCompleted3dsV2(cRes, threeDSSessionData); 186 | } 187 | } 188 | 189 | private void match3DSV1Parameters(String html) { 190 | // Try and find the MD and PaRes form elements in the supplied html 191 | final String md = D3SRegexUtils.findMd(html); 192 | if (md == null) return; 193 | 194 | final String paRes = D3SRegexUtils.findPaRes(html); 195 | if (paRes == null) return; 196 | 197 | // If we get to this point, we've definitely got values for both the MD and PaRes 198 | 199 | // The postbackHandled check is just to ensure we've not already called back. 200 | // We don't want onAuthorizationCompleted to be called twice. 201 | if (postbackHandled.compareAndSet(false, true) && authorizationListener != null) { 202 | authorizationListener.onAuthorizationCompleted(md, paRes); 203 | } 204 | } 205 | 206 | /** 207 | * Sets the callback to receive authorization events 208 | * 209 | * @param authorizationListener 210 | */ 211 | public void setAuthorizationListener(final D3SSViewAuthorizationListener authorizationListener) { 212 | this.authorizationListener = authorizationListener; 213 | } 214 | 215 | /** 216 | * Starts 3DS v1 authorization 217 | * 218 | * @param acsUrl ACS server url, returned by the credit card processing gateway 219 | * @param md MD parameter, returned by the credit card processing gateway 220 | * @param paReq PaReq parameter, returned by the credit card processing gateway 221 | */ 222 | public void authorize(final String acsUrl, final String md, final String paReq) { 223 | authorize(acsUrl, null, md, paReq, null, null); 224 | } 225 | 226 | /** 227 | * Starts 3-D Secure v2 authentication 228 | * 229 | * @param acsUrl ACS server url - supplied by the payment gateway 230 | * @param creq - CReq to post to the ACS 231 | * @param threeDSSessionData - Session data to pass to the ACS. This will be reflected back in the callback 232 | * @param postbackUrl - the URL to wait for, so the CRes can be extracted 233 | */ 234 | public void authorize(final String acsUrl, final String creq, final String threeDSSessionData, final String postbackUrl) { 235 | authorize(acsUrl, creq, null, null, threeDSSessionData, postbackUrl); 236 | } 237 | 238 | /** 239 | * Starts 3DS authorization 240 | * 241 | * @param acsUrl ACS server url, returned by the credit card processing gateway 242 | * @param creq CReq parameter (replaces MD and PaReq). 243 | * @param md MD parameter, returned by the credit card processing gateway 244 | * @param paReq PaReq parameter, returned by the credit card processing gateway 245 | * @param postbackUrl custom postback url for intercepting ACS server result posting. You may use any url you like 246 | * here, if you need, even non existing ones. 247 | */ 248 | public void authorize(final String acsUrl, final String creq, final String md, final String paReq, final String threeDSSessionData, final String postbackUrl) { 249 | postbackHandled.set(false); 250 | 251 | if (authorizationListener != null) { 252 | authorizationListener.onAuthorizationStarted(this); 253 | } 254 | 255 | if (!TextUtils.isEmpty(postbackUrl)) { 256 | this.postbackUrl = postbackUrl; 257 | } 258 | 259 | String postParams; 260 | try { 261 | if (creq != null) { 262 | // 3-D Secure v2 263 | is3dsV2 = true; 264 | postParams = String.format(Locale.US, "creq=%1$s&threeDSSessionData=%2$s", URLEncoder.encode(creq, "UTF-8"), URLEncoder.encode(threeDSSessionData, "UTF-8")); 265 | } else { 266 | // 3-D Secure v1 267 | postParams = String.format(Locale.US, "MD=%1$s&TermUrl=%2$s&PaReq=%3$s", URLEncoder.encode(md, "UTF-8"), URLEncoder.encode(this.postbackUrl, "UTF-8"), URLEncoder.encode(paReq, "UTF-8")); 268 | } 269 | } catch (UnsupportedEncodingException e) { 270 | throw new RuntimeException(e); 271 | } 272 | 273 | postUrl(acsUrl, postParams.getBytes()); 274 | } 275 | 276 | class D3SJSInterface { 277 | 278 | D3SJSInterface() { 279 | } 280 | 281 | @android.webkit.JavascriptInterface 282 | public void processHTML(final String html) { 283 | completeAuthorizationIfPossible(html); 284 | } 285 | } 286 | } -------------------------------------------------------------------------------- /3DSView/src/main/res/layout/dialog_3ds.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /3DSView/src/test/java/eu/livotov/labs/android/d3s/D3SRegexUtilsTest.java: -------------------------------------------------------------------------------- 1 | package eu.livotov.labs.android.d3s; 2 | 3 | import org.junit.Test; 4 | 5 | import static com.google.common.truth.Truth.assertThat; 6 | 7 | public class D3SRegexUtilsTest { 8 | 9 | @Test 10 | public void given_empty_html_when_MD_match_attempted_then_should_return_null() { 11 | // Given 12 | String html = ""; 13 | 14 | // When 15 | String result = D3SRegexUtils.findMd(html); 16 | 17 | // Then 18 | assertThat(result) 19 | .isNull(); 20 | } 21 | 22 | @Test 23 | public void given_blank_html_when_MD_match_attempted_then_should_return_null() { 24 | // Given 25 | String html = " "; 26 | 27 | // When 28 | String result = D3SRegexUtils.findMd(html); 29 | 30 | // Then 31 | assertThat(result) 32 | .isNull(); 33 | } 34 | 35 | @Test 36 | public void given_html_with_no_md_when_MD_match_attempted_then_should_return_null() { 37 | // Given 38 | String html = "" + 39 | "\n" + 40 | "\n" + 41 | "\n" + 42 | "
" + 43 | ""; 44 | 45 | // When 46 | String result = D3SRegexUtils.findMd(html); 47 | 48 | // Then 49 | assertThat(result) 50 | .isNull(); 51 | } 52 | 53 | @Test 54 | public void given_html_with_empty_md_when_MD_match_attempted_then_should_return_null() { 55 | // https://github.com/LivotovLabs/3DSView/issues/30 56 | // Given 57 | String html = "" + 58 | "\n" + 59 | "\n" + 60 | "\n" + 61 | "
\n" + 62 | " \n" + 63 | " \n" + 64 | "
" + 65 | ""; 66 | 67 | // When 68 | String result = D3SRegexUtils.findMd(html); 69 | 70 | // Then 71 | assertThat(result) 72 | .isNull(); 73 | } 74 | 75 | @Test 76 | public void given_html_with_valid_md_when_MD_match_attempted_then_should_return_md() { 77 | // Given 78 | String html = "" + 79 | "\n" + 80 | "\n" + 81 | "\n" + 82 | "
\n" + 83 | " \n" + 84 | " \n" + 85 | "
" + 86 | ""; 87 | 88 | // When 89 | String result = D3SRegexUtils.findMd(html); 90 | 91 | // Then 92 | assertThat(result) 93 | .isEqualTo("md_value"); 94 | } 95 | 96 | @Test 97 | public void given_html_with_valid_md_case_insensitive_when_MD_match_attempted_then_should_return_md() { 98 | // Given 99 | String html = "" + 100 | "\n" + 101 | "\n" + 102 | "\n" + 103 | "
\n" + 104 | " \n" + 105 | " \n" + 106 | "
" + 107 | ""; 108 | 109 | // When 110 | String result = D3SRegexUtils.findMd(html); 111 | 112 | // Then 113 | assertThat(result) 114 | .isEqualTo("md_value"); 115 | } 116 | 117 | 118 | @Test 119 | public void given_html_with_valid_md_multiline_when_MD_match_attempted_then_should_return_md() { 120 | // Given 121 | String html = "" + 122 | "\n" + 123 | "\n" + 124 | "\n" + 125 | "
\n" + 126 | " \n" + 131 | " \n" + 136 | "" + 137 | ""; 138 | 139 | // When 140 | String result = D3SRegexUtils.findMd(html); 141 | 142 | // Then 143 | assertThat(result) 144 | .isEqualTo("md_value"); 145 | } 146 | 147 | @Test 148 | public void given_empty_html_when_PaRes_match_attempted_then_should_return_null() { 149 | // Given 150 | String html = ""; 151 | 152 | // When 153 | String result = D3SRegexUtils.findPaRes(html); 154 | 155 | // Then 156 | assertThat(result) 157 | .isNull(); 158 | } 159 | 160 | @Test 161 | public void given_blank_html_when_PaRes_match_attempted_then_should_return_null() { 162 | // Given 163 | String html = " "; 164 | 165 | // When 166 | String result = D3SRegexUtils.findPaRes(html); 167 | 168 | // Then 169 | assertThat(result) 170 | .isNull(); 171 | } 172 | 173 | @Test 174 | public void given_html_with_no_pares_when_PaRes_match_attempted_then_should_return_null() { 175 | // Given 176 | String html = "" + 177 | "\n" + 178 | "\n" + 179 | "\n" + 180 | "
" + 181 | ""; 182 | 183 | // When 184 | String result = D3SRegexUtils.findPaRes(html); 185 | 186 | // Then 187 | assertThat(result) 188 | .isNull(); 189 | } 190 | 191 | @Test 192 | public void given_html_with_empty_pares_when_PaRes_match_attempted_then_should_return_null() { 193 | // https://github.com/LivotovLabs/3DSView/issues/30 194 | // Given 195 | String html = "" + 196 | "\n" + 197 | "\n" + 198 | "\n" + 199 | "
\n" + 200 | " \n" + 201 | " \n" + 202 | "
" + 203 | ""; 204 | 205 | // When 206 | String result = D3SRegexUtils.findPaRes(html); 207 | 208 | // Then 209 | assertThat(result) 210 | .isNull(); 211 | } 212 | 213 | @Test 214 | public void given_html_with_valid_pares_when_PaRes_match_attempted_then_should_return_pares() { 215 | // Given 216 | String html = "" + 217 | "\n" + 218 | "\n" + 219 | "\n" + 220 | "
\n" + 221 | " \n" + 222 | " \n" + 223 | "
" + 224 | ""; 225 | 226 | // When 227 | String result = D3SRegexUtils.findPaRes(html); 228 | 229 | // Then 230 | assertThat(result) 231 | .isEqualTo("pares_value"); 232 | } 233 | 234 | @Test 235 | public void given_html_with_valid_pares_case_insensitive_when_PaRes_match_attempted_then_should_return_pares() { 236 | // Given 237 | String html = "" + 238 | "\n" + 239 | "\n" + 240 | "\n" + 241 | "
\n" + 242 | " \n" + 243 | " \n" + 244 | "
" + 245 | ""; 246 | 247 | // When 248 | String result = D3SRegexUtils.findPaRes(html); 249 | 250 | // Then 251 | assertThat(result) 252 | .isEqualTo("pares_value"); 253 | } 254 | 255 | @Test 256 | public void given_html_with_valid_pares_multiline_when_PaRes_match_attempted_then_should_return_pares() { 257 | // Given 258 | String html = "" + 259 | "\n" + 260 | "\n" + 261 | "\n" + 262 | "
\n" + 263 | " \n" + 268 | " \n" + 273 | "" + 274 | ""; 275 | 276 | // When 277 | String result = D3SRegexUtils.findPaRes(html); 278 | 279 | // Then 280 | assertThat(result) 281 | .isEqualTo("pares_value"); 282 | } 283 | 284 | @Test 285 | public void given_empty_html_when_CRes_match_attempted_then_should_return_null() { 286 | // Given 287 | String html = ""; 288 | 289 | // When 290 | String result = D3SRegexUtils.findCRes(html); 291 | 292 | // Then 293 | assertThat(result) 294 | .isNull(); 295 | } 296 | 297 | @Test 298 | public void given_blank_html_when_CRes_match_attempted_then_should_return_null() { 299 | // Given 300 | String html = " "; 301 | 302 | // When 303 | String result = D3SRegexUtils.findCRes(html); 304 | 305 | // Then 306 | assertThat(result) 307 | .isNull(); 308 | } 309 | 310 | @Test 311 | public void given_html_with_no_cres_when_CRes_match_attempted_then_should_return_null() { 312 | // Given 313 | String html = "" + 314 | "\n" + 315 | "\n" + 316 | "\n" + 317 | "
" + 318 | ""; 319 | 320 | // When 321 | String result = D3SRegexUtils.findCRes(html); 322 | 323 | // Then 324 | assertThat(result) 325 | .isNull(); 326 | } 327 | 328 | @Test 329 | public void given_html_with_empty_cres_when_CRes_match_attempted_then_should_return_null() { 330 | // https://github.com/LivotovLabs/3DSView/issues/30 331 | // Given 332 | String html = "" + 333 | "\n" + 334 | "\n" + 335 | "\n" + 336 | "
\n" + 337 | " \n" + 338 | " \n" + 339 | "
" + 340 | ""; 341 | 342 | // When 343 | String result = D3SRegexUtils.findCRes(html); 344 | 345 | // Then 346 | assertThat(result) 347 | .isNull(); 348 | } 349 | 350 | @Test 351 | public void given_html_with_valid_cres_when_CRes_match_attempted_then_should_return_cres() { 352 | // Given 353 | String html = "" + 354 | "\n" + 355 | "\n" + 356 | "\n" + 357 | "
\n" + 358 | " \n" + 359 | " \n" + 360 | "
" + 361 | ""; 362 | 363 | // When 364 | String result = D3SRegexUtils.findCRes(html); 365 | 366 | // Then 367 | assertThat(result) 368 | .isEqualTo("cres_value"); 369 | } 370 | 371 | @Test 372 | public void given_html_with_valid_cres_case_insensitive_when_CRes_match_attempted_then_should_return_cres() { 373 | // Given 374 | String html = "" + 375 | "\n" + 376 | "\n" + 377 | "\n" + 378 | "
\n" + 379 | " \n" + 380 | " \n" + 381 | "
" + 382 | ""; 383 | 384 | // When 385 | String result = D3SRegexUtils.findCRes(html); 386 | 387 | // Then 388 | assertThat(result) 389 | .isEqualTo("cres_value"); 390 | } 391 | 392 | 393 | @Test 394 | public void given_html_with_valid_cres_multiline_when_CRes_match_attempted_then_should_return_cres() { 395 | // Given 396 | String html = "" + 397 | "\n" + 398 | "\n" + 399 | "\n" + 400 | "
\n" + 401 | " \n" + 406 | " \n" + 411 | "" + 412 | ""; 413 | 414 | // When 415 | String result = D3SRegexUtils.findCRes(html); 416 | 417 | // Then 418 | assertThat(result) 419 | .isEqualTo("cres_value"); 420 | } 421 | 422 | @Test 423 | public void given_empty_html_when_threeDSSessionData_match_attempted_then_should_return_null() { 424 | // Given 425 | String html = ""; 426 | 427 | // When 428 | String result = D3SRegexUtils.findThreeDSSessionData(html); 429 | 430 | // Then 431 | assertThat(result) 432 | .isNull(); 433 | } 434 | 435 | @Test 436 | public void given_blank_html_when_threeDSSessionData_match_attempted_then_should_return_null() { 437 | // Given 438 | String html = " "; 439 | 440 | // When 441 | String result = D3SRegexUtils.findThreeDSSessionData(html); 442 | 443 | // Then 444 | assertThat(result) 445 | .isNull(); 446 | } 447 | 448 | @Test 449 | public void given_html_with_no_threedssessiondata_when_threeDSSessionData_match_attempted_then_should_return_null() { 450 | // Given 451 | String html = "" + 452 | "\n" + 453 | "\n" + 454 | "\n" + 455 | "
" + 456 | ""; 457 | 458 | // When 459 | String result = D3SRegexUtils.findThreeDSSessionData(html); 460 | 461 | // Then 462 | assertThat(result) 463 | .isNull(); 464 | } 465 | 466 | @Test 467 | public void given_html_with_empty_threedssessiondata_when_threeDSSessionData_match_attempted_then_should_return_null() { 468 | // https://github.com/LivotovLabs/3DSView/issues/30 469 | // Given 470 | String html = "" + 471 | "\n" + 472 | "\n" + 473 | "\n" + 474 | "
\n" + 475 | " \n" + 476 | " \n" + 477 | "
" + 478 | ""; 479 | 480 | // When 481 | String result = D3SRegexUtils.findThreeDSSessionData(html); 482 | 483 | // Then 484 | assertThat(result) 485 | .isNull(); 486 | } 487 | 488 | @Test 489 | public void given_html_with_valid_threedssessiondata_when_threeDSSessionData_match_attempted_then_should_return_threedssessiondata() { 490 | // Given 491 | String html = "" + 492 | "\n" + 493 | "\n" + 494 | "\n" + 495 | "
\n" + 496 | " \n" + 497 | " \n" + 498 | "
" + 499 | ""; 500 | 501 | // When 502 | String result = D3SRegexUtils.findThreeDSSessionData(html); 503 | 504 | // Then 505 | assertThat(result) 506 | .isEqualTo("three_ds_session_data"); 507 | } 508 | 509 | @Test 510 | public void given_html_with_valid_threedssessiondata_case_insensitive_when_threeDSSessionData_match_attempted_then_should_return_threedssessiondata() { 511 | // Given 512 | String html = "" + 513 | "\n" + 514 | "\n" + 515 | "\n" + 516 | "
\n" + 517 | " \n" + 518 | " \n" + 519 | "
" + 520 | ""; 521 | 522 | // When 523 | String result = D3SRegexUtils.findThreeDSSessionData(html); 524 | 525 | // Then 526 | assertThat(result) 527 | .isEqualTo("three_ds_session_data"); 528 | } 529 | 530 | 531 | @Test 532 | public void given_html_with_valid_threedssessiondata_multiline_when_threeDSSessionData_match_attempted_then_should_return_threedssessiondata() { 533 | // Given 534 | String html = "" + 535 | "\n" + 536 | "\n" + 537 | "\n" + 538 | "
\n" + 539 | " \n" + 544 | " \n" + 549 | "" + 550 | ""; 551 | 552 | // When 553 | String result = D3SRegexUtils.findThreeDSSessionData(html); 554 | 555 | // Then 556 | assertThat(result) 557 | .isEqualTo("three_ds_session_data"); 558 | } 559 | } -------------------------------------------------------------------------------- /3DSViewSample/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /3DSViewSample/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | compileSdkVersion 30 7 | 8 | defaultConfig { 9 | applicationId "eu.livotov.labs.android.d3s.sample" 10 | minSdkVersion 30 11 | targetSdkVersion 30 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 | 25 | buildFeatures { 26 | viewBinding true 27 | } 28 | 29 | compileOptions { 30 | sourceCompatibility JavaVersion.VERSION_1_8 31 | targetCompatibility JavaVersion.VERSION_1_8 32 | } 33 | } 34 | 35 | dependencies { 36 | implementation project(":3DSView") 37 | 38 | implementation 'androidx.appcompat:appcompat:1.2.0' 39 | implementation 'com.google.android.material:material:1.2.1' 40 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 41 | } -------------------------------------------------------------------------------- /3DSViewSample/proguard-rules.pro: -------------------------------------------------------------------------------- 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 -------------------------------------------------------------------------------- /3DSViewSample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /3DSViewSample/src/main/java/eu/livotov/labs/android/d3s/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package eu.livotov.labs.android.d3s.sample; 2 | 3 | import android.os.Bundle; 4 | import android.util.Log; 5 | import android.view.View; 6 | 7 | import androidx.appcompat.app.AppCompatActivity; 8 | 9 | import eu.livotov.labs.android.d3s.D3SSViewAuthorizationListener; 10 | import eu.livotov.labs.android.d3s.D3SView; 11 | import eu.livotov.labs.android.d3s.sample.databinding.ActivityMainBinding; 12 | 13 | public class MainActivity extends AppCompatActivity { 14 | 15 | private ActivityMainBinding binding; 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | 21 | binding = ActivityMainBinding.inflate(getLayoutInflater()); 22 | View view = binding.getRoot(); 23 | setContentView(view); 24 | 25 | // Set a listener that defines what you wish to happen upon certain callbacks. 26 | binding.d3sView.setAuthorizationListener(new D3SSViewAuthorizationListener() { 27 | @Override 28 | public void onAuthorizationCompleted(String md, String paRes) { 29 | Log.i("D3SSViewAuthorizationListener", "Authorization completed."); 30 | } 31 | 32 | @Override 33 | public void onAuthorizationCompleted3dsV2(String cres, String threeDSSessionData) { 34 | Log.i("D3SSViewAuthorizationListener", "Authorization completed 3dsV2."); 35 | } 36 | 37 | @Override 38 | public void onAuthorizationStarted(D3SView view) { 39 | Log.i("D3SSViewAuthorizationListener", "Authorization started."); 40 | } 41 | 42 | @Override 43 | public void onAuthorizationWebPageLoadingProgressChanged(int progress) { 44 | Log.i("D3SSViewAuthorizationListener", String.format("Web page loading progress: %d.", progress)); 45 | } 46 | 47 | @Override 48 | public void onAuthorizationWebPageLoadingError(int errorCode, String description, String failingUrl) { 49 | Log.e("D3SSViewAuthorizationListener", "Web page loading error."); 50 | } 51 | }); 52 | } 53 | 54 | @Override 55 | protected void onResume() { 56 | super.onResume(); 57 | 58 | // Get your parameters from your backend and then call authorize to begin. 59 | binding.d3sView.authorize("acsUrl", "md", "paReq"); 60 | } 61 | } -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LivotovLabs/3DSView/32384f683a5b4ae2552a36ab28ab2d6c232760b0/3DSViewSample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LivotovLabs/3DSView/32384f683a5b4ae2552a36ab28ab2d6c232760b0/3DSViewSample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LivotovLabs/3DSView/32384f683a5b4ae2552a36ab28ab2d6c232760b0/3DSViewSample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LivotovLabs/3DSView/32384f683a5b4ae2552a36ab28ab2d6c232760b0/3DSViewSample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LivotovLabs/3DSView/32384f683a5b4ae2552a36ab28ab2d6c232760b0/3DSViewSample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LivotovLabs/3DSView/32384f683a5b4ae2552a36ab28ab2d6c232760b0/3DSViewSample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LivotovLabs/3DSView/32384f683a5b4ae2552a36ab28ab2d6c232760b0/3DSViewSample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LivotovLabs/3DSView/32384f683a5b4ae2552a36ab28ab2d6c232760b0/3DSViewSample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LivotovLabs/3DSView/32384f683a5b4ae2552a36ab28ab2d6c232760b0/3DSViewSample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LivotovLabs/3DSView/32384f683a5b4ae2552a36ab28ab2d6c232760b0/3DSViewSample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3DS View Sample 3 | -------------------------------------------------------------------------------- /3DSViewSample/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "[]" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright [yyyy] [name of copyright owner] 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 3DSView (D3SView :) , aka 3D Secure WebView 2 | =========================================== 3 | 4 | Self-contained UI component to process banking 3D Secure (MasterCard SecureCode / Verified By Visa) payment 5 | authorizations in Android apps. 6 | 7 | Why exactly "D3S" ? Simply because Java does not allow to have number as a first character in a package and class names :) 8 | 9 | Component have to be used instead of a WebView and handles the complete payment authorization process from redirecting user to an ACS banking server web UI and to grabbing authorization results and parameters, intercepting post events and parsing the code. 10 | 11 | Simply add it to your layout just instead of a WebView, invoke only two methods and then you have 3DS auth implemented. 12 | 13 | Component can be used in activity, fragment or in any other part of your layout, both declaratively (in xml files) or programmatically by creating an instance in the source code. Only make sure to give it sufficient space on the screen to display the banking ACS web page. 14 | 15 | Status 16 | ====== 17 | 18 | - Current stable version: [ ![Download](https://api.bintray.com/packages/livotovlabs/maven/3DSView/images/download.svg) ](https://bintray.com/livotovlabs/maven/3DSView/_latestVersion) 19 | - Current development version: n/a 20 | 21 | Get It 22 | === 23 | 24 | - Maven repository: jCenter 25 | - Group: eu.livotov.labs.android 26 | - Artifact ID: 3DSView 27 | 28 | ```groovy 29 | implementation 'eu.livotov.labs.android:3DSView:x.y.z@aar' 30 | 31 | ``` 32 | 33 | What's new (1.1.2.9) 34 | ========== 35 | - Latest pull requests merged 36 | - Code reading 37 | 38 | Installation 39 | ============ 40 | 41 | Release versions are available from jCenter repository, so just add the "implementation" statement to your project. For snapshots, please 42 | add our bintray snapshots repository url first: https://dl.bintray.com/livotovlabs/maven 43 | 44 | ```groovy 45 | dependencies { 46 | implementation 'eu.livotov.labs.android:3DSView:x.y.z@aar' 47 | } 48 | ``` 49 | 50 | Alternatively you may download the source code and build it on your own. 51 | 52 | 53 | Quick Usage 54 | =========== 55 | 56 | 1. Build your own or download precompiled 3dsview.jar from releases section and put it to the libs folder of your app project. 57 | 2. Add `eu.livotov.labs.android.d3s.D3SView` to your layout file (or create and add it programmatically) 58 | 3. In corresponding `Activity` or `Fragment`, configure the instance of `D3SView` by calling `DS3View#setAuthorizationListener(D3SViewAuthorizationListener)`. 59 | - This adds a listener to receive authorization results and 60 | progress messages. 61 | - You will receive authorization MD and PaRes values there as well, when 3DSecure completes. 62 | 4. Invoke the `D3SView#authorize(String, String, String)` method by passing MD, PaReq and ACS url values, you receive from your card payment gateway and listen for authorization completion event in your callback. 63 | - Specifying postback url is optional but recommended, the library will use a sensible default value if not set. 64 | 5. Once user completes the authorization at the ACS server, your callback method will be automatically called with the 3DS response data, which you may then pass to your processing backend server for payment finalization. 65 | 66 | For a quick sample see the checkout the [3DSViewSample](https://github.com/LivotovLabs/3DSView/tree/master/3DSViewSample) sub project in this repo. 67 | 68 | Bugs, Suggestions, Ideas 69 | ======================== 70 | Any ideas/bugs/etc, as well as pull requests, are welcome in the [issues section](https://github.com/LivotovLabs/3DSView/issues). 71 | 72 | Credits 73 | ======= 74 | Alex Askerov (@askerov), Mia Alexiou (@subsymbolic), Luke Korth (@lkorth), Christophe Beyls (@cbeyls), Owen O Byrne (@owenobyrne) 75 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.1' 10 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0' 11 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } 27 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | android.useAndroidX=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LivotovLabs/3DSView/32384f683a5b4ae2552a36ab28ab2d6c232760b0/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 25 17:24:47 GMT 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-6.7-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /maven.properties: -------------------------------------------------------------------------------- 1 | # Maven group and artifact ID's 2 | maven.group=eu.livotov.labs.android 3 | maven.artifact=3DSView 4 | 5 | # Project name and short description 6 | maven.name=3DSView 7 | maven.info=Android UI component to process banking 3D Secure (MasterCard SecureCode / Verified By Visa) payment authorizations in Android apps. 8 | 9 | # Project version 10 | maven.version=1.1.2.9 11 | 12 | # VCS tag to reference this version sources 13 | maven.version.tag=v1.1.2.9 14 | 15 | # Project homepage url 16 | maven.url.home=https://github.com/livotovlabs/3DSView 17 | 18 | # Project vcs root url (to be used for clone/checkout) 19 | maven.url.vcs=https://github.com/livotovlabs/3DSView.git 20 | 21 | # Project bugs tracker url 22 | maven.url.issues=https://github.com/livotovlabs/3DSView/issues 23 | 24 | # Main developer information 25 | maven.developer.name=Dmitri Livotov 26 | maven.developer.id=livotov 27 | maven.developer.email=dmitri@livotov.eu 28 | 29 | # Project license name and license text url 30 | maven.license.name=The Apache Software License, Version 2.0 31 | maven.license.url=http://www.apache.org/licenses/LICENSE-2.0.txt 32 | 33 | 34 | 35 | # In order to enable automatic bintray publishing, create the extra "maven.secret.properties" file, 36 | # at the same level as this one, making sure it will not be committed into VCS. Add the following 37 | # sensitive proeprties to it: 38 | # 39 | # maven.bintray.repo= 40 | # maven.bintray.user= 41 | # maven.bintray.org= 42 | # bintray.apikey= 43 | # gpg.secret.password= 44 | # 45 | # Then run: ./gradlew clean assembleRelease install bintrayUpload 46 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':3DSView' 2 | include ':3DSViewSample' 3 | --------------------------------------------------------------------------------