mirror of
https://github.com/signalapp/Signal-Server
synced 2026-10-07 06:47:52 +01:00
Add playOptionId to login configuration
This commit is contained in:
1 parent
33bf9ccae5
commit
9ee081ef28
8 files changed
+17
-4
No files matched your search
@@ -387,6 +387,7 @@ subscription: # configuration for Stripe subscriptions
|
||||
|
||||
loginPurchase:
|
||||
playProductId: login_example
|
||||
playOptionId: login_option_example
|
||||
appStoreProductId: login_example
|
||||
|
||||
oneTimeDonations:
|
||||
|
||||
+2
@@ -12,7 +12,9 @@ import java.time.Duration;
|
||||
/// Configuration for one-time Signal Login purchases
|
||||
///
|
||||
/// @param playProductId the Google Play Billing productId clients should purchase to obtain a Signal Login
|
||||
/// @param playOptionId the Google Play Billing optionId clients should purchase to obtain a Signal Login
|
||||
/// @param appStoreProductId the App Store productId clients should purchase to obtain a Signal Login
|
||||
public record LoginPurchaseConfiguration(
|
||||
@NotEmpty String playProductId,
|
||||
@NotEmpty String playOptionId,
|
||||
@NotEmpty String appStoreProductId) {}
|
||||
+5
-1
@@ -171,7 +171,9 @@ public class SubscriptionController {
|
||||
buildDonationLevelsConfiguration(subscriptionConfiguration, oneTimeDonationConfiguration, badgeTranslator,
|
||||
acceptableLanguages),
|
||||
new BackupConfiguration(backupLevels, subscriptionConfiguration.getbackupFreeTierMediaDuration().toDays()),
|
||||
new LoginConfiguration(ReceiptLevel.LOGIN.getValue(), loginPurchaseConfiguration.playProductId(),
|
||||
new LoginConfiguration(ReceiptLevel.LOGIN.getValue(),
|
||||
loginPurchaseConfiguration.playProductId(),
|
||||
loginPurchaseConfiguration.playOptionId(),
|
||||
loginPurchaseConfiguration.appStoreProductId()),
|
||||
oneTimeDonationConfiguration.sepaMaximumEuros());
|
||||
}
|
||||
@@ -549,6 +551,8 @@ public class SubscriptionController {
|
||||
long level,
|
||||
@Schema(description = "The play billing productID associated with a Signal Login purchase")
|
||||
String playProductId,
|
||||
@Schema(description = "The play billing optionID to use to purchase a Signal Login")
|
||||
String playOptionId,
|
||||
@Schema(description = "The App Store productID associated with a Signal Login purchase")
|
||||
String appStoreProductId) {}
|
||||
|
||||
|
||||
+1
@@ -95,6 +95,7 @@ public class ProductConfigurationGrpcService extends SimpleProductConfigurationG
|
||||
return LoginConfiguration.newBuilder()
|
||||
.setLevel(ReceiptLevel.LOGIN.getValue())
|
||||
.setPlayProductId(loginPurchaseConfiguration.playProductId())
|
||||
.setPlayOptionId(loginPurchaseConfiguration.playOptionId())
|
||||
.setAppStoreProductId(loginPurchaseConfiguration.appStoreProductId())
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -90,6 +90,8 @@ message LoginConfiguration {
|
||||
uint64 level = 1;
|
||||
// The play billing productID associated with a Signal Login purchase
|
||||
string play_product_id = 2;
|
||||
// The play billing optionID to use to purchase a Signal Login
|
||||
string play_option_id = 5;
|
||||
// The App Store productID associated with a Signal Login purchase
|
||||
string app_store_product_id = 3;
|
||||
string app_store_product_id = 4;
|
||||
}
|
||||
+2
-1
@@ -112,7 +112,7 @@ class SubscriptionControllerTest extends AbstractV1SubscriptionControllerTest {
|
||||
private static final BadgeTranslator BADGE_TRANSLATOR = mock(BadgeTranslator.class);
|
||||
private static final BankMandateTranslator BANK_MANDATE_TRANSLATOR = mock(BankMandateTranslator.class);
|
||||
private static final LoginPurchaseConfiguration LOGIN_PURCHASE_CONFIG =
|
||||
new LoginPurchaseConfiguration("testLoginPlayProductId", "testLoginAppStoreProductId");
|
||||
new LoginPurchaseConfiguration("testLoginPlayProductId", "testLoginPlayOptionId", "testLoginAppStoreProductId");
|
||||
private final static SubscriptionController SUBSCRIPTION_CONTROLLER = new SubscriptionController(CLOCK,
|
||||
SUBSCRIPTION_CONFIG, ONETIME_CONFIG, LOGIN_PURCHASE_CONFIG,
|
||||
new SubscriptionManager(SUBSCRIPTIONS, List.of(STRIPE_MANAGER, BRAINTREE_MANAGER, PLAY_MANAGER, APPSTORE_MANAGER),
|
||||
@@ -1080,6 +1080,7 @@ class SubscriptionControllerTest extends AbstractV1SubscriptionControllerTest {
|
||||
|
||||
assertThat(response.login().level()).isEqualTo(ReceiptLevel.LOGIN.getValue());
|
||||
assertThat(response.login().playProductId()).isEqualTo(LOGIN_PURCHASE_CONFIG.playProductId());
|
||||
assertThat(response.login().playOptionId()).isEqualTo(LOGIN_PURCHASE_CONFIG.playOptionId());
|
||||
assertThat(response.login().appStoreProductId()).isEqualTo(LOGIN_PURCHASE_CONFIG.appStoreProductId());
|
||||
|
||||
// check the badge vs purchasable badge fields
|
||||
|
||||
+2
-1
@@ -40,7 +40,7 @@ public class ProductConfigurationGrpcServiceTest extends
|
||||
SubscriptionConfigTestHelper.getOneTimeConfig();
|
||||
|
||||
private static final LoginPurchaseConfiguration LOGIN_PURCHASE_CONFIGURATION =
|
||||
new LoginPurchaseConfiguration("testLoginPlayProductId", "testLoginAppStoreProductId");
|
||||
new LoginPurchaseConfiguration("testLoginPlayProductId", "testLoginPlayOptionId", "testLoginAppStoreProductId");
|
||||
|
||||
@Mock
|
||||
private StripeManager stripeManager;
|
||||
@@ -135,6 +135,7 @@ public class ProductConfigurationGrpcServiceTest extends
|
||||
|
||||
assertEquals(ReceiptLevel.LOGIN.getValue(), configuration.getLogin().getLevel());
|
||||
assertEquals(LOGIN_PURCHASE_CONFIGURATION.playProductId(), configuration.getLogin().getPlayProductId());
|
||||
assertEquals(LOGIN_PURCHASE_CONFIGURATION.playOptionId(), configuration.getLogin().getPlayOptionId());
|
||||
assertEquals(LOGIN_PURCHASE_CONFIGURATION.appStoreProductId(), configuration.getLogin().getAppStoreProductId());
|
||||
}
|
||||
|
||||
|
||||
@@ -399,6 +399,7 @@ subscription: # configuration for Stripe subscriptions
|
||||
|
||||
loginPurchase:
|
||||
playProductId: login_example
|
||||
playOptionId: login_option_example
|
||||
appStoreProductId: login_example
|
||||
|
||||
oneTimeDonations:
|
||||
|
||||
Reference in new issue
Block a user