Enable Payments Beta for more country codes

This commit is contained in:
Jon Chambers
2021-11-08 16:05:25 -05:00
committed by Jon Chambers
parent 1e1394560d
commit da5c0ae4b6
4 changed files with 13 additions and 16 deletions

View File

@@ -12,9 +12,9 @@ import java.util.Set;
public class DynamicPaymentsConfiguration {
@JsonProperty
private Set<String> allowedCountryCodes = Collections.emptySet();
private Set<String> disallowedCountryCodes = Collections.emptySet();
public Set<String> getAllowedCountryCodes() {
return allowedCountryCodes;
public Set<String> getDisallowedCountryCodes() {
return disallowedCountryCodes;
}
}

View File

@@ -137,11 +137,11 @@ public class ProfileController {
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response setProfile(@Auth AuthenticatedAccount auth, @Valid CreateProfileRequest request) {
final Set<String> allowedPaymentsCountryCodes =
dynamicConfigurationManager.getConfiguration().getPaymentsConfiguration().getAllowedCountryCodes();
final Set<String> disallowedPaymentsCountryCodes =
dynamicConfigurationManager.getConfiguration().getPaymentsConfiguration().getDisallowedCountryCodes();
if (StringUtils.isNotBlank(request.getPaymentAddress()) &&
!allowedPaymentsCountryCodes.contains(Util.getCountryCode(auth.getAccount().getNumber()))) {
disallowedPaymentsCountryCodes.contains(Util.getCountryCode(auth.getAccount().getNumber()))) {
return Response.status(Status.FORBIDDEN).build();
}