Skip to content

Commit 77e1e7f

Browse files
committed
remove telecashDeDirectDebit in favor of support deDirectDebit, fix handling of no payment method case
1 parent 176a636 commit 77e1e7f

File tree

6 files changed

+33
-26
lines changed

6 files changed

+33
-26
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [0.13.1]
5+
6+
### Added
7+
- ScanIndicator has now Rectangle and Quadratic styles, via BarcodeScannerView.setIndicatorStyle
8+
9+
### Changed
10+
- Improved BarcodeScannerView ScanIndicator
11+
- Removed support for 'teleCashDeDirectDebit' in favor of 'deDirectDebit' payment method
12+
13+
### Fixed
14+
- Show error message when no payment method is available
15+
416
## [0.13.0]
517

618
### Breaking Changes

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ allprojects {
2323
}
2424

2525
project.ext {
26-
sdkVersion='0.13.0'
26+
sdkVersion='0.13.1'
2727
versionCode=1
2828

2929
compileSdkVersion=28

core/src/main/java/io/snabble/sdk/CheckoutApi.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,19 @@ public PaymentMethod[] getAvailablePaymentMethods(PaymentMethod[] clientAccepted
5757
new TypeToken<List<PaymentMethod>>() {
5858
}.getType());
5959

60-
if (clientAcceptedPaymentMethods != null) {
61-
List<PaymentMethod> result = new ArrayList<>();
60+
if (clientAcceptedPaymentMethods == null) {
61+
clientAcceptedPaymentMethods = PaymentMethod.values();
62+
}
6263

63-
for (PaymentMethod clientPaymentMethod : clientAcceptedPaymentMethods) {
64-
if (paymentMethods.contains(clientPaymentMethod)) {
65-
result.add(clientPaymentMethod);
66-
}
67-
}
64+
List<PaymentMethod> result = new ArrayList<>();
6865

69-
return result.toArray(new PaymentMethod[result.size()]);
70-
} else {
71-
return paymentMethods.toArray(new PaymentMethod[paymentMethods.size()]);
66+
for (PaymentMethod clientPaymentMethod : clientAcceptedPaymentMethods) {
67+
if (paymentMethods.contains(clientPaymentMethod)) {
68+
result.add(clientPaymentMethod);
69+
}
7270
}
71+
72+
return result.toArray(new PaymentMethod[result.size()]);
7373
}
7474
}
7575

