Relax configured currency checks
This commit is contained in:
parent
dd7a20a774
commit
8cb9c60a3c
|
@ -104,11 +104,13 @@ public class SubscriptionConfiguration {
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@ValidationMethod(message = "has a mismatch between the levels supported currencies")
|
@ValidationMethod(message = "has a mismatch between the levels supported currencies")
|
||||||
public boolean isCurrencyListSameAcrossAllLevels() {
|
public boolean isCurrencyListSameAcrossAllLevels() {
|
||||||
final Map<Long, SubscriptionLevelConfiguration> subscriptionLevels = Stream
|
return isCurrencyListSameAccrossLevelConfigurations(donationLevels)
|
||||||
.concat(donationLevels.entrySet().stream(), backupLevels.entrySet().stream())
|
&& isCurrencyListSameAccrossLevelConfigurations(backupLevels);
|
||||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
}
|
||||||
|
|
||||||
Optional<SubscriptionLevelConfiguration> any = subscriptionLevels.values().stream().findAny();
|
private static boolean isCurrencyListSameAccrossLevelConfigurations(
|
||||||
|
Map<Long, ? extends SubscriptionLevelConfiguration> subscriptionLevels) {
|
||||||
|
Optional<? extends SubscriptionLevelConfiguration> any = subscriptionLevels.values().stream().findAny();
|
||||||
if (any.isEmpty()) {
|
if (any.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,6 +367,10 @@ subscription: # configuration for Stripe subscriptions
|
||||||
backupExpiration: P30D
|
backupExpiration: P30D
|
||||||
backupGracePeriod: P15D
|
backupGracePeriod: P15D
|
||||||
backupFreeTierMediaDuration: P30D
|
backupFreeTierMediaDuration: P30D
|
||||||
|
backupLevels:
|
||||||
|
201:
|
||||||
|
playProductId: EXAMPLE
|
||||||
|
prices: {}
|
||||||
levels:
|
levels:
|
||||||
500:
|
500:
|
||||||
badge: EXAMPLE
|
badge: EXAMPLE
|
||||||
|
|
Loading…
Reference in New Issue