Skip to content

Commit 9097074

Browse files
committed
add new entities
1 parent 70c63c3 commit 9097074

File tree

9 files changed

+439
-3
lines changed

9 files changed

+439
-3
lines changed

pom.xml

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
<dependency>
88
<groupId>com.intuit.quickbooks-online</groupId>
99
<artifactId>ipp-v3-java-devkit</artifactId>
10-
<classifier>jar-with-dependencies</classifier>
11-
<version>4.1.0</version>
10+
<version>6.0.4</version>
1211
</dependency>
1312
<dependency>
1413
<groupId>com.intuit.quickbooks-online</groupId>
1514
<artifactId>ipp-v3-java-data</artifactId>
16-
<version>4.1.0</version>
15+
<version>6.0.4</version>
1716
</dependency>
1817
<!-- for logging -->
1918
<dependency>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.intuit.developer.sampleapp.crud.entities.creditcardpayment;
2+
3+
import java.util.List;
4+
5+
import com.intuit.developer.sampleapp.crud.helper.CreditCardPaymentHelper;
6+
import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7+
import com.intuit.ipp.data.CreditCardPaymentTxn;
8+
import com.intuit.ipp.data.Error;
9+
import com.intuit.ipp.exception.FMSException;
10+
import com.intuit.ipp.services.DataService;
11+
import com.intuit.ipp.util.Logger;
12+
13+
/**
14+
* Demonstrates methods to create creditCardPayment
15+
* 1. Using mandatory fields
16+
* 2. Using all fields
17+
*
18+
* @author dderose
19+
*
20+
*/
21+
public class CreditCardPaymentCreate {
22+
23+
private static final org.slf4j.Logger LOG = Logger.getLogger();
24+
25+
public static void main(String[] args) {
26+
try {
27+
createCreditCardPayment();
28+
} catch (Exception e) {
29+
LOG.error("Error during CRUD", e.getCause());
30+
}
31+
}
32+
33+
public static void createCreditCardPayment() throws Exception {
34+
35+
try {
36+
37+
DataService service = DataServiceFactory.getDataService();
38+
39+
// add creditCardPayment
40+
CreditCardPaymentTxn creditCardPayment = CreditCardPaymentHelper.getCreditCardPaymentFields(service);
41+
CreditCardPaymentTxn savedCreditCardPayment = service.add(creditCardPayment);
42+
LOG.info("CreditCardPayment created: " + savedCreditCardPayment.getId() );
43+
44+
} catch (FMSException e) {
45+
List<Error> list = e.getErrorList();
46+
list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
47+
}
48+
49+
}
50+
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package com.intuit.developer.sampleapp.crud.entities.creditcardpayment;
2+
3+
import java.text.ParseException;
4+
import java.util.List;
5+
6+
import com.intuit.developer.sampleapp.crud.helper.CreditCardPaymentHelper;
7+
import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8+
import com.intuit.ipp.data.CreditCardPaymentTxn;
9+
import com.intuit.ipp.data.Error;
10+
import com.intuit.ipp.exception.FMSException;
11+
import com.intuit.ipp.services.DataService;
12+
import com.intuit.ipp.util.Logger;
13+
14+
/**
15+
* Demonstrates methods to delete creditCardPayment
16+
* Note: We'll create an entity first and then delete the same
17+
*
18+
* @author dderose
19+
*
20+
*/
21+
public class CreditCardPaymentDelete {
22+
23+
private static final org.slf4j.Logger LOG = Logger.getLogger();
24+
25+
public static void main(String[] args) {
26+
try {
27+
deleteCreditCardPayment();
28+
} catch (Exception e) {
29+
LOG.error("Error during CRUD", e.getCause());
30+
}
31+
}
32+
33+
public static void deleteCreditCardPayment() throws FMSException, ParseException {
34+
35+
try {
36+
DataService service = DataServiceFactory.getDataService();
37+
38+
// create creditCardPayment
39+
CreditCardPaymentTxn creditCardPayment = CreditCardPaymentHelper.getCreditCardPaymentFields(service);
40+
CreditCardPaymentTxn addCreditCardPayment = service.add(creditCardPayment);
41+
LOG.info("CreditCardPayment added : " + addCreditCardPayment.getId());
42+
43+
// delete creditCardPayment
44+
CreditCardPaymentTxn deletedCreditCardPayment = service.delete(addCreditCardPayment);
45+
LOG.info("CreditCardPayment deleted : " + deletedCreditCardPayment.getId() + " status ::: " + deletedCreditCardPayment.getStatus());
46+
47+
} catch (FMSException e) {
48+
List<Error> list = e.getErrorList();
49+
list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50+
}
51+
}
52+
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package com.intuit.developer.sampleapp.crud.entities.creditcardpayment;
2+
3+
import java.text.ParseException;
4+
import java.util.List;
5+
6+
import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7+
import com.intuit.ipp.data.Error;
8+
import com.intuit.ipp.exception.FMSException;
9+
import com.intuit.ipp.services.DataService;
10+
import com.intuit.ipp.services.QueryResult;
11+
import com.intuit.ipp.util.Logger;
12+
13+
/**
14+
* Demonstrates methods to query creditCardPayment
15+
* 1. Query all records
16+
*
17+
* @author dderose
18+
*
19+
*/
20+
public class CreditCardPaymentQuery {
21+
22+
private static final org.slf4j.Logger LOG = Logger.getLogger();
23+
24+
public static void main(String[] args) {
25+
try {
26+
queryCreditCardPayment();
27+
} catch (Exception e) {
28+
LOG.error("Error during CRUD", e.getCause());
29+
}
30+
}
31+
32+
public static void queryCreditCardPayment() throws FMSException, ParseException {
33+
34+
try {
35+
36+
DataService service = DataServiceFactory.getDataService();
37+
38+
// get all creditCardPayments
39+
String sql = "select * from CreditCardPayment STARTPOSITION 1 MAXRESULTS 25";
40+
QueryResult queryResult = service.executeQuery(sql);
41+
int count = queryResult.getEntities().size();
42+
43+
LOG.info("Total number of creditCardPayments: " + count);
44+
45+
46+
47+
} catch (FMSException e) {
48+
List<Error> list = e.getErrorList();
49+
list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
50+
}
51+
52+
}
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.intuit.developer.sampleapp.crud.entities.creditcardpayment;
2+
3+
import java.text.ParseException;
4+
import java.util.List;
5+
6+
import com.intuit.developer.sampleapp.crud.helper.CreditCardPaymentHelper;
7+
import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8+
import com.intuit.ipp.data.CreditCardPaymentTxn;
9+
import com.intuit.ipp.data.Error;
10+
import com.intuit.ipp.exception.FMSException;
11+
import com.intuit.ipp.services.DataService;
12+
import com.intuit.ipp.util.Logger;
13+
14+
/**
15+
* Demonstrates methods to read creditCardPayment using creditCardPayment id
16+
* Note: We'll create an entity first and then read the same
17+
*
18+
* @author dderose
19+
*
20+
*/
21+
public class CreditCardPaymentRead {
22+
23+
private static final org.slf4j.Logger LOG = Logger.getLogger();
24+
25+
public static void main(String[] args) {
26+
try {
27+
getCreditCardPayment();
28+
} catch (Exception e) {
29+
LOG.error("Error during CRUD", e.getCause());
30+
}
31+
}
32+
33+
public static void getCreditCardPayment() throws FMSException, ParseException {
34+
35+
try {
36+
37+
DataService service = DataServiceFactory.getDataService();
38+
39+
// add creditCardPayment
40+
CreditCardPaymentTxn creditCardPayment = CreditCardPaymentHelper.getCreditCardPaymentFields(service);
41+
CreditCardPaymentTxn savedCreditCardPayment = service.add(creditCardPayment);
42+
LOG.info("CreditCardPayment created: " + savedCreditCardPayment.getId() );
43+
44+
CreditCardPaymentTxn creditCardPaymentOut = service.findById(savedCreditCardPayment);
45+
LOG.info("CreditCardPayment Txn status: " + creditCardPaymentOut.getTxnStatus());
46+
47+
} catch (FMSException e) {
48+
List<Error> list = e.getErrorList();
49+
list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50+
}
51+
52+
}
53+
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package com.intuit.developer.sampleapp.crud.entities.creditcardpayment;
2+
3+
import java.math.BigDecimal;
4+
import java.text.ParseException;
5+
import java.util.List;
6+
7+
import com.intuit.developer.sampleapp.crud.helper.CreditCardPaymentHelper;
8+
import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
9+
import com.intuit.ipp.data.CreditCardPaymentTxn;
10+
import com.intuit.ipp.data.Error;
11+
import com.intuit.ipp.exception.FMSException;
12+
import com.intuit.ipp.services.DataService;
13+
import com.intuit.ipp.util.Logger;
14+
15+
/**
16+
* Demonstrates methods to update creditCardPayment
17+
* 1. Sparse update with limited fields
18+
* 2. Full update with all fields
19+
*
20+
* @author dderose
21+
*
22+
*/
23+
public class CreditCardPaymentUpdate {
24+
25+
private static final org.slf4j.Logger LOG = Logger.getLogger();
26+
27+
public static void main(String[] args) {
28+
try {
29+
updateCreditCardPayment();
30+
} catch (Exception e) {
31+
LOG.error("Error during CRUD", e.getCause());
32+
}
33+
}
34+
35+
public static void updateCreditCardPayment() throws FMSException, ParseException {
36+
37+
try {
38+
39+
DataService service = DataServiceFactory.getDataService();
40+
41+
// create creditCardPayment
42+
CreditCardPaymentTxn creditCardPayment = CreditCardPaymentHelper.getCreditCardPaymentFields(service);
43+
CreditCardPaymentTxn addCreditCardPayment = service.add(creditCardPayment);
44+
LOG.info("CreditCardPayment added : " + addCreditCardPayment.getId() + " amt ::: " + addCreditCardPayment.getAmount());
45+
46+
// sparse update creditCardPayment
47+
addCreditCardPayment.setSparse(true);
48+
addCreditCardPayment.setAmount(new BigDecimal("20"));
49+
CreditCardPaymentTxn savedCreditCardPayment = service.update(addCreditCardPayment);
50+
LOG.info("CreditCardPayment sparse updated: " + savedCreditCardPayment.getId() + " amt ::: " + addCreditCardPayment.getAmount() );
51+
52+
// update creditCardPayment with all fields
53+
addCreditCardPayment = service.findById(savedCreditCardPayment);
54+
CreditCardPaymentTxn updatedCreditCardPayment = CreditCardPaymentHelper.getCreditCardPaymentFields(service);
55+
updatedCreditCardPayment.setId(addCreditCardPayment.getId());
56+
updatedCreditCardPayment.setSyncToken(addCreditCardPayment.getSyncToken());
57+
savedCreditCardPayment = service.update(updatedCreditCardPayment);
58+
LOG.info("CreditCardPayment updated with all fields : " + savedCreditCardPayment.getId() + " amt ::: " + addCreditCardPayment.getAmount() );
59+
60+
} catch (FMSException e) {
61+
List<Error> list = e.getErrorList();
62+
list.forEach(error -> LOG.error("Error while calling entity update:: " + error.getMessage()));
63+
}
64+
65+
}
66+
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.intuit.developer.sampleapp.crud.entities.taxpayment;
2+
3+
import java.util.List;
4+
5+
import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
6+
import com.intuit.ipp.data.Error;
7+
import com.intuit.ipp.exception.FMSException;
8+
import com.intuit.ipp.services.DataService;
9+
import com.intuit.ipp.services.QueryResult;
10+
import com.intuit.ipp.util.Logger;
11+
12+
/**
13+
* Demonstrates methods to query TaxPayment data
14+
* 1. Query all records
15+
*
16+
* @author dderose
17+
*
18+
*/
19+
public class TaxPaymentQuery {
20+
21+
private static final org.slf4j.Logger LOG = Logger.getLogger();
22+
23+
public static void main(String[] args) {
24+
try {
25+
queryTaxPayments();
26+
} catch (Exception e) {
27+
LOG.error("Error during CRUD", e.getCause());
28+
}
29+
}
30+
31+
public static void queryTaxPayments() throws FMSException {
32+
33+
try {
34+
35+
DataService service = DataServiceFactory.getDataService();
36+
37+
// get all taxpayments
38+
String sql = "SELECT * FROM TaxPayment";
39+
QueryResult queryResult = service.executeQuery(sql);
40+
int count = queryResult.getEntities().size();
41+
42+
LOG.info("Total number of TaxPayments: " + count);
43+
44+
45+
46+
} catch (FMSException e) {
47+
List<Error> list = e.getErrorList();
48+
list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
49+
}
50+
51+
}
52+
}

0 commit comments

Comments
 (0)