Skip to content

Commit

Permalink
Hot Fix for NPE
Browse files Browse the repository at this point in the history
getPaymentOptionsDataManager().getPaymentOptionsResponse() null check
  • Loading branch information
AhlaamK-tap committed Apr 4, 2023
1 parent 32d610c commit 2e659fc
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Mon Dec 19 15:08:25 AST 2022
#Tue Apr 04 11:39:46 AST 2023
gradle.version=5.4.1
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# CHANGELOG
[3.16.2] - 2023-04-04
### Hot Fix:
- Bug fix for NPE
### Impact on existing integrations:
- The update does not impact existing integrations.
### Recommended changes for existing integrations before updating:
- None.
[3.16.1] - 2023-01-23
### Enhancement Feature:
- New Callback added to get when a charge is initiated
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ To integrate goSellSDK into your project add it in your **root** `build.gradle`
Step 2. Add the dependency
```java
dependencies {
implementation 'com.github.Tap-Payments:goSellSDK-AndroidX:3.16.1'
implementation 'com.github.Tap-Payments:goSellSDK-AndroidX:3.16.2'
}
```

Expand Down
7 changes: 7 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'

group = 'com.github.Tap-Payments'
def getVersionName = { ->
try {
Expand All @@ -22,6 +23,7 @@ android {
versionCode 2
versionName getVersionName()
consumerProguardFiles 'proguard-rules.pro'
multiDexEnabled true

}
buildTypes {
Expand Down Expand Up @@ -73,6 +75,11 @@ dependencies {
implementation 'org.jetbrains:annotations:15.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.0'



implementation 'androidx.multidex:multidex:2.0.1'

}

task sourcesJar(type: Jar) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ protected void onCreate(Bundle savedInstanceState) {

overridePendingTransition(R.anim.slide_in_top, android.R.anim.fade_out);
setupScreenMode();
if(ThemeObject.getInstance().getAppearanceMode()!=null)
apperanceMode = ThemeObject.getInstance().getAppearanceMode();

if (apperanceMode == AppearanceMode.WINDOWED_MODE) {
Expand Down Expand Up @@ -265,7 +266,8 @@ private void setupHeader() {

} else {
String logoPath = "";
if (PaymentDataManager.getInstance().getPaymentOptionsDataManager().getPaymentOptionsResponse() != null &&

if (PaymentDataManager.getInstance().getPaymentOptionsDataManager()!=null && PaymentDataManager.getInstance().getPaymentOptionsDataManager().getPaymentOptionsResponse() != null &&
PaymentDataManager.getInstance().getPaymentOptionsDataManager().getPaymentOptionsResponse().getMerchant() != null &&
PaymentDataManager.getInstance().getPaymentOptionsDataManager().getPaymentOptionsResponse().getMerchant().getLogo() != null
) {
Expand All @@ -289,6 +291,7 @@ private void setupHeader() {
businessName.setTextSize(ThemeObject.getInstance().getHeaderTextSize());
if (ThemeObject.getInstance().getHeaderBackgroundColor() != 0)
toolbar.setBackgroundColor(ThemeObject.getInstance().getHeaderBackgroundColor());

}

private void setupPayButton() {
Expand Down Expand Up @@ -477,19 +480,21 @@ private void startCardPaymentProcess(CardCredentialsViewModel paymentOptionViewM

/////////////////////////////////////////////////// start function that initiate payment by creating charge --------------------------
private void getVisibleViewModels() {
for (int i = 0; i < PaymentDataManager.getInstance().getPaymentOptionsDataManager().getSize(); i++) {
if (PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i) instanceof RecentSectionViewModel) {
recentSectionViewModel = (RecentSectionViewModel) PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i);
if(PaymentDataManager.getInstance().getPaymentOptionsDataManager()!=null && PaymentDataManager.getInstance().getPaymentOptionsDataManager().getSize()>0) {
for (int i = 0; i < PaymentDataManager.getInstance().getPaymentOptionsDataManager().getSize(); i++) {
if (PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i) instanceof RecentSectionViewModel) {
recentSectionViewModel = (RecentSectionViewModel) PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i);

} else if (PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i) instanceof GroupViewModel) {
groupViewModel = (GroupViewModel) PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i);
} else if (PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i) instanceof GroupViewModel) {
groupViewModel = (GroupViewModel) PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i);

} else if (PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i) instanceof WebPaymentViewModel) {
webPaymentViewModel = (WebPaymentViewModel) PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i);
} else if (PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i) instanceof WebPaymentViewModel) {
webPaymentViewModel = (WebPaymentViewModel) PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i);

} else if (PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i) instanceof CardCredentialsViewModel) {
cardCredentialsViewModel = (CardCredentialsViewModel) PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i);
} else if (PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i) instanceof CardCredentialsViewModel) {
cardCredentialsViewModel = (CardCredentialsViewModel) PaymentDataManager.getInstance().getPaymentOptionsDataManager().getViewModel(i);

}
}
}
}
Expand Down

0 comments on commit 2e659fc

Please sign in to comment.