33/**
44 * Factory for Tempo payment objects.
55 *
6- * <pre>{@code
7- * TempoMethod tempo = Tempo.method(); // mainnet
8- * TempoMethod tempo = Tempo.method(true); // testnet (Moderato)
9- *
10- * MppHandler server = Mpp.create(tempo, "api.example.com", secretKey);
6+ * <p>Prefer the named builders on {@link TempoMethod} directly:
117 *
12- * // In your HTTP handler:
13- * VerifyResult result = server.charge(
14- * request.getHeader("Authorization"),
15- * Tempo.chargeIntent(),
16- * "10.000000", TempoDefaults.MAINNET_USDC, "0xRecipient"
17- * );
8+ * <pre>{@code
9+ * TempoMethod tempo = TempoMethod.testnet().build();
10+ * TempoMethod tempo = TempoMethod.mainnet().debug().build();
11+ * TempoMethod tempo = TempoMethod.custom("http://localhost:8545", 1337).build();
1812 * }</pre>
13+ *
14+ * <p>The static helpers here are kept for backwards compatibility.
1915 */
2016public final class Tempo {
2117 private Tempo () {}
2218
23- /** Returns a {@link TempoMethod} from a {@link TempoConfig} builder. */
24- public static TempoMethod method (TempoConfig config ) {
25- return config .build ();
26- }
27-
2819 /** Returns a {@link TempoMethod} configured for Tempo mainnet. */
2920 public static TempoMethod method () {
30- return method ( false );
21+ return TempoMethod . mainnet (). build ( );
3122 }
3223
3324 /**
34- * Returns a {@link TempoMethod} configured for Tempo mainnet or testnet (Moderato).
25+ * Returns a {@link TempoMethod} for mainnet or testnet (Moderato).
3526 *
3627 * @param testnet {@code true} for Moderato testnet, {@code false} for mainnet
3728 */
3829 public static TempoMethod method (boolean testnet ) {
39- return testnet ? TempoMethod .testnet () : TempoMethod .mainnet ();
30+ return ( testnet ? TempoMethod .testnet () : TempoMethod .mainnet ()). build ();
4031 }
4132
4233 /**
43- * Returns a {@link TempoMethod} configured for Tempo mainnet or testnet (Moderato), with
44- * optional debug logging of raw JSON-RPC request/response bodies.
34+ * Returns a {@link TempoMethod} for mainnet or testnet, with optional debug logging.
4535 *
4636 * @param testnet {@code true} for Moderato testnet, {@code false} for mainnet
4737 * @param debug {@code true} to log raw RPC request/response bodies at INFO level
4838 */
4939 public static TempoMethod method (boolean testnet , boolean debug ) {
50- return testnet ? TempoMethod .testnet (debug ) : TempoMethod .mainnet (debug );
40+ TempoMethod .Builder b = testnet ? TempoMethod .testnet () : TempoMethod .mainnet ();
41+ if (debug ) b .debug ();
42+ return b .build ();
43+ }
44+
45+ /**
46+ * Returns a {@link TempoMethod} pointed at a custom RPC URL and chain ID.
47+ *
48+ * @param rpcUrl JSON-RPC endpoint (e.g. {@code "http://localhost:8545"})
49+ * @param chainId numeric EVM chain ID (e.g. {@code 1337})
50+ */
51+ public static TempoMethod method (String rpcUrl , int chainId ) {
52+ return TempoMethod .custom (rpcUrl , chainId ).build ();
53+ }
54+
55+ /**
56+ * Returns a {@link TempoMethod} pointed at a custom RPC URL and chain ID, with optional
57+ * debug logging.
58+ *
59+ * @param rpcUrl JSON-RPC endpoint (e.g. {@code "http://localhost:8545"})
60+ * @param chainId numeric EVM chain ID (e.g. {@code 1337})
61+ * @param debug {@code true} to log raw RPC request/response bodies
62+ */
63+ public static TempoMethod method (String rpcUrl , int chainId , boolean debug ) {
64+ TempoMethod .Builder b = TempoMethod .custom (rpcUrl , chainId );
65+ if (debug ) b .debug ();
66+ return b .build ();
5167 }
5268
5369 /** Returns a {@link TempoChargeIntent} that submits payments on Tempo mainnet. */
@@ -66,7 +82,6 @@ public static TempoChargeIntent chargeIntent(boolean testnet) {
6682
6783 /**
6884 * Returns a {@link TempoChargeIntent} pointed at a custom RPC URL.
69- * Useful for local development nodes or private networks.
7085 *
7186 * @param rpcUrl JSON-RPC endpoint (e.g. {@code "http://localhost:8545"})
7287 */
@@ -76,39 +91,11 @@ public static TempoChargeIntent chargeIntent(String rpcUrl) {
7691
7792 /**
7893 * Returns a {@link TempoChargeIntent} pointed at a custom RPC URL with optional debug logging.
79- * When {@code debug} is {@code true}, raw JSON-RPC request and response bodies are logged at
80- * INFO level via {@code java.util.logging} under the logger name
81- * {@code com.stripe.mpp.methods.tempo.TempoRpc}.
8294 *
8395 * @param rpcUrl JSON-RPC endpoint (e.g. {@code "http://localhost:8545"})
8496 * @param debug {@code true} to log raw RPC request/response bodies
8597 */
8698 public static TempoChargeIntent chargeIntent (String rpcUrl , boolean debug ) {
8799 return new TempoChargeIntent (rpcUrl , debug );
88100 }
89-
90- /**
91- * Returns a {@link TempoMethod} pointed at a custom RPC URL and chain ID.
92- * Useful for local development nodes or private networks.
93- *
94- * @param rpcUrl JSON-RPC endpoint (e.g. {@code "http://localhost:8545"})
95- * @param chainId numeric EVM chain ID (e.g. {@code 1337})
96- */
97- public static TempoMethod method (String rpcUrl , int chainId ) {
98- return new TempoMethod (rpcUrl , chainId );
99- }
100-
101- /**
102- * Returns a {@link TempoMethod} pointed at a custom RPC URL and chain ID with optional debug
103- * logging. When {@code debug} is {@code true}, raw JSON-RPC request and response bodies are
104- * logged at INFO level via {@code java.util.logging} under the logger name
105- * {@code com.stripe.mpp.methods.tempo.TempoRpc}.
106- *
107- * @param rpcUrl JSON-RPC endpoint (e.g. {@code "http://localhost:8545"})
108- * @param chainId numeric EVM chain ID (e.g. {@code 1337})
109- * @param debug {@code true} to log raw RPC request/response bodies
110- */
111- public static TempoMethod method (String rpcUrl , int chainId , boolean debug ) {
112- return new TempoMethod (rpcUrl , chainId , debug );
113- }
114101}
0 commit comments