Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 9df803b

Browse files
Release 6.1.0.
1 parent 7b7f854 commit 9df803b

Some content is hidden

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

47 files changed

+170
-361
lines changed

Jenkinsfile

Lines changed: 0 additions & 141 deletions
This file was deleted.

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ buildscript {
88
dependencies {
99
classpath 'com.android.tools.build:gradle:7.4.1'
1010
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0'
11+
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3"
1112
}
1213
}
1314

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
# Specifies the JVM arguments used for the daemon process.
1111
# The setting is particularly useful for tweaking memory settings.
1212
# Default value: -Xmx10248m -XX:MaxPermSize=256m
13-
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
13+
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
1414

1515
# When configured, Gradle will run in incubating parallel mode.
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
1919
POM_GROUP_ID=com.ingenico.connect.gateway
2020
POM_ARTIFACT_ID=connect-sdk-client-android
21-
POM_VERSION=6.0.1
21+
POM_VERSION=6.1.0
2222
POM_NAME=connect-sdk-client-android
2323
POM_DESCRIPTION=SDK to communicate with the Ingenico ePayments platform using the Ingenico Connect Client API
2424
POM_URL=https://github.com/Ingenico-ePayments/connect-sdk-client-android

ingenicoconnect-sdk/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77
id 'kotlin-android'
88
id 'signing'
99
id 'maven-publish'
10+
id 'org.sonarqube'
1011
}
1112

