1212import com .bitpay .sdk .model .Facade ;
1313import com .bitpay .sdk .model .Invoice .Invoice ;
1414import com .bitpay .sdk .model .Invoice .InvoiceEventToken ;
15- import com .bitpay .sdk .util .TokenContainer ;
1615import com .bitpay .sdk .util .GuidGenerator ;
1716import com .bitpay .sdk .util .JsonMapperFactory ;
1817import com .bitpay .sdk .util .ParameterAdder ;
18+ import com .bitpay .sdk .util .TokenContainer ;
1919import com .fasterxml .jackson .core .JsonProcessingException ;
20- import com .fasterxml .jackson .databind .ObjectMapper ;
2120import com .fasterxml .jackson .databind .json .JsonMapper ;
2221import java .util .ArrayList ;
2322import java .util .Arrays ;
@@ -116,7 +115,7 @@ public Invoice getInvoice(String invoiceId, Facade facade, Boolean signRequest)
116115
117116 try {
118117 HttpResponse response = this .bitPayClient .get ("invoices/" + invoiceId , params , signRequest );
119- invoice = new ObjectMapper ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice .class );
118+ invoice = JsonMapperFactory . create ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice .class );
120119 } catch (BitPayException ex ) {
121120 throw new InvoiceQueryException (ex .getStatusCode (), ex .getReasonPhrase ());
122121 } catch (JsonProcessingException e ) {
@@ -150,7 +149,7 @@ public Invoice getInvoiceByGuid(String guid, Facade facade, Boolean signRequest)
150149 try {
151150 ParameterAdder .execute (params , "token" , this .accessTokens .getAccessToken (facade ));
152151 HttpResponse response = this .bitPayClient .get ("invoices/guid/" + guid , params , signRequest );
153- invoice = new ObjectMapper ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice .class );
152+ invoice = JsonMapperFactory . create ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice .class );
154153 } catch (BitPayException ex ) {
155154 throw new InvoiceQueryException (ex .getStatusCode (), ex .getReasonPhrase ());
156155 } catch (JsonProcessingException e ) {
@@ -201,7 +200,7 @@ public List<Invoice> getInvoices(String dateStart, String dateEnd, String status
201200 try {
202201 HttpResponse response = this .bitPayClient .get ("invoices" , params );
203202 invoices = Arrays .asList (
204- new ObjectMapper ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice [].class ));
203+ JsonMapperFactory . create ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice [].class ));
205204 } catch (BitPayException ex ) {
206205 throw new InvoiceQueryException (ex .getStatusCode (), ex .getReasonPhrase ());
207206 } catch (JsonProcessingException e ) {
@@ -294,7 +293,7 @@ public Invoice updateInvoice(
294293
295294 try {
296295 HttpResponse response = this .bitPayClient .update ("invoices/" + invoiceId , json );
297- invoice = new ObjectMapper ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice .class );
296+ invoice = JsonMapperFactory . create ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice .class );
298297 } catch (BitPayException ex ) {
299298 throw new InvoiceUpdateException (ex .getStatusCode (), ex .getReasonPhrase ());
300299 } catch (Exception e ) {
@@ -403,7 +402,7 @@ public Invoice cancelInvoice(String invoiceId, Boolean forceCancel)
403402
404403 try {
405404 HttpResponse response = this .bitPayClient .delete ("invoices/" + invoiceId , params );
406- invoice = new ObjectMapper ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice .class );
405+ invoice = JsonMapperFactory . create ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice .class );
407406 } catch (BitPayException ex ) {
408407 throw new InvoiceCancellationException (ex .getStatusCode (), ex .getReasonPhrase ());
409408 } catch (Exception e ) {
@@ -428,7 +427,7 @@ public Invoice cancelInvoiceByGuid(String guid, Boolean forceCancel) throws BitP
428427
429428 try {
430429 HttpResponse response = this .bitPayClient .delete ("invoices/guid/" + guid , params );
431- invoice = new ObjectMapper ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice .class );
430+ invoice = JsonMapperFactory . create ().readValue (this .bitPayClient .responseToJsonString (response ), Invoice .class );
432431 } catch (BitPayException ex ) {
433432 throw new InvoiceCancellationException (ex .getStatusCode (), ex .getReasonPhrase ());
434433 } catch (Exception e ) {
0 commit comments