@@ -83,6 +83,17 @@ public Client(PosToken token) throws BitPayGenericException {
8383 this (token , Environment .PROD );
8484 }
8585
86+ /**
87+ * Constructor for POS facade.
88+ *
89+ * @param token POS token
90+ * @param platformInfo Platform info
91+ * @throws BitPayGenericException BitPayGenericException class
92+ */
93+ public Client (PosToken token , String platformInfo ) throws BitPayGenericException {
94+ this (token , Environment .PROD , platformInfo );
95+ }
96+
8697 /**
8798 * Constructor for POS facade.
8899 *
@@ -109,6 +120,35 @@ public Client(
109120 this .guidGenerator = new GuidGenerator ();
110121 }
111122
123+ /**
124+ * Constructor for POS facade.
125+ *
126+ * @param token POS token
127+ * @param environment Environment
128+ * @param platformInfo Platform info
129+ * @throws BitPayGenericException BitPayGenericException class
130+ */
131+ public Client (
132+ PosToken token ,
133+ Environment environment ,
134+ String platformInfo
135+ ) throws BitPayGenericException {
136+ if (Objects .isNull (token ) || Objects .isNull (environment )) {
137+ BitPayExceptionProvider .throwMissingParameterException ();
138+ }
139+
140+ this .tokenContainer = new TokenContainer ();
141+ this .tokenContainer .addPos (token .value ());
142+ this .bitPayClient = new BitPayClient (
143+ getHttpClient (null , null ),
144+ new HttpRequestFactory (),
145+ getBaseUrl (environment ),
146+ null ,
147+ platformInfo
148+ );
149+ this .guidGenerator = new GuidGenerator ();
150+ }
151+
112152 /**
113153 * Constructor for use if the keys and SIN are managed by this library.
114154 *
@@ -138,6 +178,38 @@ public Client(
138178 this .guidGenerator = new GuidGenerator ();
139179 }
140180
181+ /**
182+ * Constructor for use if the keys and SIN are managed by this library.
183+ *
184+ * @param environment Target environment. Options: Env.Test / Env.Prod
185+ * @param privateKey The full path to the securely located private key or the HEX key value.
186+ * @param tokenContainer Object containing the available tokens.
187+ * @param proxyDetails HttpHost Optional Proxy setting (set to NULL to ignore)
188+ * @param proxyCredentials CredentialsProvider Optional Proxy Basic Auth Credentials (set to NULL to ignore)
189+ * @param platformInfo Platform Info
190+ * @throws BitPayGenericException BitPayGenericException class
191+ */
192+ public Client (
193+ Environment environment ,
194+ PrivateKey privateKey ,
195+ TokenContainer tokenContainer ,
196+ HttpHost proxyDetails ,
197+ CredentialsProvider proxyCredentials ,
198+ String platformInfo
199+ ) throws BitPayGenericException {
200+ ECKey ecKey = getEcKey (privateKey );
201+ this .tokenContainer = tokenContainer ;
202+ this .deriveIdentity (ecKey );
203+ this .bitPayClient = new BitPayClient (
204+ getHttpClient (proxyDetails , proxyCredentials ),
205+ new HttpRequestFactory (),
206+ getBaseUrl (environment ),
207+ ecKey ,
208+ platformInfo
209+ );
210+ this .guidGenerator = new GuidGenerator ();
211+ }
212+
141213 /**
142214 * Constructor for use if the keys and SIN are managed by this library.
143215 *
@@ -168,6 +240,40 @@ public Client(
168240 this .guidGenerator = new GuidGenerator ();
169241 }
170242
243+
244+ /**
245+ * Constructor for use if the keys and SIN are managed by this library.
246+ *
247+ * @param configFilePath The path to the configuration file.
248+ * @param proxy HttpHost Optional Proxy setting (set to NULL to ignore)
249+ * @param proxyCredentials CredentialsProvider Optional Proxy Basic Auth Credentials (set to NULL to ignore)
250+ * @param platformInfo Platform Info
251+ * @throws BitPayGenericException BitPayGenericException class
252+ */
253+ public Client (
254+ ConfigFilePath configFilePath ,
255+ HttpHost proxy ,
256+ CredentialsProvider proxyCredentials ,
257+ String platformInfo
258+ ) throws BitPayGenericException {
259+ Config config = this .buildConfigFromFile (configFilePath );
260+ this .tokenContainer = new TokenContainer (config );
261+ ECKey ecKey = this .getEcKey (config );
262+ if (Objects .isNull (ecKey )) {
263+ BitPayExceptionProvider .throwValidationException ("Missing ECKey" );
264+ }
265+
266+ this .deriveIdentity (ecKey );
267+ this .bitPayClient = new BitPayClient (
268+ getHttpClient (proxy , proxyCredentials ),
269+ new HttpRequestFactory (),
270+ getBaseUrl (config .getEnvironment ()),
271+ ecKey ,
272+ platformInfo
273+ );
274+ this .guidGenerator = new GuidGenerator ();
275+ }
276+
171277 /**
172278 * Constructor for all injected classes.
173279 *
@@ -199,6 +305,18 @@ public static Client createPosClient(PosToken token) throws BitPayGenericExcepti
199305 return new Client (token );
200306 }
201307
308+ /**
309+ * Create pos (light) client.
310+ *
311+ * @param token the token
312+ * @param platformInfo the platform info
313+ * @return the client
314+ * @throws BitPayGenericException BitPayGenericException class
315+ */
316+ public static Client createPosClient (PosToken token , String platformInfo ) throws BitPayGenericException {
317+ return new Client (token , platformInfo );
318+ }
319+
202320 /**
203321 * Create pos (light) client.
204322 *
@@ -214,6 +332,23 @@ public static Client createPosClient(
214332 return new Client (token , environment );
215333 }
216334
335+ /**
336+ * Create pos (light) client.
337+ *
338+ * @param token the token
339+ * @param environment environment
340+ * @param platformInfo the platform info
341+ * @return the client
342+ * @throws BitPayGenericException BitPayGenericException class
343+ */
344+ public static Client createPosClient (
345+ PosToken token ,
346+ Environment environment ,
347+ String platformInfo
348+ ) throws BitPayGenericException {
349+ return new Client (token , environment , platformInfo );
350+ }
351+
217352 /**
218353 * Create standard client.
219354 *
@@ -233,6 +368,27 @@ public static Client createClientByPrivateKey(
233368 return new Client (env , privateKey , tokenContainer , null , null );
234369 }
235370
371+ /**
372+ * Create standard client.
373+ *
374+ * @param privateKey the private key
375+ * @param tokenContainer the token container
376+ * @param environment environment
377+ * @param platformInfo the platform info
378+ * @return Client Client
379+ * @throws BitPayGenericException BitPayGenericException class
380+ */
381+ public static Client createClientByPrivateKey (
382+ PrivateKey privateKey ,
383+ TokenContainer tokenContainer ,
384+ Environment environment ,
385+ String platformInfo
386+ ) throws BitPayGenericException {
387+ Environment env = Objects .isNull (environment ) ? Environment .PROD : environment ;
388+
389+ return new Client (env , privateKey , tokenContainer , null , null , platformInfo );
390+ }
391+
236392 /**
237393 * Create standard client.
238394 *
@@ -244,6 +400,21 @@ public static Client createClientByConfigFilePath(ConfigFilePath configFilePath)
244400 return new Client (configFilePath , null , null );
245401 }
246402
403+ /**
404+ * Create standard client.
405+ *
406+ * @param configFilePath the config file path
407+ * @param platformInfo the platform info
408+ * @return the client
409+ * @throws BitPayGenericException BitPayGenericException class
410+ */
411+ public static Client createClientByConfigFilePath (
412+ ConfigFilePath configFilePath ,
413+ String platformInfo
414+ ) throws BitPayGenericException {
415+ return new Client (configFilePath , null , null , platformInfo );
416+ }
417+
247418
248419 /**
249420 * Authorize this client with the server using the specified pairing code (Server Initiated Pairing).
0 commit comments