www in docker support

This commit is contained in:
MaddoScientisto 2026-04-22 18:41:37 +02:00
commit c227fce036
2145 changed files with 399596 additions and 58 deletions

View file

@ -0,0 +1,44 @@
package com.paypal;
import com.paypal.core.PayPalEnvironment;
import com.paypal.core.PayPalHttpClient;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
public class PayPalClient {
private PayPalEnvironment environment = new PayPalEnvironment.Sandbox(
(System.getProperty("PAYPAL_CLIENT_ID") != null) ? System.getProperty("PAYPAL_CLIENT_ID") :
"<<PAYPAL-CLIENT-ID>>",
(System.getProperty("PAYPAL_CLIENT_SECRET") != null) ? System.getProperty("PAYPAL_CLIENT_SECRET") :
"<<PAYPAL-CLIENT-SECRET>>");
PayPalHttpClient client = new PayPalHttpClient(this.environment);
public PayPalHttpClient client() {
return this.client;
}
public String prettyPrint(JSONObject jo, String pre) {
Iterator<?> keys = jo.keys();
StringBuilder pretty = new StringBuilder();
while (keys.hasNext()) {
String key = (String)keys.next();
pretty.append(String.format("%s%s: ", pre, StringUtils.capitalize(key)));
if (jo.get(key) instanceof JSONObject) {
pretty.append(prettyPrint(jo.getJSONObject(key), pre + "\t"));
continue;
}
if (jo.get(key) instanceof org.json.JSONArray) {
int sno = 1;
for (Object jsonObject : (Iterable<Object>)jo.getJSONArray(key)) {
pretty.append(String.format("\n%s\t%d:\n", pre, sno++));
pretty.append(prettyPrint((JSONObject)jsonObject, pre + "\t\t"));
}
continue;
}
pretty.append(String.format("%s\n", jo.getString(key)));
}
return pretty.toString();
}
}