@@ -41,7 +41,7 @@ public abstract class BaseAppStoreServerAPIClient {
41
41
private static final String PRODUCTION_URL = "https://api.storekit.itunes.apple.com" ;
42
42
private static final String SANDBOX_URL = "https://api.storekit-sandbox.itunes.apple.com" ;
43
43
private static final String LOCAL_TESTING_URL = "https://local-testing-base-url" ;
44
- private static final String USER_AGENT = "app-store-server-library/java/3.2 .0" ;
44
+ private static final String USER_AGENT = "app-store-server-library/java/3.3 .0" ;
45
45
private static final String JSON = "application/json; charset=utf-8" ;
46
46
47
47
private final BearerTokenAuthenticatorInterface bearerTokenAuthenticator ;
@@ -55,29 +55,30 @@ public BaseAppStoreServerAPIClient(String signingKey, String keyId, String issue
55
55
56
56
public BaseAppStoreServerAPIClient (BearerTokenAuthenticatorInterface bearerTokenAuthenticator , Environment environment ) {
57
57
this .bearerTokenAuthenticator = bearerTokenAuthenticator ;
58
+ this .url = getUrlForEnvironment (environment );
59
+ this .objectMapper = new ObjectMapper ();
60
+ objectMapper .setVisibility (objectMapper .getSerializationConfig ().getDefaultVisibilityChecker ()
61
+ .withFieldVisibility (JsonAutoDetect .Visibility .ANY )
62
+ .withGetterVisibility (JsonAutoDetect .Visibility .NONE )
63
+ .withIsGetterVisibility (JsonAutoDetect .Visibility .NONE )
64
+ .withSetterVisibility (JsonAutoDetect .Visibility .NONE )
65
+ .withCreatorVisibility (JsonAutoDetect .Visibility .NONE ));
66
+ }
67
+
68
+ protected String getUrlForEnvironment (Environment environment ) {
58
69
switch (environment ) {
59
70
case XCODE :
60
71
throw new IllegalArgumentException ("Xcode is not a supported environment for an AppStoreServerAPIClient" );
61
72
case PRODUCTION :
62
- this .url = PRODUCTION_URL ;
63
- break ;
73
+ return PRODUCTION_URL ;
64
74
case LOCAL_TESTING :
65
- this .url = LOCAL_TESTING_URL ;
66
- break ;
75
+ return LOCAL_TESTING_URL ;
67
76
case SANDBOX :
68
- this .url = SANDBOX_URL ;
69
- break ;
77
+ return SANDBOX_URL ;
70
78
default :
71
79
// This switch statement is exhaustive
72
80
throw new IllegalStateException ();
73
81
}
74
- this .objectMapper = new ObjectMapper ();
75
- objectMapper .setVisibility (objectMapper .getSerializationConfig ().getDefaultVisibilityChecker ()
76
- .withFieldVisibility (JsonAutoDetect .Visibility .ANY )
77
- .withGetterVisibility (JsonAutoDetect .Visibility .NONE )
78
- .withIsGetterVisibility (JsonAutoDetect .Visibility .NONE )
79
- .withSetterVisibility (JsonAutoDetect .Visibility .NONE )
80
- .withCreatorVisibility (JsonAutoDetect .Visibility .NONE ));
81
82
}
82
83
83
84
/**
0 commit comments