public abstract class XeroClient
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.lang.String |
currency |
protected ReSTPlugin |
xeroAuth |
Modifier | Constructor and Description |
---|---|
protected |
XeroClient(java.lang.String currency) |
Modifier and Type | Method and Description |
---|---|
void |
cancelInvoice(java.lang.String xeroInvoiceId,
java.lang.String stInvNumber)
check if the xeroInvoiceId exists and not deleted(voided), then delete(voided) it if it's valid
|
void |
cancelPurchase(java.lang.String xeroPurchaseId,
java.lang.String stPurchaseId)
check if the xeroPurchaseId exists and not deleted(voided), then delete(voided) it if it's valid
NOT IMPLEMENTED YET
|
void |
checkDependancies(JSONObject invoice,
XeroClientST st,
boolean createAccount) |
void |
checkPODependancies(JSONObject purchase,
XeroClientST st,
boolean createAccount) |
XeroAccount |
createAccount(JSONObject account) |
XeroContact |
createContact(XeroContact stContact,
XeroClientST stClient) |
org.w3c.dom.Document |
createInvoice(JSONObject invoice,
XeroClientST stClient,
boolean createAccount) |
XeroProductItem |
createItem(JSONObject item) |
org.w3c.dom.Document |
createPurchase(JSONObject purchase,
XeroClientST stClient) |
boolean |
doesAccountExist(java.lang.String accountNumber) |
boolean |
doesClientExist(JSONObject client) |
boolean |
doesInvoiceExist(JSONObject jsonInvoice,
XeroClientST stClient) |
boolean |
doesProductItemExist(java.lang.String itemCode) |
static java.lang.String |
escapeXeroNumber(java.lang.String stNumber) |
static java.lang.String |
escapeXeroNumber(java.lang.String stNumber,
boolean isStrict) |
XeroContact |
findContact(XeroContact contact) |
org.w3c.dom.Document |
findInvoice(java.lang.String stInvGK,
java.lang.String xeroInvNumber,
XeroClientST stClient) |
org.w3c.dom.Document |
findPurchase(java.lang.String stPurchaseId,
java.lang.String xeroPurchaseNumber,
XeroClientST stClient) |
org.w3c.dom.Document |
getContact(java.lang.String contactNumber) |
org.w3c.dom.Document |
getInvoices(java.lang.String where) |
org.w3c.dom.Document |
getInvoicesById(java.lang.String xeroInvoiceId) |
static java.lang.String |
getOverrideXeroContactId(java.lang.String contactGlobalKey,
XeroClientST st)
get the override contact id that is used to sync to xero instead of contactId
|
XeroSyncPlugin |
getPlugin() |
static java.lang.String |
getXeroContactId(java.lang.String contactGlobalKey,
XeroClientST st)
get the current xero contact id, when this id exists, we try to find the xero Contact with this id first
|
boolean |
isSyncPOToBill() |
java.lang.String |
makeXeroInvoiceNumber(JSONObject jsonInvoice) |
java.lang.String |
makeXeroPurchaseNumber(JSONObject jsonPurchase) |
XeroClient |
setPlugin(XeroSyncPlugin plugin) |
XeroClient |
setSyncPOToBill(boolean syncPOToBill) |
XeroClient |
setUpdateContact(boolean updateContact) |
boolean |
syncItemCodes() |
boolean |
syncItemCodes(boolean disable) |
void |
throttle() |
XeroContact |
updateContact(java.lang.String identifierID,
XeroContact contact) |
void |
updateXeroContactID(java.lang.String contactGlobalKey,
java.lang.String xeroContactID,
XeroClientST stClient) |
void |
updateXeroInvoiceID(java.lang.String stInvGK,
org.w3c.dom.Document xeroResponse,
XeroClientST stClient)
update Invoice:xeroInvoiceID with the xero invoice id returned in the response xml
This method should only be called by a single invoice response
|
void |
updateXeroInvoiceID(java.lang.String stInvGK,
java.lang.String xeroInvoiceID,
XeroClientST stClient)
update Invoice:xeroInvoiceID with the xero invoice id
|
void |
updateXeroPurchaseID(java.lang.String stPurchaseId,
org.w3c.dom.Document xeroResponse,
XeroClientST stClient)
update Purchase:xeroPurchaseID with the xero purchase id returned in the response xml
This method should only be called by a single purchase response
|
void |
updateXeroPurchaseID(java.lang.String stPurchaseId,
java.lang.String xeroPurchaseID,
XeroClientST stClient)
update Purchase:xeroPurchaseID with the xero Purchase id
|
public final java.lang.String currency
protected ReSTPlugin xeroAuth
public void throttle()
public boolean syncItemCodes(boolean disable)
public boolean syncItemCodes()
public java.lang.String makeXeroPurchaseNumber(@Nonnull JSONObject jsonPurchase)
public java.lang.String makeXeroInvoiceNumber(@Nonnull JSONObject jsonInvoice)
public static java.lang.String escapeXeroNumber(@Nonnull java.lang.String stNumber)
public static java.lang.String escapeXeroNumber(@Nonnull java.lang.String stNumber, boolean isStrict)
@CheckReturnValue public org.w3c.dom.Document findInvoice(@Nonnull java.lang.String stInvGK, @Nonnull java.lang.String xeroInvNumber, @Nonnull XeroClientST stClient) throws java.lang.Exception, java.io.FileNotFoundException
java.lang.Exception
java.io.FileNotFoundException
@Nonnull public org.w3c.dom.Document createPurchase(@Nonnull JSONObject purchase, @Nonnull XeroClientST stClient) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue public org.w3c.dom.Document findPurchase(@Nonnull java.lang.String stPurchaseId, @Nonnull java.lang.String xeroPurchaseNumber, @Nonnull XeroClientST stClient) throws java.lang.Exception, java.io.FileNotFoundException
java.lang.Exception
java.io.FileNotFoundException
public void updateXeroPurchaseID(@Nonnull java.lang.String stPurchaseId, @Nonnull org.w3c.dom.Document xeroResponse, @Nonnull XeroClientST stClient) throws java.lang.Exception
stPurchaseId
- Purchase:idxeroResponse
- xero response xml, it should contains only one OurchaseOrder.
The xero purchase id should be found at Response/PurchaseOrders/PurchaseOrder[0]/PurchaseOrderIDstClient
- java.lang.Exception
public void updateXeroPurchaseID(@Nonnull java.lang.String stPurchaseId, @Nonnull java.lang.String xeroPurchaseID, @Nonnull XeroClientST stClient) throws java.lang.Exception
stPurchaseId
- xeroPurchaseID
- stClient
- java.lang.Exception
public void updateXeroInvoiceID(@Nonnull java.lang.String stInvGK, @Nonnull org.w3c.dom.Document xeroResponse, @Nonnull XeroClientST stClient) throws java.lang.Exception
stInvGK
- Invoice:global_keyxeroResponse
- xero response xml, it should contains only one invoice.
The xero invoice id should be found at Response/Invoices/Invoice[0]/InvoiceIDstClient
- java.lang.Exception
public void updateXeroInvoiceID(@Nonnull java.lang.String stInvGK, @Nonnull java.lang.String xeroInvoiceID, @Nonnull XeroClientST stClient) throws java.lang.Exception
stInvGK
- xeroInvoiceID
- stClient
- java.lang.Exception
public void updateXeroContactID(@Nonnull java.lang.String contactGlobalKey, @Nonnull java.lang.String xeroContactID, @Nonnull XeroClientST stClient) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue public org.w3c.dom.Document getInvoices(@Nonnull java.lang.String where) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue public org.w3c.dom.Document getInvoicesById(@Nonnull java.lang.String xeroInvoiceId) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue public boolean doesClientExist(JSONObject client) throws java.lang.Exception
java.lang.Exception
public XeroAccount createAccount(@Nonnull JSONObject account) throws java.lang.Exception
java.lang.Exception
public XeroProductItem createItem(@Nonnull JSONObject item) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue public boolean doesProductItemExist(java.lang.String itemCode) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue public boolean doesAccountExist(@Nonnull java.lang.String accountNumber) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue public boolean doesInvoiceExist(@Nonnull JSONObject jsonInvoice, @Nonnull XeroClientST stClient) throws java.lang.Exception
java.lang.Exception
public void checkDependancies(@Nonnull JSONObject invoice, @Nonnull XeroClientST st, boolean createAccount) throws java.lang.Exception
java.lang.Exception
public void checkPODependancies(@Nonnull JSONObject purchase, @Nonnull XeroClientST st, boolean createAccount) throws java.lang.Exception
java.lang.Exception
public static java.lang.String getOverrideXeroContactId(@Nonnull java.lang.String contactGlobalKey, @Nonnull XeroClientST st) throws ReSTException, JSONException, java.io.IOException, InvalidDataException
contactGlobalKey
- st
- ReSTException
JSONException
java.io.IOException
InvalidDataException
public static java.lang.String getXeroContactId(@Nonnull java.lang.String contactGlobalKey, @Nonnull XeroClientST st) throws ReSTException, JSONException, java.io.IOException, InvalidDataException
contactGlobalKey
- st
- ReSTException
JSONException
java.io.IOException
InvalidDataException
@CheckReturnValue @Nonnull public org.w3c.dom.Document createInvoice(@Nonnull JSONObject invoice, @Nonnull XeroClientST stClient, boolean createAccount) throws java.lang.Exception
java.lang.Exception
public void cancelInvoice(@Nonnull java.lang.String xeroInvoiceId, @Nonnull java.lang.String stInvNumber) throws java.lang.Exception
xeroInvoiceId
- xero invoice idstInvNumber
- st invoice idjava.lang.Exception
public void cancelPurchase(@Nonnull java.lang.String xeroPurchaseId, @Nonnull java.lang.String stPurchaseId) throws java.lang.Exception
xeroPurchaseId
- xero purchase idstPurchaseId
- st purchase idjava.lang.Exception
@Nonnull public XeroContact createContact(@Nonnull XeroContact stContact, @Nonnull XeroClientST stClient) throws java.lang.Exception
java.lang.Exception
public XeroContact updateContact(@Nonnull java.lang.String identifierID, @Nonnull XeroContact contact) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue public org.w3c.dom.Document getContact(@Nonnull java.lang.String contactNumber) throws java.lang.Exception
contactNumber
- the contact number without "ST" prefix to search with. Either Contact:contactId or Contact:xeroContactIdjava.lang.Exception
public XeroContact findContact(@Nonnull XeroContact contact) throws java.lang.Exception
java.lang.Exception
@Nullable public XeroSyncPlugin getPlugin()
@Nonnull public XeroClient setPlugin(@Nullable XeroSyncPlugin plugin)
@Nonnull public XeroClient setUpdateContact(boolean updateContact)
public boolean isSyncPOToBill()
@Nonnull public XeroClient setSyncPOToBill(boolean syncPOToBill)
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.