@@ -340,6 +340,20 @@ protected Response post(String endPoint, JAXBElement<?> object) throws IOExcepti
340
340
throw convertException (ioe );
341
341
}
342
342
}
343
+
344
+ protected Response post (String endPoint , JAXBElement <?> object , Map <String , String > params ) throws IOException {
345
+ String contents = marshallRequest (object );
346
+ OAuthRequestResource req = new OAuthRequestResource (config , signerFactory , endPoint , "POST" , contents , params );
347
+ req .setToken (token );
348
+ req .setTokenSecret (tokenSecret );
349
+
350
+ try {
351
+ HttpResponse resp = req .execute ();
352
+ return unmarshallResponse (resp .parseAsString (), Response .class );
353
+ } catch (IOException ioe ) {
354
+ throw convertException (ioe );
355
+ }
356
+ }
343
357
344
358
protected Response delete (String endPoint ) throws IOException {
345
359
HttpResponse resp = null ;
@@ -482,12 +496,39 @@ public List<BankTransaction> getBankTransactions(Date modifiedAfter, String wher
482
496
return responseObj .getBankTransactions ().getBankTransaction ();
483
497
}
484
498
}
499
+
500
+
501
+ public List <BankTransaction > getBankTransactions (Date modifiedAfter , String where , String order , String page , String unitdp )
502
+ throws IOException {
503
+ Map <String , String > params = new HashMap <>();
504
+ addToMapIfNotNull (params , "Where" , where );
505
+ addToMapIfNotNull (params , "order" , order );
506
+ addToMapIfNotNull (params , "page" , page );
507
+ addToMapIfNotNull (params , "unitdp" , unitdp );
508
+
509
+ Response responseObj = get ("BankTransactions" , modifiedAfter , params );
510
+ if (responseObj .getBankTransactions () == null ) {
511
+ ArrayOfBankTransaction array = new ArrayOfBankTransaction ();
512
+ return array .getBankTransaction ();
513
+ } else {
514
+ return responseObj .getBankTransactions ().getBankTransaction ();
515
+ }
516
+ }
485
517
486
518
public List <BankTransaction > createBankTransactions (List <BankTransaction > bankTransactions ) throws IOException {
487
519
ArrayOfBankTransaction array = new ArrayOfBankTransaction ();
488
520
array .getBankTransaction ().addAll (bankTransactions );
489
521
return put ("BankTransactions" , objFactory .createBankTransactions (array )).getBankTransactions ().getBankTransaction ();
490
522
}
523
+
524
+ public List <BankTransaction > createBankTransactions (List <BankTransaction > bankTransactions ,String unitdp ) throws IOException {
525
+ Map <String , String > params = new HashMap <>();
526
+ addToMapIfNotNull (params , "unitdp" , unitdp );
527
+
528
+ ArrayOfBankTransaction array = new ArrayOfBankTransaction ();
529
+ array .getBankTransaction ().addAll (bankTransactions );
530
+ return put ("BankTransactions" , objFactory .createBankTransactions (array ),params ).getBankTransactions ().getBankTransaction ();
531
+ }
491
532
492
533
public List <BankTransaction > updateBankTransactions (List <BankTransaction > bankTransactions ) throws IOException {
493
534
ArrayOfBankTransaction array = new ArrayOfBankTransaction ();
@@ -496,11 +537,28 @@ public List<BankTransaction> updateBankTransactions(List<BankTransaction> bankTr
496
537
.getBankTransactions ()
497
538
.getBankTransaction ();
498
539
}
540
+
541
+ public List <BankTransaction > updateBankTransactions (List <BankTransaction > bankTransactions , String unitdp ) throws IOException {
542
+ Map <String , String > params = new HashMap <>();
543
+ addToMapIfNotNull (params , "unitdp" , unitdp );
544
+
545
+ ArrayOfBankTransaction array = new ArrayOfBankTransaction ();
546
+ array .getBankTransaction ().addAll (bankTransactions );
547
+ return post ("BankTransactions" , objFactory .createBankTransactions (array ),params )
548
+ .getBankTransactions ()
549
+ .getBankTransaction ();
550
+ }
499
551
500
552
public BankTransaction getBankTransaction (String id ) throws IOException {
501
553
return singleResult (get ("BankTransactions/" + id ).getBankTransactions ().getBankTransaction ());
502
554
}
503
-
555
+
556
+ public BankTransaction getBankTransaction (String id ,String unitdp ) throws IOException {
557
+ Map <String , String > params = new HashMap <>();
558
+ addToMapIfNotNull (params , "unitdp" , unitdp );
559
+ return singleResult (get ("BankTransactions/" + id ,null ,params ).getBankTransactions ().getBankTransaction ());
560
+ }
561
+
504
562
//BANK TRANSFERS
505
563
public List <BankTransfer > getBankTransfers () throws IOException {
506
564
Response responseObj = get ("BankTransfers" );
@@ -875,22 +933,64 @@ public List<Invoice> getInvoices(Date modifiedAfter, String where, String order,
875
933
return responseObj .getInvoices ().getInvoice ();
876
934
}
877
935
}
936
+
937
+ public List <Invoice > getInvoices (Date modifiedAfter , String where , String order , String page , String ids , String unitdp )
938
+ throws IOException {
939
+ Map <String , String > params = new HashMap <>();
940
+ addToMapIfNotNull (params , "Where" , where );
941
+ addToMapIfNotNull (params , "order" , order );
942
+ addToMapIfNotNull (params , "page" , page );
943
+ addToMapIfNotNull (params , "Ids" , ids );
944
+ addToMapIfNotNull (params , "unitdp" , unitdp );
945
+
946
+ Response responseObj = get ("Invoices" , modifiedAfter , params );
947
+ if (responseObj .getInvoices () == null ) {
948
+ ArrayOfInvoice array = new ArrayOfInvoice ();
949
+ return array .getInvoice ();
950
+ } else {
951
+ return responseObj .getInvoices ().getInvoice ();
952
+ }
953
+ }
878
954
879
955
public List <Invoice > createInvoices (List <Invoice > invoices ) throws IOException {
880
956
ArrayOfInvoice array = new ArrayOfInvoice ();
881
957
array .getInvoice ().addAll (invoices );
882
958
return put ("Invoices" , objFactory .createInvoices (array )).getInvoices ().getInvoice ();
883
959
}
960
+
961
+ public List <Invoice > createInvoices (List <Invoice > invoices ,String unitdp ) throws IOException {
962
+ Map <String , String > params = new HashMap <>();
963
+ addToMapIfNotNull (params , "unitdp" , unitdp );
964
+
965
+ ArrayOfInvoice array = new ArrayOfInvoice ();
966
+ array .getInvoice ().addAll (invoices );
967
+ return put ("Invoices" , objFactory .createInvoices (array ),params ).getInvoices ().getInvoice ();
968
+ }
884
969
885
970
public List <Invoice > updateInvoice (List <Invoice > objects ) throws IOException {
886
971
ArrayOfInvoice array = new ArrayOfInvoice ();
887
972
array .getInvoice ().addAll (objects );
888
973
return post ("Invoices" , objFactory .createInvoices (array )).getInvoices ().getInvoice ();
889
974
}
975
+
976
+ public List <Invoice > updateInvoice (List <Invoice > objects ,String unitdp ) throws IOException {
977
+ Map <String , String > params = new HashMap <>();
978
+ addToMapIfNotNull (params , "unitdp" , unitdp );
979
+
980
+ ArrayOfInvoice array = new ArrayOfInvoice ();
981
+ array .getInvoice ().addAll (objects );
982
+ return post ("Invoices" , objFactory .createInvoices (array ),params ).getInvoices ().getInvoice ();
983
+ }
890
984
891
985
public Invoice getInvoice (String id ) throws IOException {
892
986
return singleResult (get ("Invoices/" + id ).getInvoices ().getInvoice ());
893
987
}
988
+
989
+ public Invoice getInvoice (String id , String unitdp ) throws IOException {
990
+ Map <String , String > params = new HashMap <>();
991
+ addToMapIfNotNull (params , "unitdp" , unitdp );
992
+ return singleResult (get ("Invoices/" + id , null ,params ).getInvoices ().getInvoice ());
993
+ }
894
994
895
995
public String getInvoicePdf (String id , String dirPath ) throws IOException {
896
996
return getFile ("Invoices/" + id , null , null , "application/pdf" , dirPath );
@@ -935,23 +1035,62 @@ public List<Item> getItems(Date modifiedAfter, String where, String order) throw
935
1035
return responseObj .getItems ().getItem ();
936
1036
}
937
1037
}
1038
+
1039
+ public List <Item > getItems (Date modifiedAfter , String where , String order , String unitdp ) throws IOException {
1040
+ Map <String , String > params = new HashMap <>();
1041
+ addToMapIfNotNull (params , "Where" , where );
1042
+ addToMapIfNotNull (params , "order" , order );
1043
+ addToMapIfNotNull (params , "unitdp" , unitdp );
1044
+
1045
+ Response responseObj = get ("Items" , modifiedAfter , params );
1046
+ if (responseObj .getItems () == null ) {
1047
+ ArrayOfItem array = new ArrayOfItem ();
1048
+ return array .getItem ();
1049
+ } else {
1050
+ return responseObj .getItems ().getItem ();
1051
+ }
1052
+ }
938
1053
939
1054
public List <Item > createItems (List <Item > objects ) throws IOException {
940
1055
ArrayOfItem array = new ArrayOfItem ();
941
1056
array .getItem ().addAll (objects );
942
1057
return put ("Items" , objFactory .createItems (array )).getItems ().getItem ();
943
1058
}
1059
+
1060
+ public List <Item > createItems (List <Item > objects ,String unitdp ) throws IOException {
1061
+ Map <String , String > params = new HashMap <>();
1062
+ addToMapIfNotNull (params , "unitdp" , unitdp );
1063
+
1064
+ ArrayOfItem array = new ArrayOfItem ();
1065
+ array .getItem ().addAll (objects );
1066
+ return put ("Items" , objFactory .createItems (array ),params ).getItems ().getItem ();
1067
+ }
944
1068
945
1069
public List <Item > updateItem (List <Item > objects ) throws IOException {
946
1070
ArrayOfItem array = new ArrayOfItem ();
947
1071
array .getItem ().addAll (objects );
948
1072
return post ("Items" , objFactory .createItems (array )).getItems ().getItem ();
949
1073
}
1074
+
1075
+ public List <Item > updateItem (List <Item > objects ,String unitdp ) throws IOException {
1076
+ Map <String , String > params = new HashMap <>();
1077
+ addToMapIfNotNull (params , "unitdp" , unitdp );
1078
+
1079
+ ArrayOfItem array = new ArrayOfItem ();
1080
+ array .getItem ().addAll (objects );
1081
+ return post ("Items" , objFactory .createItems (array ),params ).getItems ().getItem ();
1082
+ }
950
1083
951
1084
public Item getItem (String id ) throws IOException {
952
1085
return singleResult (get ("Items/" + id ).getItems ().getItem ());
953
1086
}
954
1087
1088
+ public Item getItem (String id , String unitdp ) throws IOException {
1089
+ Map <String , String > params = new HashMap <>();
1090
+ addToMapIfNotNull (params , "unitdp" , unitdp );
1091
+ return singleResult (get ("Items/" + id , null , params ).getItems ().getItem ());
1092
+ }
1093
+
955
1094
public String deleteItem (String id ) throws IOException {
956
1095
return delete ("Items/" + id ).getStatus ();
957
1096
}
0 commit comments