core/src/main/java/io/snabble/sdk/PaymentMethod.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ public enum PaymentMethod {
99
ENCODED_CODES(true, false),
1010
@SerializedName("encodedCodesCSV")
1111
ENCODED_CODES_CSV(true, false),
12-
@SerializedName("teleCashDeDirectDebit")
13-
TELECASH_DIRECT_DEBIT(false, true);
12+
@SerializedName("deDirectDebit")
13+
DE_DIRECT_DEBIT(false, true);
1414

1515
private boolean requiresCredentials;
1616
private boolean isOfflineMethod;

ui/src/main/java/io/snabble/sdk/ui/checkout/CheckoutView.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import android.app.ProgressDialog;
66
import android.content.Context;
77
import android.content.DialogInterface;
8-
import android.os.Handler;
9-
import android.os.Looper;
8+
109
import androidx.coordinatorlayout.widget.CoordinatorLayout;
1110
import android.util.AttributeSet;
1211
import android.view.KeyEvent;
@@ -16,12 +15,9 @@
1615
import android.widget.ViewAnimator;
1716

1817
import io.snabble.sdk.Checkout;
19-
import io.snabble.sdk.Snabble;
2018
import io.snabble.sdk.encodedcodes.EncodedCodesOptions;
21-
import io.snabble.sdk.ui.KeyguardHandler;
2219
import io.snabble.sdk.ui.R;
2320
import io.snabble.sdk.ui.SnabbleUI;
24-
import io.snabble.sdk.ui.SnabbleUICallback;
2521
import io.snabble.sdk.ui.utils.DelayedProgressDialog;
2622
import io.snabble.sdk.ui.utils.UIUtils;
2723
import io.snabble.sdk.utils.SimpleActivityLifecycleCallbacks;
@@ -111,7 +107,7 @@ public void onStateChanged(Checkout.State state) {
111107

112108
private void displayPaymentView() {
113109
switch (checkout.getSelectedPaymentMethod()) {
114-
case TELECASH_DIRECT_DEBIT:
110+
case DE_DIRECT_DEBIT:
115111
displayView(new CheckoutStatusView(getContext()));
116112
break;
117113
case QRCODE_POS:

ui/src/main/java/io/snabble/sdk/ui/checkout/PaymentMethodView.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import androidx.recyclerview.widget.LinearLayoutManager;
1111
import androidx.recyclerview.widget.RecyclerView;
1212

13-
import android.content.res.Resources;
1413
import android.text.Spannable;
1514
import android.text.SpannableString;
1615
import android.text.method.LinkMovementMethod;
@@ -53,7 +52,7 @@ class PaymentMethodView extends FrameLayout implements PaymentCredentialsStore.C
5352
private static Map<PaymentMethod, String> descriptions = new HashMap<>();
5453

5554
static {
56-
icons.put(PaymentMethod.TELECASH_DIRECT_DEBIT, R.drawable.ic_pm_sepa);
55+
icons.put(PaymentMethod.DE_DIRECT_DEBIT, R.drawable.ic_pm_sepa);
5756
icons.put(PaymentMethod.QRCODE_POS, R.drawable.ic_pm_checkstand);
5857
icons.put(PaymentMethod.ENCODED_CODES, R.drawable.ic_pm_checkstand);
5958
icons.put(PaymentMethod.ENCODED_CODES_CSV, R.drawable.ic_pm_checkstand);
@@ -122,7 +121,7 @@ private void update() {
122121
e.text = descriptions.get(paymentMethod);
123122
e.paymentMethod = paymentMethod;
124123

125-
if(paymentMethod == PaymentMethod.TELECASH_DIRECT_DEBIT) {
124+
if(paymentMethod == PaymentMethod.DE_DIRECT_DEBIT) {
126125
e.onClickListener = new OnClickListener() {
127126
@Override
128127
public void onClick(View v) {
@@ -138,7 +137,7 @@ public void onClick(View v) {
138137
for(PaymentCredentials p : paymentCredentials) {
139138
if (p.getType() == PaymentCredentials.Type.SEPA) {
140139
for(Entry e : entries) {
141-
if (e.paymentMethod == PaymentMethod.TELECASH_DIRECT_DEBIT) {
140+
if (e.paymentMethod == PaymentMethod.DE_DIRECT_DEBIT) {
142141
entries.remove(e);
143142
break;
144143
}
@@ -147,9 +146,9 @@ public void onClick(View v) {
147146
}
148147

149148
for(PaymentCredentials p : paymentCredentials) {
150-
if (p.getType() == PaymentCredentials.Type.SEPA && availablePaymentMethods.contains(PaymentMethod.TELECASH_DIRECT_DEBIT)) {
149+
if (p.getType() == PaymentCredentials.Type.SEPA && availablePaymentMethods.contains(PaymentMethod.DE_DIRECT_DEBIT)) {
151150
Entry e = new Entry();
152-
e.paymentMethod = PaymentMethod.TELECASH_DIRECT_DEBIT;
151+
e.paymentMethod = PaymentMethod.DE_DIRECT_DEBIT;
153152
e.paymentCredentials = p;
154153
e.text = p.getObfuscatedId();
155154
entries.add(e);
@@ -172,7 +171,7 @@ private void showSEPACardInput() {
172171
}
173172

174173
private void showSEPALegalInfoIfNeeded(final PaymentMethod paymentMethod, final OnClickListener clickListener) {
175-
if (paymentMethod != PaymentMethod.TELECASH_DIRECT_DEBIT) {
174+
if (paymentMethod != PaymentMethod.DE_DIRECT_DEBIT) {
176175
clickListener.onClick(null);
177176
return;
178177
}

0 commit comments

Comments
 (0)