Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ All notable changes to this project will be documented in this file.
### Removed
### Fixed

## [0.83.4]
### Removed
* core/ui: remove tegut employee card as payment method

## [0.83.3]
### Changed
* ui: show coupons as part of the shopping cart and change discount design
Expand Down
12 changes: 1 addition & 11 deletions core/src/main/java/io/snabble/sdk/PaymentMethod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ enum class PaymentMethod(
needsAbortConfirmation = true
),

@SerializedName("externalBilling")
TEGUT_EMPLOYEE_CARD(
id = "externalBilling",
isOfflineMethod = false,
isRequiringCredentials = true,
isShowOnlyIfCredentialsArePresent = true,
needsAbortConfirmation = true
),

@SerializedName("customerCardPOS")
CUSTOMERCARD_POS(
id = "customerCardPOS",
Expand Down Expand Up @@ -200,9 +191,8 @@ enum class PaymentMethod(
@JvmStatic
fun fromIdAndOrigin(id: String, origin: List<String>): PaymentMethod? {
entries.forEach { pm ->
if (pm.id == id && pm.id == TEGUT_EMPLOYEE_CARD.id) {
if (pm.id == id && pm.id == EXTERNAL_BILLING.id) {
return when (origin.firstOrNull()) {
"tegutEmployeeID" -> TEGUT_EMPLOYEE_CARD
"contactPersonCredentials" -> EXTERNAL_BILLING
else -> null
}
Expand Down
43 changes: 0 additions & 43 deletions core/src/main/java/io/snabble/sdk/payment/PaymentCredentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public enum Type {
CREDIT_CARD(null, true, Arrays.asList(PaymentMethod.VISA, PaymentMethod.MASTERCARD, PaymentMethod.AMEX)),
CREDIT_CARD_PSD2(null, true, Arrays.asList(PaymentMethod.VISA, PaymentMethod.MASTERCARD, PaymentMethod.AMEX)),
GIROPAY(null, false, Collections.singletonList(PaymentMethod.GIROPAY)),
TEGUT_EMPLOYEE_CARD("tegutEmployeeID", false, Collections.singletonList(PaymentMethod.TEGUT_EMPLOYEE_CARD)),
DATATRANS("datatransAlias", true, Arrays.asList(PaymentMethod.TWINT, PaymentMethod.POST_FINANCE_CARD)),
DATATRANS_CREDITCARD("datatransCreditCardAlias", true, Arrays.asList(PaymentMethod.VISA, PaymentMethod.MASTERCARD, PaymentMethod.AMEX)),
PAYONE_CREDITCARD(null, true, Arrays.asList(PaymentMethod.VISA, PaymentMethod.MASTERCARD, PaymentMethod.AMEX)),
Expand Down Expand Up @@ -528,46 +527,6 @@ public static PaymentCredentials fromPayone(
return pc;
}

/**
* Encrypts and stores a tegut employee card.
*/
public static PaymentCredentials fromTegutEmployeeCard(String obfuscatedId, String cardNumber, String projectId) {
if (cardNumber == null || cardNumber.length() != 19
|| (!cardNumber.startsWith("9280001621")
&& !cardNumber.startsWith("9280001620"))) {
return null;
}

PaymentCredentials pc = new PaymentCredentials();
pc.generateId();
pc.type = Type.TEGUT_EMPLOYEE_CARD;

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

pc.obfuscatedId = obfuscatedId;

X509Certificate certificate = certificates.get(0);

TegutEmployeeCard data = new TegutEmployeeCard();
data.cardNumber = cardNumber;
String json = GsonHolder.get().toJson(data, TegutEmployeeCard.class);

pc.rsaEncryptedData = pc.rsaEncrypt(certificate, json.getBytes());
pc.signature = pc.sha256Signature(certificate);
pc.brand = Brand.UNKNOWN;
pc.appId = Snabble.getInstance().getConfig().appId;
pc.projectId = projectId;

if (pc.rsaEncryptedData == null) {
return null;
}

return pc;
}

/**
* Returns the type of the payment credentials
*/
Expand Down Expand Up @@ -858,8 +817,6 @@ public PaymentMethod getPaymentMethod() {
return PaymentMethod.DE_DIRECT_DEBIT;
} else if (getType() == Type.PAYONE_SEPA) {
return PaymentMethod.PAYONE_SEPA;
} else if (type == Type.TEGUT_EMPLOYEE_CARD) {
return PaymentMethod.TEGUT_EMPLOYEE_CARD;
} else if (type == Type.GIROPAY) {
return PaymentMethod.GIROPAY;
} else if (type == Type.EXTERNAL_BILLING) {
Expand Down
4 changes: 0 additions & 4 deletions ui/src/main/java/io/snabble/sdk/ui/cart/CheckoutBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,6 @@ open class CheckoutBar @JvmOverloads constructor(
if (entry.paymentCredentials != null) {
progressDialog.dismiss()
when (entry.paymentMethod) {
PaymentMethod.TEGUT_EMPLOYEE_CARD -> {
project.checkout.pay(entry.paymentMethod, entry.paymentCredentials)
}

PaymentMethod.EXTERNAL_BILLING -> {
SubjectAlertDialog(context, maxSubjectLength = getMaxSubjectLength())
.addMessageClickListener { message ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ public void onChanged() {
case GIROPAY:
entries.add(new Entry(pm, R.drawable.snabble_ic_payment_giropay, pm.getObfuscatedId()));
break;
case TEGUT_EMPLOYEE_CARD:
entries.add(new Entry(pm, R.drawable.snabble_ic_payment_select_tegut, pm.getObfuscatedId()));
break;
case EXTERNAL_BILLING:
entries.add(new Entry(pm, R.drawable.snabble_ic_external_billing, pm.getObfuscatedId()));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import io.snabble.sdk.PaymentMethod.PAYONE_SEPA
import io.snabble.sdk.PaymentMethod.POST_FINANCE_CARD
import io.snabble.sdk.PaymentMethod.QRCODE_OFFLINE
import io.snabble.sdk.PaymentMethod.QRCODE_POS
import io.snabble.sdk.PaymentMethod.TEGUT_EMPLOYEE_CARD
import io.snabble.sdk.PaymentMethod.TWINT
import io.snabble.sdk.PaymentMethod.VISA
import io.snabble.sdk.ui.R.drawable.snabble_ic_external_billing
Expand All @@ -27,7 +26,6 @@ import io.snabble.sdk.ui.R.drawable.snabble_ic_payment_select_pos
import io.snabble.sdk.ui.R.drawable.snabble_ic_payment_select_postfinance
import io.snabble.sdk.ui.R.drawable.snabble_ic_payment_select_sco
import io.snabble.sdk.ui.R.drawable.snabble_ic_payment_select_sepa
import io.snabble.sdk.ui.R.drawable.snabble_ic_payment_select_tegut
import io.snabble.sdk.ui.R.drawable.snabble_ic_payment_select_twint
import io.snabble.sdk.ui.R.drawable.snabble_ic_payment_select_visa
import io.snabble.sdk.ui.R.string.Snabble_Giropay_title
Expand All @@ -51,7 +49,6 @@ class PaymentMethodMetaDataHelper(
PAYONE_SEPA withMeta ("SEPA-Lastschrift" to snabble_ic_payment_select_sepa),
GATEKEEPER_TERMINAL withMeta (Snabble_Payment_payAtSCO.resolved to snabble_ic_payment_select_sco),
EXTERNAL_BILLING withMeta (Snabble_Payment_ExternalBilling_title.resolved to snabble_ic_external_billing),
TEGUT_EMPLOYEE_CARD withMeta ("Tegut... Mitarbeiterkarte" to snabble_ic_payment_select_tegut),
CUSTOMERCARD_POS withMeta (Snabble_Payment_payAtCashDesk.resolved to snabble_ic_payment_select_pos),
QRCODE_POS withMeta (Snabble_Payment_payAtCashDesk.resolved to snabble_ic_payment_select_pos),
QRCODE_OFFLINE withMeta (Snabble_Payment_payAtCashDesk.resolved to snabble_ic_payment_select_pos),
Expand Down
Loading