Skip to content

Commit

Permalink
Merge pull request #709 from veritrans/release-1.29.2
Browse files Browse the repository at this point in the history
Release 1.29.2
  • Loading branch information
askur87 authored Aug 6, 2021
2 parents fc4c928 + d48d25c commit 11b9a5e
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 20 deletions.
4 changes: 3 additions & 1 deletion build-system/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ ext {
playAuthVersion = '15.0.1'
okHttpVersion = '3.10.0'
retrofitVersion = '2.4.0'
midtransAnalyticsVersion = '1.7.0'
midtransAnalyticsVersion = '1.7.1'
testRunnerVersion = '0.5'
powermockVersion = '1.6.2'
junitVersion = '4.1.2'
espressoVersion = '2.2.2'
ionVersion = '3.1.0'
gsonVersion = '2.7'
swipeLayoutVersion = '1.0.17'
betterLinkVersion = '2.2.0'
smsVerifyVersion = '0.3.3'
zxingVersion = '3.5.0'
Expand Down Expand Up @@ -47,6 +48,7 @@ ext {
retrofit : "com.squareup.retrofit2:retrofit:${retrofitVersion}",
retrofitConverter : "com.squareup.retrofit2:converter-gson:${retrofitVersion}",
gson : "com.google.code.gson:gson:${gsonVersion}",
swipeLayout : "com.github.rambler-digital-solutions:swipe-layout-android:${swipeLayoutVersion}",
betterLinkMovement : "me.saket:better-link-movement-method:${betterLinkVersion}",
smsVerify : "com.github.stfalcon-studio:SmsVerifyCatcher:${smsVerifyVersion}",
zxing : "com.journeyapps:zxing-android-embedded:${zxingVersion}",
Expand Down
2 changes: 1 addition & 1 deletion build-system/publish-variable.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ext {
groupIdSdk = 'com.midtrans'
versionSdk = '1.29.1'
versionSdk = '1.29.2'

mavenRepo = 'mavencentral'
mavenUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
Expand Down
5 changes: 1 addition & 4 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ apply plugin: 'com.android.application'

repositories {
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs '../libs','libs'
}
}

android {
Expand Down Expand Up @@ -104,6 +101,7 @@ dependencies {
implementation supportLibraries.recyclerview
implementation supportLibraries.cardView
implementation supportLibraries.design
implementation libraries.swipeLayout
implementation localizationLibraries.localization
implementation(libraries.crashlytics) {
transitive = true
Expand All @@ -114,5 +112,4 @@ dependencies {
exclude module: 'corekit'
}
implementation 'com.android.support:multidex:1.0.3'
implementation(name:'swipe-layout-1.1.0', ext:'aar')
}
2 changes: 2 additions & 0 deletions demo/src/main/java/com/midtrans/demo/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ public class Constants {
public static final String INSTALLMENT_BRI = "installment.bri";
public static final String INSTALLMENT_CIMB = "installment.cimb";
public static final String INSTALLMENT_MAYBANK = "installment.maybank";
public static final String INSTALLMENT_OFFLINE = "installment.offline";

public static final String INSTALLMENT_BANK_BNI = "bni";
public static final String INSTALLMENT_BANK_MANDIRI = "mandiri";
public static final String INSTALLMENT_BANK_BCA = "bca";
public static final String INSTALLMENT_BANK_BRI = "bri";
public static final String INSTALLMENT_BANK_CIMB = "cimb";
public static final String INSTALLMENT_BANK_MAYBANK = "maybank";
public static final String INSTALLMENT_BANK_OFFLINE = "offline";

public static final double TOTAL_AMOUNT = 10000;
public static final double TOTAL_AMOUNT_SGD = 5000.5;
Expand Down
54 changes: 51 additions & 3 deletions demo/src/main/java/com/midtrans/demo/DemoConfigActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public class DemoConfigActivity extends AppCompatActivity implements Transaction
private AppCompatRadioButton installmentBriSelection;
private AppCompatRadioButton installmentCimbSelection;
private AppCompatRadioButton installmentMaybankSelection;
private AppCompatRadioButton installmentOfflineSelection;
private AppCompatRadioButton noInstallmentSelection;
/**
* Radio Button selection for BNI Point
Expand Down Expand Up @@ -252,6 +253,7 @@ public class DemoConfigActivity extends AppCompatActivity implements Transaction
private ImageButton editInstallmentBri;
private ImageButton editInstallmentCimb;
private ImageButton editInstallmentMaybank;
private ImageButton editInstallmentOffline;

private boolean installmentRequired;

Expand Down Expand Up @@ -359,6 +361,7 @@ private void bindViews() {
installmentBriSelection = findViewById(R.id.installment_type_bri);
installmentCimbSelection = findViewById(R.id.installment_type_cimb);
installmentMaybankSelection = findViewById(R.id.installment_type_maybank);
installmentOfflineSelection = findViewById(R.id.installment_type_offline);
noInstallmentSelection = findViewById(R.id.no_installment);

normalSelection = findViewById(R.id.type_credit_card_normal);
Expand Down Expand Up @@ -438,6 +441,7 @@ private void bindViews() {
editInstallmentBri = findViewById(R.id.button_bri_installment_edit);
editInstallmentCimb = findViewById(R.id.button_cimb_installment_edit);
editInstallmentMaybank = findViewById(R.id.button_maybank_installment_edit);
editInstallmentOffline = findViewById(R.id.button_offline_installment_edit);
}

private void initTitleClicks() {
Expand Down Expand Up @@ -1890,6 +1894,16 @@ private void initInstallmentSelection() {
setMaybankAcquiringBank();
break;

case Constants.INSTALLMENT_OFFLINE:
String offlineTitle = getString(R.string.using_offline_installment);
installmentTitle.setText(offlineTitle);
installmentOfflineSelection.setChecked(true);
resetBniPointSelection();
resetMandiriPointSelection();
updateSelectedInstallment();
showEditInstallmentOfflineOption();
break;

default:
installmentTitle.setText(R.string.no_installment);
noInstallmentSelection.setChecked(true);
Expand Down Expand Up @@ -2014,7 +2028,23 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
resetMandiriPointSelection();
showInstallmentDialog(false);
showEditInstallmentMaybankOption();
setMaybankAcquiringBank();
}
}
});

installmentOfflineSelection.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
if (checked) {
String title = getString(R.string.using_offline_installment);
installmentTitle.setText(title);
installmentOfflineSelection.setChecked(true);
hideEditInstallmentOption();
resetBniPointSelection();
resetMandiriPointSelection();
showInstallmentDialog(false);
showEditInstallmentCimbOption();
setCimbAcquiringBank();
}
}
});
Expand Down Expand Up @@ -2087,6 +2117,13 @@ public void onClick(View v) {
showInstallmentDialog(installmentRequired);
}
});

editInstallmentOffline.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showInstallmentDialog(installmentRequired);
}
});
}

private void hideEditInstallmentOption() {
Expand All @@ -2096,6 +2133,7 @@ private void hideEditInstallmentOption() {
editInstallmentBri.setVisibility(View.INVISIBLE);
editInstallmentCimb.setVisibility(View.INVISIBLE);
editInstallmentMaybank.setVisibility(View.INVISIBLE);
editInstallmentOffline.setVisibility(View.INVISIBLE);
}

private void showEditInstallmentMandiriOption() {
Expand All @@ -2122,11 +2160,15 @@ private void showEditInstallmentMaybankOption() {
editInstallmentMaybank.setVisibility(View.VISIBLE);
}

private void showEditInstallmentOfflineOption() {
editInstallmentOffline.setVisibility(View.VISIBLE);
}

private void showInstallmentDialog(boolean isRequired) {
InstallmentDialogFragment installmentDialogFragment = InstallmentDialogFragment.newInstance(isRequired, getSelectedColorPrimaryDark(), new CustomInstallmentDialogListener() {
@Override
public void onOkClicked(boolean reqired) {
installmentRequired = reqired;
public void onOkClicked(boolean required) {
installmentRequired = required;
updateSelectedInstallment();
}

Expand Down Expand Up @@ -2161,6 +2203,7 @@ private void resetSelectedInstallment() {
installmentBriSelection.setText(getString(R.string.installment_bri));
installmentCimbSelection.setText(getString(R.string.installment_cimb));
installmentMaybankSelection.setText(getString(R.string.installment_maybank));
installmentOfflineSelection.setText(getString(R.string.installment_offline));
}

private void resetBniPointSelection() {
Expand Down Expand Up @@ -2554,6 +2597,8 @@ private void saveInstallmentSelection() {
DemoPreferenceHelper.setStringPreference(this, INSTALLMENT_TYPE, Constants.INSTALLMENT_CIMB);
} else if (installmentMaybankSelection.isChecked()) {
DemoPreferenceHelper.setStringPreference(this, INSTALLMENT_TYPE, Constants.INSTALLMENT_MAYBANK);
} else if (installmentOfflineSelection.isChecked()) {
DemoPreferenceHelper.setStringPreference(this, INSTALLMENT_TYPE, Constants.INSTALLMENT_OFFLINE);
} else {
DemoPreferenceHelper.setStringPreference(this, INSTALLMENT_TYPE, Constants.NO_INSTALLMENT);
}
Expand Down Expand Up @@ -2880,6 +2925,7 @@ private void updateRadioButtonColor() {
installmentBcaSelection.setSupportButtonTintList(colorStateList);
installmentBriSelection.setSupportButtonTintList(colorStateList);
installmentCimbSelection.setSupportButtonTintList(colorStateList);
installmentOfflineSelection.setSupportButtonTintList(colorStateList);
installmentMaybankSelection.setSupportButtonTintList(colorStateList);
noInstallmentSelection.setSupportButtonTintList(colorStateList);

Expand Down Expand Up @@ -3333,6 +3379,8 @@ private void setInstallmentOption(CreditCard creditCard) {
setInstallmentBankTerm(bankTerms, Constants.INSTALLMENT_BANK_CIMB);
} else if (installmentMaybankSelection.isChecked()) {
setInstallmentBankTerm(bankTerms, Constants.INSTALLMENT_BANK_MAYBANK);
} else if (installmentOfflineSelection.isChecked()) {
setInstallmentBankTerm(bankTerms, Constants.INSTALLMENT_BANK_OFFLINE);
} else {
installment = null;
}
Expand Down
22 changes: 22 additions & 0 deletions demo/src/main/res/layout/layout_demo_installment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@
android:gravity="center_vertical"
android:text="@string/installment_maybank" />

<com.midtrans.demo.widgets.DemoRadioButton
android:id="@+id/installment_type_offline"
style="@style/CustomRadioButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/eight_dp"
android:layout_marginStart="@dimen/eight_dp"
android:gravity="center_vertical"
android:text="@string/installment_offline" />

</RadioGroup>

<LinearLayout
Expand Down Expand Up @@ -200,6 +210,18 @@
android:src="@drawable/ic_edit_icon"
android:visibility="invisible"
tools:visibility="visible" />

<ImageButton
android:id="@+id/button_offline_installment_edit"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:background="?selectableItemBackground"
android:minHeight="30dp"
android:minWidth="12dp"
android:src="@drawable/ic_edit_icon"
android:visibility="invisible"
tools:visibility="visible" />
</LinearLayout>

</LinearLayout>
Expand Down
2 changes: 2 additions & 0 deletions demo/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
<string name="using_bri_installment">BRI Installment</string>
<string name="using_cimb_installment">CIMB Installment</string>
<string name="using_maybank_installment">Maybank Installment</string>
<string name="using_offline_installment">Offline Installment</string>

<!-- BNI Point -->
<string name="bni_point_only_disabled">BNI Point Only Disabled</string>
Expand Down Expand Up @@ -193,6 +194,7 @@
<string name="installment_bri">BRI</string>
<string name="installment_cimb">CIMB</string>
<string name="installment_maybank">Maybank</string>
<string name="installment_offline">Offline</string>
<string name="save_card">Save Card</string>
<string name="reset_setting">Reset</string>
<string name="reset_setting_notification">All Settings are Reset</string>
Expand Down
Binary file removed libs/swipe-layout-1.1.0.aar
Binary file not shown.
8 changes: 1 addition & 7 deletions uikit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ android {
}
}

repositories {
flatDir {
dirs '../libs','libs'
}
}

defaultPublishConfig = DEFAULT_PUBLISH
publishNonDefault true
}
Expand All @@ -84,6 +78,7 @@ dependencies {
implementation supportLibraries.recyclerview
implementation supportLibraries.cardView
implementation supportLibraries.design
implementation libraries.swipeLayout
implementation libraries.betterLinkMovement
implementation libraries.smsVerify
implementation libraries.zxing
Expand Down Expand Up @@ -123,5 +118,4 @@ dependencies {
exclude module: 'hamcrest-core'
exclude module: 'objenesis'
}
implementation(name:'swipe-layout-1.1.0', ext:'aar')
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import java.util.ArrayList;

import static com.midtrans.sdk.uikit.models.CreditCardTransaction.BANK_OFFLINE;

/**
* Created by ziahaqi on 1/19/17.
*/
Expand All @@ -27,6 +29,10 @@ private void init() {

}

public boolean isOfflineInstallmentAvailable() {
return getTerms(BANK_OFFLINE) != null && !getTerms(BANK_OFFLINE).isEmpty();
}

public boolean isInstallmentAvailable() {
return installmentAvailable;
}
Expand All @@ -47,6 +53,7 @@ public ArrayList<Integer> getTerms(String bank) {
}

return null;

}

public int getTermByPosition(int currentPosition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class CreditCardTransaction {

private static final String BANK_OFFLINE = "offline";
public static final String BANK_OFFLINE = "offline";

private CreditCardInstallment cardInstallment;
private CreditCardBankPoint cardBankPoint;
Expand Down Expand Up @@ -74,6 +74,10 @@ public boolean isInstallmentAvailable() {
return cardInstallment.isInstallmentAvailable();
}

public boolean isOfflineInstallmentAvailable() {
return cardInstallment.isOfflineInstallmentAvailable();
}

public boolean isBankBinsAvailable() {
return bankBinsAvailable;
}
Expand Down Expand Up @@ -102,6 +106,18 @@ public ArrayList<Integer> getInstallmentTerms(String cardBin) {
return null;
}

public ArrayList<Integer> getOfflineInstallmentTerms(String cardBin) {
String bank = getBankByBin(cardBin);
if (bank != null && bank.contains("debit")) return null;

ArrayList<Integer> installmentTerms = cardInstallment.getTerms(BANK_OFFLINE);
if (installmentTerms != null) {
return installmentTerms;
}

return null;
}

/**
* @param cardBin get bank by card bin
* @return string Bank
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1339,10 +1339,14 @@ public boolean isTwoClicksMode() {
private void checkInstallment() {
String cardNumber = getCleanedCardNumber();
if (presenter.isInstallmentAvailable()
&& presenter.isCardBinValidForBankChecking(cardNumber)) {
&& presenter.isCardBinValidForBankChecking(cardNumber)) {
String cardBin = getCardNumberBin();
ArrayList<Integer> installmentTerms = presenter.getInstallmentTermsByCardBin(cardBin);

ArrayList<Integer> installmentTerms;
if (presenter.isOfflineInstallmentAvailable()) {
installmentTerms = presenter.getOfflineInstallmentTerms(cardBin);
} else {
installmentTerms = presenter.getInstallmentTermsByCardBin(cardBin);
}
if (installmentTerms != null && installmentTerms.size() > 1) {
setInstallmentTerms(installmentTerms);
setCurrentInstallmentTerm();
Expand Down
Loading

0 comments on commit 11b9a5e

Please sign in to comment.