Skip to content

Commit cfd8de0

Browse files
Digicert fix (#95)
Updated legacy authentication methods that do not comply with modern security standards.
1 parent f66bfd3 commit cfd8de0

34 files changed

+436
-259
lines changed

.DS_Store

6 KB
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ To determine which processor you use, you can submit an API call to [getMerchant
2020

2121
# Setting Up Your Project
2222

23-
1. Confirm that you are using Android Studio 2.3+ with min Android SDK version 21 and Gradle 2.14.1.
23+
1. Confirm that you are using Android Studio Koala with min Android SDK version 34 and Gradle 8.7.
2424
2. Select *File > Open > sampleapp* to open the project.
2525
3. Run Sync in Gradle to bring all the dependencies up to date.
2626
4. Plug in the test reader and run the sample application.

emv-anet-sdk.aar

-1.41 MB
Binary file not shown.

sampleapp/app/.gitignore

100755100644
File mode changed.

sampleapp/app/build.gradle

100755100644
Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 27
5-
buildToolsVersion '27.0.3'
4+
namespace "authorize.net.inperson_sdk_android"
5+
compileSdk 34
66

77
defaultConfig {
88
applicationId "authorize.net.inperson_sdk_android"
9-
minSdkVersion 21
10-
targetSdkVersion 27
9+
minSdkVersion 29
10+
targetSdkVersion 34
1111
versionCode 2
1212
versionName "1.1"
1313
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -21,21 +21,33 @@ android {
2121
packagingOptions{
2222
exclude 'META-INF/DEPENDENCIES'
2323
}
24+
sourceSets {
25+
main.java.srcDirs += 'src/main/kotlin'
26+
}
2427
}
2528

2629
dependencies {
27-
compile fileTree(dir: 'libs', include: ['*.jar'])
28-
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
29-
exclude group: 'com.android.support', module: 'support-annotations'
30-
})
31-
compile project(':emv-anet-sdk')
32-
compile 'com.android.support:cardview-v7:27.1.1'
33-
compile 'com.android.support:appcompat-v7:27.1.1'
34-
compile 'com.android.support:design:27.1.1'
35-
compile 'com.madgag.spongycastle:prov:1.53.0.0'
36-
compile 'org.apache.httpcomponents:httpcore:4.4.1'
37-
compile 'org.apache.httpcomponents:httpclient:4.5'
38-
testCompile 'junit:junit:4.12'
39-
testCompile 'org.hamcrest:hamcrest-library:1.3'
30+
implementation fileTree(include: ['*.jar'], dir: 'libs')
31+
implementation files('../emv-anet-sdk/emv-anet-sdk.aar')
32+
// Remove old support library dependencies
33+
// implementation 'com.android.support:cardview-v7:27.1.1'
34+
// implementation 'com.android.support:appcompat-v7:27.1.1'
35+
// implementation 'com.android.support:design:27.1.1'
36+
37+
// Add AndroidX equivalents
38+
implementation 'androidx.cardview:cardview:1.0.0'
39+
implementation 'androidx.appcompat:appcompat:1.3.1'
40+
implementation 'com.google.android.material:material:1.4.0'
41+
implementation 'androidx.fragment:fragment:1.3.6'
42+
43+
implementation 'com.madgag.spongycastle:prov:1.53.0.0'
44+
implementation 'org.apache.httpcomponents:httpcore:4.4.1'
45+
implementation 'org.apache.httpcomponents:httpclient:4.5'
46+
implementation 'com.google.code.gson:gson:2.8.8'
4047

48+
testImplementation 'junit:junit:4.13.2'
49+
androidTestImplementation 'androidx.test:rules:1.4.0'
50+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
51+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
52+
androidTestImplementation 'junit:junit:4.12'
4153
}

sampleapp/app/proguard-rules.pro

100755100644
File mode changed.

sampleapp/app/src/androidTest/java/authorize/net/inperson_sdk_android/ApplicationTest.java

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package authorize.net.inperson_sdk_android;
22

3-
import android.app.Activity;
4-
import android.app.Application;
5-
import android.content.Context;
6-
import android.content.Intent;
7-
import android.test.ApplicationTestCase;
3+
import android.bluetooth.BluetoothDevice;
4+
import androidx.test.ext.junit.runners.AndroidJUnit4;
85
import android.util.Log;
96

10-
import junit.framework.Assert;
7+
import static org.junit.Assert.assertFalse;
8+
import static org.junit.Assert.assertTrue;
119

1210
import net.authorize.Environment;
1311
import net.authorize.Merchant;
@@ -24,16 +22,17 @@
2422
import net.authorize.mobile.Result;
2523
import net.authorize.util.StringUtils;
2624

25+
import org.junit.Before;
26+
import org.junit.runner.RunWith;
27+
2728
import java.math.BigDecimal;
29+
import java.util.List;
2830

2931
/**
3032
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
3133
*/
32-
public class ApplicationTest extends ApplicationTestCase<Application> {
33-
public ApplicationTest() {
34-
super(Application.class);
35-
}
36-
34+
@RunWith(AndroidJUnit4.class)
35+
public class ApplicationTest {
3736
static final String TestLogTab = "INTestLogs";
3837

3938
EMVTransactionManager.QuickChipTransactionSessionListener iemvTransaction = new EMVTransactionManager.QuickChipTransactionSessionListener() {
@@ -66,13 +65,28 @@ public void onEMVReadError(EMVErrorCode emvError) {
6665
public void onEMVTransactionError(net.authorize.aim.emv.Result result, EMVErrorCode emvError) {
6766
assertTrue("this error case should be handled by client application", false);
6867
}
69-
};
7068

71-
@Override
72-
protected void setUp() throws Exception {
73-
super.setUp();
69+
@Override
70+
public void onReturnBluetoothDevices(List<BluetoothDevice> list) {
71+
// Log the list of Bluetooth devices
72+
for (BluetoothDevice device : list) {
73+
Log.d(TestLogTab, "Bluetooth Device: " + device.getName() + " - " + device.getAddress());
74+
}
75+
}
7476

77+
@Override
78+
public void onBluetoothDeviceConnected(BluetoothDevice bluetoothDevice) {
79+
Log.d(TestLogTab, "Bluetooth Device Connected: " + bluetoothDevice.getName() + " - " + bluetoothDevice.getAddress());
80+
}
81+
82+
@Override
83+
public void onBluetoothDeviceDisConnected() {
84+
Log.d(TestLogTab, "Bluetooth Device Disconnected");
85+
}
86+
};
7587

88+
@Before
89+
protected void setUp() throws Exception {
7690
//setup crendentials
7791
PasswordAuthentication passAuth = PasswordAuthentication
7892
.createMerchantAuthentication("MobileCNP1", "mPOSAnet2", "Android-Integration-tests");
@@ -133,16 +147,4 @@ EMVTransaction sampleEMVTransaction() {
133147
return emvTransaction;
134148

135149
}
136-
137-
138-
139-
140-
141-
142-
143-
@Override
144-
protected void tearDown() throws Exception {
145-
super.tearDown();
146-
terminateApplication();
147-
}
148150
}

sampleapp/app/src/androidTest/java/authorize/net/inperson_sdk_android/ExampleInstrumentedTest.java

100755100644
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package authorize.net.inperson_sdk_android;
22

33
import android.content.Context;
4-
import android.support.test.InstrumentationRegistry;
5-
import android.support.test.runner.AndroidJUnit4;
4+
5+
import androidx.test.ext.junit.runners.AndroidJUnit4;
6+
import androidx.test.platform.app.InstrumentationRegistry;
7+
68

79
import org.junit.Test;
810
import org.junit.runner.RunWith;
@@ -19,8 +21,7 @@ public class ExampleInstrumentedTest {
1921
@Test
2022
public void useAppContext() throws Exception {
2123
// Context of the app under test.
22-
Context appContext = InstrumentationRegistry.getTargetContext();
23-
24+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
2425
assertEquals("authorize.net.inperson_sdk_android", appContext.getPackageName());
2526
}
2627
}

sampleapp/app/src/androidTest/java/authorize/net/inperson_sdk_android/IDTechBlobTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import net.authorize.data.swiperdata.SwiperEncryptionAlgorithmType;
1010
import net.authorize.data.swiperdata.SwiperModeType;
1111
import net.authorize.util.StringUtils;
12+
import static org.junit.Assert.assertTrue;
1213

1314
import java.math.BigDecimal;
1415

sampleapp/app/src/androidTest/java/authorize/net/inperson_sdk_android/PriorAuthCaptureTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import net.authorize.data.Order;
1111
import net.authorize.data.OrderItem;
1212
import net.authorize.data.creditcard.CreditCard;
13+
import static org.junit.Assert.assertTrue;
1314

1415
import java.math.BigDecimal;
1516

0 commit comments

Comments
 (0)