diff --git a/CHANGELOG.md b/CHANGELOG.md index a853bc2..6a65e90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 3.8.1 (2023-03-17) +- Chore: Upgrade sentry-android to 6.15.0 +- Chore: Update sentry dsn + ## 3.8.0 (2023-03-13) - Feat: Added storeCVN method for caching cvn on subsequent multi-use token purpose - Feat: Added storeCVN test page @@ -49,4 +53,4 @@ Features: Features: -- Add `should_3ds` (boolean) field in multi use or skip authentication tokenization result, accessible using `.getShould_3DS` \ No newline at end of file +- Add `should_3ds` (boolean) field in multi use or skip authentication tokenization result, accessible using `.getShould_3DS` diff --git a/README.md b/README.md index f621b70..225cbbf 100644 --- a/README.md +++ b/README.md @@ -31,24 +31,24 @@ Maven: com.xendit xendit-android - 3.8.0 + 3.8.1 pom ``` Gradle: ``` -compile 'com.xendit:xendit-android:3.8.0' +compile 'com.xendit:xendit-android:3.8.1' ``` Ivy: ``` - + ``` -For more information, visit https://central.sonatype.dev/artifact/com.xendit/xendit-android/3.8.0/versions +For more information, visit https://central.sonatype.dev/artifact/com.xendit/xendit-android/3.8.1/versions **Note**: diff --git a/xendit-android/build.gradle b/xendit-android/build.gradle index 5291379..9d31856 100644 --- a/xendit-android/build.gradle +++ b/xendit-android/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'maven-publish' apply plugin: 'com.jfrog.bintray' group 'com.xendit' -version '3.8.0' +version '3.8.1' ext { bintrayOrg = 'xendit' @@ -27,7 +27,7 @@ ext { licenseName = 'MIT' licenseUrl = 'https://opensource.org/licenses/MIT' - allLicenses = ["MIT"] + allLicenses = ['MIT'] } android { @@ -36,17 +36,21 @@ android { minSdkVersion 21 targetSdkVersion 30 versionCode 1 - versionName + versionName '3.8.1' testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } buildTypes { release { minifyEnabled false consumerProguardFiles 'proguard-rules.pro' + buildConfigField('long', 'VERSION_CODE', "${defaultConfig.versionCode}") + buildConfigField('String','VERSION_NAME', "\"${defaultConfig.versionName}\"") } debug { minifyEnabled false consumerProguardFiles 'proguard-rules.pro' + buildConfigField('long', 'VERSION_CODE', "${defaultConfig.versionCode}") + buildConfigField('String','VERSION_NAME', "\"${defaultConfig.versionName}\"") } } productFlavors { @@ -68,7 +72,7 @@ dependencies { implementation 'com.snowplowanalytics:snowplow-android-tracker:2.1.1@aar' // sentry - api 'io.sentry:sentry-android:4.3.0' + api 'io.sentry:sentry-android:6.15.0' // this dependency is not required if you are already using your own // slf4j implementation diff --git a/xendit-android/src/main/AndroidManifest.xml b/xendit-android/src/main/AndroidManifest.xml index f5be310..f711964 100644 --- a/xendit-android/src/main/AndroidManifest.xml +++ b/xendit-android/src/main/AndroidManifest.xml @@ -1,11 +1,15 @@ + - - + + + - \ No newline at end of file + diff --git a/xendit-android/src/main/java/com/xendit/Xendit.java b/xendit-android/src/main/java/com/xendit/Xendit.java index 0f9390e..9a092b7 100644 --- a/xendit-android/src/main/java/com/xendit/Xendit.java +++ b/xendit-android/src/main/java/com/xendit/Xendit.java @@ -5,6 +5,8 @@ import android.app.Activity; import android.content.Context; import android.content.IntentFilter; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Build; @@ -28,7 +30,6 @@ import com.xendit.Models.BillingDetails; import com.xendit.Models.Card; import com.xendit.Models.Customer; -import com.xendit.Models.Jwt; import com.xendit.Models.ThreeDSRecommendation; import com.xendit.Models.Token; import com.xendit.Models.XenditError; @@ -43,14 +44,12 @@ import com.xendit.utils.PermissionUtils; import com.xendit.utils.StoreCVNCallback; -import org.json.JSONArray; - import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; -import java.util.Map; +import io.sentry.Hint; import io.sentry.Sentry; import io.sentry.SentryEvent; import io.sentry.SentryOptions; @@ -73,8 +72,7 @@ public class Xendit { private static final String CREATE_CREDIT_CARD_URL = PRODUCTION_XENDIT_BASE_URL + "/credit_card_tokens"; private static final String CREATE_CREDIT_CARD_TOKEN_URL = PRODUCTION_XENDIT_BASE_URL + "/v2/credit_card_tokens"; private static final String GET_3DS_URL = PRODUCTION_XENDIT_BASE_URL + "/3ds_bin_recommendation"; - private static final String CREATE_JWT_URL = PRODUCTION_XENDIT_BASE_URL + "/credit_card_tokens/:token_id/jwt"; - private static final String DNS_SERVER = "https://182c197ad5c04f878fef7eab1e0cbcd6@sentry.io/262922"; + private static final String DNS_SERVER = "https://7190a1331444434eb6aed7b5a8d776f0@o30316.ingest.sentry.io/6314580"; private static final String CLIENT_IDENTIFIER = "Xendit Android SDK"; private static final String CLIENT_API_VERSION = "2.0.0"; private static final String CLIENT_TYPE = "SDK"; @@ -106,9 +104,21 @@ public Xendit(final Context context, String publishableKey) { SentryAndroid.init(context, new Sentry.OptionsConfiguration() { @Override public void configure(SentryAndroidOptions sentryAndroidOptions) { + try { + PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); + String versionName = pInfo.versionName; + String applicationName = context.getApplicationInfo().loadLabel(context.getPackageManager()).toString(); + + sentryAndroidOptions.setTag("applicationName", applicationName); + sentryAndroidOptions.setTag("applicationVersionName", versionName); + sentryAndroidOptions.setTag("sdkVersionName", BuildConfig.VERSION_NAME); + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + } + sentryAndroidOptions.setBeforeSend(new SentryOptions.BeforeSendCallback() { @Override - public SentryEvent execute(SentryEvent event, Object o) { + public SentryEvent execute(SentryEvent event, Hint hint) { // decide whether to send the event for (SentryException sentryException : event.getExceptions()) { SentryStackTrace stackTrace = sentryException.getStacktrace(); @@ -121,6 +131,7 @@ public SentryEvent execute(SentryEvent event, Object o) { return null; } }); + sentryAndroidOptions.setDsn(DNS_SERVER); } }); @@ -881,10 +892,10 @@ private void _createAuthentication(String tokenId, String amount, String currenc BaseRequest request = buildBaseRequest(Request.Method.POST, requestUrl, onBehalfOf, Authentication.class, new DefaultResponseHandler<>(handler)); request.addParam("amount", amount); - if (currency != null && currency != "") { + if (currency != null && !currency.isEmpty()) { request.addParam("currency", currency); } - if (cardCvn != null && cardCvn != "") { + if (cardCvn != null && !cardCvn.isEmpty()) { request.addParam("card_cvn", cardCvn); } sendRequest(request, handler); @@ -971,7 +982,7 @@ private BaseRequest buildBaseRequest(int method, String url, String onBehalfOf, String encodedKey = encodeBase64(publishableKey + ":"); String basicAuthCredentials = "Basic " + encodedKey; BaseRequest request = new BaseRequest<>(method, url, type, handler); - if (onBehalfOf != null && onBehalfOf != "") { + if (onBehalfOf != null && !onBehalfOf.isEmpty()) { request.addHeader("for-user-id", onBehalfOf); } request.addHeader("Authorization", basicAuthCredentials.replace("\n", ""));