Skip to content

Commit ca9d091

Browse files
authored
Merge pull request #602 from stripe/setappinfo_partner_id_support
Adds support for 'partner_id' to 'setAppInfo'
2 parents 6129fdc + 2626a3f commit ca9d091

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/main/java/com/stripe/Stripe.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public abstract class Stripe {
1818
public static volatile String apiKey;
1919
public static volatile String apiVersion;
2020
public static volatile String clientId;
21+
public static volatile String partnerId;
2122

2223
// Note that URLConnection reserves the value of 0 to mean "infinite
2324
// timeout", so we use -1 here to represent an unset value which should
@@ -146,11 +147,15 @@ public static PasswordAuthentication getProxyCredential() {
146147
}
147148

148149
public static void setAppInfo(String name) {
149-
setAppInfo(name, null, null);
150+
setAppInfo(name, null, null, null);
150151
}
151152

152153
public static void setAppInfo(String name, String version) {
153-
setAppInfo(name, version, null);
154+
setAppInfo(name, version, null, null);
155+
}
156+
157+
public static void setAppInfo(String name, String version, String url) {
158+
setAppInfo(name, version, url, null);
154159
}
155160

156161
/**
@@ -159,15 +164,17 @@ public static void setAppInfo(String name, String version) {
159164
* @param name Name of your application (e.g. "MyAwesomeApp")
160165
* @param version Version of your application (e.g. "1.2.34")
161166
* @param url Website for your application (e.g. "https://myawesomeapp.info")
167+
* @param partnerId Your Stripe Partner ID (e.g. "pp_partner_1234")
162168
*/
163-
public static void setAppInfo(String name, String version, String url) {
169+
public static void setAppInfo(String name, String version, String url, String partnerId) {
164170
if (appInfo == null) {
165171
appInfo = new HashMap<String, String>();
166172
}
167173

168174
appInfo.put("name", name);
169175
appInfo.put("version", version);
170176
appInfo.put("url", url);
177+
appInfo.put("partner_id", partnerId);
171178
}
172179

173180
public static Map<String, String> getAppInfo() {

src/test/java/com/stripe/net/LiveStripeResponseGetterTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public void testCorrectAdditionalOwners() throws StripeException, UnsupportedEnc
170170
public void testAppInfo() {
171171
final RequestOptions options = (new RequestOptionsBuilder()).setApiKey("sk_foobar").build();
172172

173-
Stripe.setAppInfo("MyAwesomePlugin", "1.2.34", "https://myawesomeplugin.info");
173+
Stripe.setAppInfo("MyAwesomePlugin", "1.2.34", "https://myawesomeplugin.info", "pp_partner_1234");
174174

175175
final Map<String, String> headers = LiveStripeResponseGetter.getHeaders(options);
176176

@@ -190,5 +190,6 @@ public void testAppInfo() {
190190
assertEquals("MyAwesomePlugin", appMap.get("name"));
191191
assertEquals("1.2.34", appMap.get("version"));
192192
assertEquals("https://myawesomeplugin.info", appMap.get("url"));
193+
assertEquals("pp_partner_1234", appMap.get("partner_id"));
193194
}
194195
}

0 commit comments

Comments
 (0)