Skip to content

Commit df27755

Browse files
committed
fix listing of sepa cards in payment credentials list view
1 parent 4825346 commit df27755

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed

CHANGELOG.md

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

4+
## [0.49.2]
5+
6+
### Fixed
7+
- Fixed added SEPA Cards not showing up in payment credentials list view
8+
49
## [0.49.1]
510

611
### Fixed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ allprojects {
3131
}
3232

3333
project.ext {
34-
sdkVersion='0.49.1'
34+
sdkVersion='0.49.2'
3535
versionCode=1
3636

3737
compileSdkVersion=31

core/src/main/java/io/snabble/sdk/payment/PaymentCredentials.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public static PaymentCredentials fromSEPA(String name, String iban) {
179179
pc.brand = Brand.UNKNOWN;
180180
pc.appId = Snabble.getInstance().getConfig().appId;
181181

182-
if (pc.encryptedData == null) {
182+
if (pc.rsaEncryptedData == null) {
183183
return null;
184184
}
185185

@@ -380,7 +380,7 @@ public static PaymentCredentials fromTegutEmployeeCard(String obfuscatedId, Stri
380380
data.cardNumber = cardNumber;
381381
String json = GsonHolder.get().toJson(data, TegutEmployeeCard.class);
382382

383-
pc.encryptedData = pc.rsaEncrypt(certificate, json.getBytes());
383+
pc.rsaEncryptedData = pc.rsaEncrypt(certificate, json.getBytes());
384384
pc.signature = pc.sha256Signature(certificate);
385385
pc.brand = Brand.UNKNOWN;
386386
pc.appId = Snabble.getInstance().getConfig().appId;

core/src/main/java/io/snabble/sdk/payment/PaymentCredentialsStore.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ public int getCountForProject(Project project) {
303303
if (pc.getProjectId().equals(project.getId()) && onlineMethods.contains(pc.getPaymentMethod())) {
304304
count++;
305305
}
306+
} else {
307+
if (pc.getType() == PaymentCredentials.Type.SEPA && onlineMethods.contains(pc.getPaymentMethod())) {
308+
count++;
309+
}
306310
}
307311
}
308312
}

ui/src/main/java/io/snabble/sdk/ui/payment/PaymentCredentialsListView.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,17 @@ public void onChanged() {
167167
sameProjectOrNull = project.getId().equals(pm.getProjectId());
168168
}
169169

170+
if (pm.getProjectId() == null && pm.getType() == PaymentCredentials.Type.SEPA) {
171+
sameProjectOrNull = true;
172+
}
173+
170174
boolean sameTypeOrNull = true;
171175
if (types != null) {
172-
sameTypeOrNull = types.contains(pm.getType());
176+
if (project != null) {
177+
sameTypeOrNull = project.getAvailablePaymentMethods().contains(pm.getPaymentMethod());
178+
} else {
179+
sameTypeOrNull = types.contains(pm.getType());
180+
}
173181
}
174182

175183
if (pm.isAvailableInCurrentApp() && sameTypeOrNull && sameProjectOrNull) {

0 commit comments

Comments
 (0)