-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define endpoint to get localized bank mandate text
- Loading branch information
1 parent
9b1b03b
commit e1aa734
Showing
6 changed files
with
97 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...e/src/main/java/org/whispersystems/textsecuregcm/subscriptions/BankMandateTranslator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2023 Signal Messenger, LLC | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
package org.whispersystems.textsecuregcm.subscriptions; | ||
|
||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Objects; | ||
import java.util.ResourceBundle; | ||
import javax.annotation.Nonnull; | ||
import org.signal.i18n.HeaderControlledResourceBundleLookup; | ||
|
||
public class BankMandateTranslator { | ||
private static final String BASE_NAME = "org.signal.bankmandate.BankMandate"; | ||
private final HeaderControlledResourceBundleLookup headerControlledResourceBundleLookup; | ||
|
||
public BankMandateTranslator( | ||
@Nonnull final HeaderControlledResourceBundleLookup headerControlledResourceBundleLookup) { | ||
this.headerControlledResourceBundleLookup = Objects.requireNonNull(headerControlledResourceBundleLookup); | ||
} | ||
|
||
public String translate(final List<Locale> acceptableLanguages, final BankTransferType bankTransferType) { | ||
final ResourceBundle resourceBundle = headerControlledResourceBundleLookup.getResourceBundle(BASE_NAME, | ||
acceptableLanguages); | ||
return resourceBundle.getString(getKey(bankTransferType)); | ||
} | ||
|
||
private static String getKey(final BankTransferType bankTransferType) { | ||
return switch (bankTransferType) { | ||
case SEPA_DEBIT -> "SEPA_MANDATE"; | ||
}; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
service/src/main/java/org/whispersystems/textsecuregcm/subscriptions/BankTransferType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright 2023 Signal Messenger, LLC | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
package org.whispersystems.textsecuregcm.subscriptions; | ||
|
||
public enum BankTransferType { | ||
SEPA_DEBIT | ||
} |
7 changes: 7 additions & 0 deletions
7
service/src/main/resources/org/signal/bankmandate/BankMandate.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# | ||
# Copyright 2023 Signal Messenger, LLC | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
# | ||
|
||
SEPA_MANDATE = By providing your payment information and confirming this payment, you authorise (A) Signal Technology Foundation and Stripe, our payment service provider, to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with those instructions. As part of your rights, you are entitled to a refund from your bank under the terms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited. Your rights are explained in a statement that you can obtain from your bank. You agree to receive notifications for future debits up to 2 days before they occur. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters