Skip to content

Commit d9d7d15

Browse files
authored
Update paydirect descriptions and icons to griopay (#163)
### What's new? Changed the old paydirekt description and icons to giropay description and logo. Changed classes and functions naming from paydirekt to giropay. Fixed bug causing the app to crash due to a missing project id, then navigation to the GiropayInputFragment
1 parent 6c98cb0 commit d9d7d15

38 files changed

+199
-146
lines changed

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@ All notable changes to this project will be documented in this file.
33

44
## UNRELEASED
55
### Added
6-
### Changed
6+
### Changed
77
### Removed
88
### Fixed
99

10+
## [0.72.0]
11+
### Changed
12+
* core/ui : Update icons and description from paydirekt to GiroPay
13+
* The use of the following functions changed:
14+
* PaydirektInputActivity/Fragment/View changed to GirpayInputActivity/Fragment/View
15+
* PaymentCredentials.fromPaydirekt(...) changed to PaymentCredentials.fromGiropay(...)
16+
* PaydirektAuthorizationData changed to GiropayAuthorizationData and is now a data class
17+
* PaydirektData changed to GiropayData and is now a data class
18+
* The UI event for paydirekt changed from SHOW_PAYDIREKT_INPUT to SHOW_GIROPAY_INPUT
19+
* ### Fixed
20+
* ui: Fixed crash caused by missing project id when calling the PaydirektInputFragment via the PaymentInputViewHelper
21+
1022
## [0.71.8]
1123
### Changed
1224
* Use nio API desugaring instead of the default variant (#159)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ enum class PaymentMethod(
124124
),
125125

126126
@SerializedName("paydirektOneKlick")
127-
PAYDIREKT(
127+
GIROPAY(
128128
id = "paydirektOneKlick",
129129
isOfflineMethod = false,
130130
isRequiringCredentials = true,

core/src/main/java/io/snabble/sdk/Snabble.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ object Snabble {
221221
/**
222222
* Url for generating payone web form authentication challenges
223223
*/
224-
var paydirektAuthUrl: String? = null
224+
var giropayAuthUrl: String? = null
225225
private set
226226

227227
/**
@@ -525,7 +525,7 @@ object Snabble {
525525
createAppUserUrl = getUrl(jsonObject, "createAppUser")
526526
telecashSecretUrl = getUrl(jsonObject, "telecashSecret")
527527
telecashPreAuthUrl = getUrl(jsonObject, "telecashPreauth")
528-
paydirektAuthUrl = getUrl(jsonObject, "paydirektCustomerAuthorization")
528+
giropayAuthUrl = getUrl(jsonObject, "paydirektCustomerAuthorization")
529529
if (jsonObject.has("brands")) {
530530
parseBrands(jsonObject)
531531
}

core/src/main/java/io/snabble/sdk/checkout/DefaultCheckoutApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class DefaultCheckoutApi(private val project: Project,
228228
cardNumber = paymentCredentials.obfuscatedId,
229229
)
230230
}
231-
PaymentCredentials.Type.PAYDIREKT -> {
231+
PaymentCredentials.Type.GIROPAY -> {
232232
PaymentInformation(
233233
originType = paymentCredentials.type.originType,
234234
encryptedOrigin = paymentCredentials.encryptedData,

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

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import io.snabble.sdk.PaymentMethod;
3939
import io.snabble.sdk.R;
4040
import io.snabble.sdk.Snabble;
41+
import io.snabble.sdk.payment.data.GiropayAuthorizationData;
42+
import io.snabble.sdk.payment.data.GiropayData;
4143
import io.snabble.sdk.payment.externalbilling.data.ExternalBillingPaymentCredentials;
4244
import io.snabble.sdk.payment.payone.sepa.PayoneSepaData;
4345
import io.snabble.sdk.utils.GsonHolder;
@@ -57,7 +59,7 @@ public enum Type {
5759
@Deprecated
5860
CREDIT_CARD(null, true, Arrays.asList(PaymentMethod.VISA, PaymentMethod.MASTERCARD, PaymentMethod.AMEX)),
5961
CREDIT_CARD_PSD2(null, true, Arrays.asList(PaymentMethod.VISA, PaymentMethod.MASTERCARD, PaymentMethod.AMEX)),
60-
PAYDIREKT(null, false, Collections.singletonList(PaymentMethod.PAYDIREKT)),
62+
GIROPAY(null, false, Collections.singletonList(PaymentMethod.GIROPAY)),
6163
TEGUT_EMPLOYEE_CARD("tegutEmployeeID", false, Collections.singletonList(PaymentMethod.TEGUT_EMPLOYEE_CARD)),
6264
LEINWEBER_CUSTOMER_ID("leinweberCustomerID", false, Collections.singletonList(PaymentMethod.LEINWEBER_CUSTOMER_ID)),
6365
DATATRANS("datatransAlias", true, Arrays.asList(PaymentMethod.TWINT, PaymentMethod.POST_FINANCE_CARD)),
@@ -146,12 +148,6 @@ private static class CreditCardData {
146148
private String cardType;
147149
}
148150

149-
private static class PaydirektData {
150-
private String clientID;
151-
private String customerAuthorizationURI;
152-
private PaydirektAuthorizationData authorizationData;
153-
}
154-
155151
private static class DatatransData {
156152
private String alias;
157153
private String expiryMonth;
@@ -170,17 +166,6 @@ private static class PayoneData {
170166
private final String userID;
171167
}
172168

173-
@RestrictTo(RestrictTo.Scope.LIBRARY)
174-
public static class PaydirektAuthorizationData {
175-
public String id;
176-
public String name;
177-
public String ipAddress;
178-
public String fingerprint;
179-
public String redirectUrlAfterSuccess;
180-
public String redirectUrlAfterCancellation;
181-
public String redirectUrlAfterFailure;
182-
}
183-
184169
private static class TegutEmployeeCard {
185170
private String cardNumber;
186171
}
@@ -395,27 +380,28 @@ private static long parseValidTo(String format, String expirationDate) {
395380
/**
396381
* Encrypts and stores a paydirekt authorization token.
397382
*/
398-
public static PaymentCredentials fromPaydirekt(PaydirektAuthorizationData authorizationData, String customerAuthorizationURI) {
383+
public static PaymentCredentials fromGiropay(GiropayAuthorizationData authorizationData, String customerAuthorizationURI) {
399384
if (customerAuthorizationURI == null) {
400385
return null;
401386
}
402387

403388
PaymentCredentials pc = new PaymentCredentials();
404389
pc.generateId();
405-
pc.type = Type.PAYDIREKT;
390+
pc.type = Type.GIROPAY;
406391

407392
List<X509Certificate> certificates = Snabble.getInstance().getPaymentCertificates();
408393
if (certificates.size() == 0) {
409394
return null;
410395
}
411396

412-
pc.obfuscatedId = "paydirekt";
413-
414-
PaydirektData paydirektData = new PaydirektData();
415-
paydirektData.clientID = Snabble.getInstance().getClientId();
416-
paydirektData.customerAuthorizationURI = customerAuthorizationURI;
397+
pc.obfuscatedId = "giropay";
398+
GiropayData data = new GiropayData(
399+
Snabble.getInstance().getClientId(),
400+
customerAuthorizationURI,
401+
null
402+
);
417403

418-
String json = GsonHolder.get().toJson(paydirektData, PaydirektData.class);
404+
String json = GsonHolder.get().toJson(data, GiropayData.class);
419405

420406
X509Certificate certificate = certificates.get(0);
421407
pc.rsaEncryptedData = pc.rsaEncrypt(certificate, json.getBytes());
@@ -908,8 +894,8 @@ public PaymentMethod getPaymentMethod() {
908894
return PaymentMethod.TEGUT_EMPLOYEE_CARD;
909895
} else if (type == Type.LEINWEBER_CUSTOMER_ID) {
910896
return PaymentMethod.LEINWEBER_CUSTOMER_ID;
911-
} else if (type == Type.PAYDIREKT) {
912-
return PaymentMethod.PAYDIREKT;
897+
} else if (type == Type.GIROPAY) {
898+
return PaymentMethod.GIROPAY;
913899
} else if (type == Type.EXTERNAL_BILLING) {
914900
return PaymentMethod.EXTERNAL_BILLING;
915901
} else if (type == Type.CREDIT_CARD_PSD2
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package io.snabble.sdk.payment.data
2+
3+
data class GiropayAuthorizationData(
4+
@JvmField val id: String,
5+
@JvmField val name: String,
6+
@JvmField val ipAddress: String,
7+
@JvmField val fingerprint: String,
8+
@JvmField val redirectUrlAfterSuccess: String,
9+
@JvmField val redirectUrlAfterCancellation: String,
10+
@JvmField val redirectUrlAfterFailure: String
11+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package io.snabble.sdk.payment.data
2+
3+
data class GiropayData(
4+
@JvmField val clientID: String?,
5+
@JvmField val customerAuthorizationURI: String,
6+
@JvmField val authorizationData: GiropayAuthorizationData? = null,
7+
)
8+

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
compileSdk = "33"
33
targetSdk = "32"
44
minSdk = "21"
5-
gradlePlugin = "8.1.1"
5+
gradlePlugin = "8.1.4"
66
desugarVersion = "1.1.5"
77
okhttpVersion = "4.10.0"
88
# @pin always, manually updated to ensure overall dependency support

kotlin-sample/src/main/java/io/snabble/sdk/sample/SnabbleUiEventHandler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ fun setUpUiEvents(activity: AppCompatActivity, navController: NavController, bot
4444
}
4545
SnabbleUI.setUiAction(
4646
activity,
47-
SnabbleUI.Event.SHOW_PAYDIREKT_INPUT
47+
SnabbleUI.Event.SHOW_GIROPAY_INPUT
4848
) { _, args ->
49-
navController.navigate(R.id.navigation_paydirekt_input, args)
49+
navController.navigate(R.id.navigation_giropay_input, args)
5050
}
5151
SnabbleUI.setUiAction(
5252
activity,

kotlin-sample/src/main/res/navigation/mobile_navigation.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@
156156
android:label="Checkout" />
157157

158158
<fragment
159-
android:id="@+id/navigation_paydirekt_input"
160-
android:name="io.snabble.sdk.ui.payment.PaydirektInputFragment"
161-
android:label="Paydirekt" />
159+
android:id="@+id/navigation_giropay_input"
160+
android:name="io.snabble.sdk.ui.payment.GiropayInputFragment"
161+
android:label="@string/Snabble.Giropay.title" />
162162
<fragment
163163
android:id="@+id/navigation_payone_input"
164164
android:name="io.snabble.sdk.ui.payment.PayoneInputFragment"

0 commit comments

Comments
 (0)