1213
android {
@@ -17,6 +18,7 @@ android {
1718
targetSdkVersion 33
1819
versionCode 1
1920
versionName "1.0"
21+
consumerProguardFiles 'consumer-rules.pro'
2022
}
2123

2224
compileOptions {
@@ -32,7 +34,6 @@ android {
3234
buildTypes {
3335
release {
3436
minifyEnabled false
35-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
3637
}
3738
}
3839
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@
1515
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
1616
# public *;
1717
#}
18+
19+
# The line below ensures that JSON deserialisation succeeds when using obfuscation in your app.
20+
-keep class com.ingenico.connect.gateway.sdk.client.android.sdk.model.** { *; }

ingenicoconnect-sdk/src/main/java/com/ingenico/connect/gateway/sdk/client/android/sdk/GooglePayUtil.java

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,18 @@ public static boolean isGooglePayAllowed(Context context, C2sCommunicator commun
8080
// Wait for a response
8181
try {
8282
Tasks.await(task, Constants.ACCEPTABLE_WAIT_TIME_IN_MILISECONDS, TimeUnit.MILLISECONDS);
83+
84+
// Handle result
85+
if (task.isSuccessful()) {
86+
return task.getResult();
87+
}
88+
89+
return false;
8390
} catch (TimeoutException e) {
8491
Log.e(TAG, "Timeout while making isReadyToPay call: " + task.getException());
92+
return false;
8593
} catch (Exception e) {
8694
Log.e(TAG, "Exception occurred while making isReadyToPay call: " + task.getException());
87-
}
88-
// Handle result
89-
if (task.isSuccessful()) {
90-
return task.getResult();
91-
} else {
92-
Log.e(TAG, "Exception occurred while making isReadyToPay call: " + task.getException());
9395
return false;
9496
}
9597
}
@@ -129,17 +131,19 @@ public static boolean isGooglePayAllowed(BasicPaymentProduct googlePay) {
129131
// Wait for a response
130132
try {
131133
Tasks.await(task, Constants.ACCEPTABLE_WAIT_TIME_IN_MILISECONDS, TimeUnit.MILLISECONDS);
134+
135+
// Handle result
136+
if (task.isSuccessful()) {
137+
return task.getResult();
138+
}
139+
140+
return false;
132141
} catch (TimeoutException e) {
133142
Log.e(TAG, "Timeout while making isReadyToPay call: " + task.getException());
143+
return false;
134144
} catch (Exception e) {
135145
Log.e(TAG, "Exception occurred while making isReadyToPay call: " + task.getException());
136-
}
137-
// Handle result
138-
if (task.isSuccessful()) {
139-
return task.getResult();
140-
} else {
141-
Log.e(TAG, "Exception occurred while making isReadyToPay call: " + task.getException());
142-
return true;
146+
return false;
143147
}
144148
}
145149

ingenicoconnect-sdk/src/main/java/com/ingenico/connect/gateway/sdk/client/android/sdk/Util.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.ingenico.connect.gateway.sdk.client.android.sdk.configuration.Constants;
1313
import com.ingenico.connect.gateway.sdk.client.android.sdk.encryption.EncryptUtil;
1414

15+
import java.nio.charset.StandardCharsets;
1516
import java.util.HashMap;
1617
import java.util.Map;
1718

@@ -62,7 +63,7 @@ public static Map<String, String> getMetadata(Context context, String appIdentif
6263
throw new IllegalArgumentException("Error creating metadata, context may not be null.");
6364
}
6465

65-
Map<String, String> metaData = new HashMap<String, String>();
66+
Map<String, String> metaData = new HashMap<>();
6667

6768
// Add OS + buildversion
6869
metaData.put(METADATA_PLATFORM_IDENTIFIER, "Android/" + android.os.Build.VERSION.RELEASE);
@@ -109,7 +110,7 @@ public static String getBase64EncodedMetadata(Context context, String appIdentif
109110

110111
Gson gson = new Gson();
111112
String jsonMetadata = gson.toJson(getMetadata(context, appIdentifier, null));
112-
String encodedData = new String(encryptUtil.base64UrlEncode(jsonMetadata.getBytes()));
113+
String encodedData = new String(encryptUtil.base64UrlEncode(jsonMetadata.getBytes(StandardCharsets.UTF_8)));
113114

114115
return encodedData;
115116
}
@@ -126,7 +127,7 @@ public static String getBase64EncodedMetadata(Context context, String appIdentif
126127

127128
Gson gson = new Gson();
128129
String jsonMetadata = gson.toJson(getMetadata(context, appIdentifier, ipAddress));
129-
String encodedData = new String(encryptUtil.base64UrlEncode(jsonMetadata.getBytes()));
130+
String encodedData = new String(encryptUtil.base64UrlEncode(jsonMetadata.getBytes(StandardCharsets.UTF_8)));
130131

131132
return encodedData;
132133
}
@@ -143,7 +144,7 @@ public static String getBase64EncodedMetadata(Map<String, String> metadata) {
143144

144145
Gson gson = new Gson();
145146
String jsonMetadata = gson.toJson(metadata);
146-
String encodedData = new String(encryptUtil.base64UrlEncode(jsonMetadata.getBytes()));
147+
String encodedData = new String(encryptUtil.base64UrlEncode(jsonMetadata.getBytes(StandardCharsets.UTF_8)));
147148

148149
return encodedData;
149150
}

ingenicoconnect-sdk/src/main/java/com/ingenico/connect/gateway/sdk/client/android/sdk/asynctask/BasicPaymentItemsAsyncTask.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ protected BasicPaymentItems doInBackground(String... params) {
9696
ExecutorService executorService = Executors.newFixedThreadPool(2);
9797

9898
// Create the callables that will be executed
99-
Callable<BasicPaymentProducts> paymentProductsCallable = new BasicPaymentProductsAsyncTask(context, paymentContext, communicator, new LinkedList<OnBasicPaymentProductsCallCompleteListener>());
100-
Callable<BasicPaymentProductGroups> paymentProductGroupsCallable = new BasicPaymentProductGroupsAsyncTask(context, paymentContext, communicator, new LinkedList<OnBasicPaymentProductGroupsCallCompleteListener>());
99+
Callable<BasicPaymentProducts> paymentProductsCallable = new BasicPaymentProductsAsyncTask(context, paymentContext, communicator, new LinkedList<>());
100+
Callable<BasicPaymentProductGroups> paymentProductGroupsCallable = new BasicPaymentProductGroupsAsyncTask(context, paymentContext, communicator, new LinkedList<>());
101101

102102
// Retrieve the futures from the callable tasks
103103
Future<BasicPaymentProducts> paymentProductsFuture = executorService.submit(paymentProductsCallable);
@@ -111,17 +111,14 @@ protected BasicPaymentItems doInBackground(String... params) {
111111
// Return a list of the basicPaymentProducts and basicPaymentProductGroups combined
112112
return createBasicPaymentItems(basicPaymentProducts, basicPaymentProductGroups);
113113

114-
} catch (InterruptedException e) {
115-
Log.i(TAG, "Error while getting paymentItems: " + e.getMessage());
116-
e.printStackTrace();
117-
} catch (ExecutionException e) {
114+
} catch (InterruptedException | ExecutionException e) {
118115
Log.i(TAG, "Error while getting paymentItems: " + e.getMessage());
119116
e.printStackTrace();
120117
}
121118
} else {
122119

123120
// Create the paymentProductsCallable
124-
Callable<BasicPaymentProducts> paymentProductsCallable = new BasicPaymentProductsAsyncTask(context, paymentContext, communicator, new LinkedList<OnBasicPaymentProductsCallCompleteListener>());
121+
Callable<BasicPaymentProducts> paymentProductsCallable = new BasicPaymentProductsAsyncTask(context, paymentContext, communicator, new LinkedList<>());
125122
try {
126123

127124
// Retrieve the basicPaymentProducts
@@ -229,6 +226,6 @@ protected void onPostExecute(BasicPaymentItems basicPaymentItems) {
229226
*/
230227
@Deprecated
231228
public interface OnBasicPaymentItemsCallCompleteListener {
232-
public void onBasicPaymentItemsCallComplete(BasicPaymentItems basicPaymentItems);
229+
void onBasicPaymentItemsCallComplete(BasicPaymentItems basicPaymentItems);
233230
}
234231
}

ingenicoconnect-sdk/src/main/java/com/ingenico/connect/gateway/sdk/client/android/sdk/asynctask/BasicPaymentProductGroupsAsyncTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,6 @@ private BasicPaymentProductGroups getPaymentProductGroupsInBackground() {
104104
*/
105105
@Deprecated
106106
public interface OnBasicPaymentProductGroupsCallCompleteListener {
107-
public void onBasicPaymentProductGroupsCallComplete(BasicPaymentProductGroups basicPaymentProductGroups);
107+
void onBasicPaymentProductGroupsCallComplete(BasicPaymentProductGroups basicPaymentProductGroups);
108108
}
109109
}

ingenicoconnect-sdk/src/main/java/com/ingenico/connect/gateway/sdk/client/android/sdk/asynctask/BasicPaymentProductsAsyncTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,6 @@ private BasicPaymentProduct getPaymentProduct(BasicPaymentProducts basicPaymentP
158158
*/
159159
@Deprecated
160160
public interface OnBasicPaymentProductsCallCompleteListener {
161-
public void onBasicPaymentProductsCallComplete(BasicPaymentProducts basicPaymentProducts);
161+
void onBasicPaymentProductsCallComplete(BasicPaymentProducts basicPaymentProducts);
162162
}
163163
}

0 commit comments

Comments
 (0)