├── .editorconfig ├── .github └── workflows │ ├── jira_create_issue.yml │ ├── jira_update_issue_closed.yml │ └── jira_update_issue_reopen.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Procfile ├── README.md ├── nodemon.json ├── package-lock.json ├── package.json ├── public ├── images │ ├── connect-blue.svg │ ├── connect-white.svg │ ├── disconnect-blue.svg │ ├── disconnect-white.svg │ └── xero-dev.png └── xero.ico ├── sample.env ├── src ├── app.ts ├── helper │ └── index.ts ├── server.ts ├── types │ └── index.ts └── views │ ├── accounting-activity.ejs │ ├── accounts.ejs │ ├── assets.ejs │ ├── attachment-invoice.ejs │ ├── attachments.ejs │ ├── bank-statements-plus.ejs │ ├── bankfeed-connections.ejs │ ├── bankfeed-statements.ejs │ ├── banktranfers.ejs │ ├── banktransactions.ejs │ ├── batchpayments.ejs │ ├── brandingthemes.ejs │ ├── budgets.ejs │ ├── callback.ejs │ ├── cash-validation.ejs │ ├── contactgroups.ejs │ ├── contacts.ejs │ ├── creditnotes.ejs │ ├── currencies.ejs │ ├── earnings-orders.ejs │ ├── earnings-rates.ejs │ ├── employee-opening-balances.ejs │ ├── employees-leave-balances.ejs │ ├── employees-leave-periods.ejs │ ├── employees-leave-types.ejs │ ├── employees-leave.ejs │ ├── employees-pay-templates.ejs │ ├── employees-statutory-leave-balances.ejs │ ├── employees-statutory-leave-summary.ejs │ ├── employees-statutory-sick-leave.ejs │ ├── employees-tax.ejs │ ├── employees.ejs │ ├── employer-pensions.ejs │ ├── employment.ejs │ ├── feedconnections.ejs │ ├── files-association.ejs │ ├── files.ejs │ ├── financial-statement.ejs │ ├── folders.ejs │ ├── home.ejs │ ├── invoice-attachments.ejs │ ├── invoicereminders.ejs │ ├── invoices-filtered.ejs │ ├── invoices.ejs │ ├── items.ejs │ ├── journals.ejs │ ├── leave-application.ejs │ ├── leave-types.ejs │ ├── linked-transactions.ejs │ ├── manualjournals.ejs │ ├── organisations.ejs │ ├── overpayments.ejs │ ├── pay-item.ejs │ ├── pay-run-calendars.ejs │ ├── pay-run.ejs │ ├── pay-runs.ejs │ ├── payment-methods.ejs │ ├── payments.ejs │ ├── paymentservices.ejs │ ├── payroll-au-employee.ejs │ ├── payroll-au-settings.ejs │ ├── payroll-calendar.ejs │ ├── payroll-nz-deductions.ejs │ ├── payroll-nz-earnings-rates.ejs │ ├── payroll-nz-employees-leave-periods.ejs │ ├── payroll-nz-employees-leave-setup.ejs │ ├── payroll-nz-employees-leave-types.ejs │ ├── payroll-nz-employees-leave.ejs │ ├── payroll-nz-employees-opening-balances.ejs │ ├── payroll-nz-employees-pay-templates.ejs │ ├── payroll-nz-employees-tax.ejs │ ├── payroll-nz-employees.ejs │ ├── payroll-nz-employment.ejs │ ├── payroll-nz-leave-balances.ejs │ ├── payroll-nz-leave-types.ejs │ ├── payroll-nz-pay-run-calendars.ejs │ ├── payroll-nz-pay-runs.ejs │ ├── payroll-nz-pay-slips.ejs │ ├── payroll-nz-payment-methods.ejs │ ├── payroll-nz-reimbursements.ejs │ ├── payroll-nz-salary-wages.ejs │ ├── payroll-nz-settings.ejs │ ├── payroll-nz-timesheets.ejs │ ├── payroll-nz-tracking-categories.ejs │ ├── payroll-uk-employees.ejs │ ├── payslip.ejs │ ├── payslips.ejs │ ├── prepayments.ejs │ ├── project-users.ejs │ ├── projects.ejs │ ├── purchaseorders.ejs │ ├── quotes.ejs │ ├── receipts.ejs │ ├── reimbursements.ejs │ ├── repeating-invoices.ejs │ ├── reports.ejs │ ├── salary-wages.ejs │ ├── settings.ejs │ ├── shared │ ├── error.ejs │ ├── head.ejs │ ├── header.ejs │ ├── layout.ejs │ └── nav.ejs │ ├── superfund.ejs │ ├── tasks.ejs │ ├── taxrates.ejs │ ├── time.ejs │ ├── timesheet.ejs │ ├── timesheets.ejs │ ├── tracking-categories.ejs │ ├── trackingcategories.ejs │ └── users.ejs ├── tsconfig.json ├── tslint.json └── utils └── build.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = false -------------------------------------------------------------------------------- /.github/workflows/jira_create_issue.yml: -------------------------------------------------------------------------------- 1 | name: Create Issue in Jira 2 | 3 | on: 4 | issues: 5 | types: 6 | - opened 7 | 8 | jobs: 9 | create_jira_issue: 10 | uses: XeroAPI/Xero-OpenAPI/.github/workflows/jira_create_issue.yml@master 11 | secrets: inherit 12 | -------------------------------------------------------------------------------- /.github/workflows/jira_update_issue_closed.yml: -------------------------------------------------------------------------------- 1 | name: Update Jira Ticket Status To Done 2 | 3 | on: 4 | issues: 5 | types: 6 | - closed 7 | 8 | jobs: 9 | create_jira_issue: 10 | uses: XeroAPI/Xero-OpenAPI/.github/workflows/jira_update_issue_closed.yml@master 11 | secrets: inherit 12 | -------------------------------------------------------------------------------- /.github/workflows/jira_update_issue_reopen.yml: -------------------------------------------------------------------------------- 1 | name: Update Jira Ticket Status To Backlog 2 | 3 | on: 4 | issues: 5 | types: 6 | - reopened 7 | 8 | jobs: 9 | create_jira_issue: 10 | uses: XeroAPI/Xero-OpenAPI/.github/workflows/jira_update_issue_reopen.yml@master 11 | secrets: inherit 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist 3 | npm-debug.log 4 | .env 5 | .DS_Store 6 | **img-temp* 7 | sessions/* 8 | .vscode -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at api@xero.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to xero-node-oauth2-app 2 | :+1::tada: First off, thanks for taking the time to contribute! :tada::+1: 3 | 4 | We want to make contributing to this project as easy and transparent as possible, whether it's: 5 | 6 | - Reporting a bug 7 | - Discussing the current state of the code 8 | - Submitting a fix 9 | - Proposing new features 10 | - Becoming a maintainer 11 | 12 | The following is a set of guidelines for contributing to Xero and its projects, which are hosted in the [XeroAPI Organization](https://github.com/XeroAPI) on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. 13 | 14 | ### Table Of Contents 15 | [Code of Conduct](#code-of-conduct) 16 | 17 | [How Can I Contribute?](#how-can-i-contribute) 18 | * [Reporting Bugs](#reporting-bugs) 19 | * [Suggesting Enhancements](#suggesting-enhancements) 20 | * [Pull Requests](#pull-requests) 21 | 22 | 23 | ## Code of Conduct 24 | Please note that this project is released with a [Contributor Code of Conduct](https://github.com/XeroAPI/xero-node-oauth2-app/blob/master/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms. 25 | 26 | ## I don't want to read this whole thing I just have a question!!! 27 | 28 | > **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below. 29 | 30 | We have an official [message board](https://community.xero.com/developer) where Xero API support and the community chimes in with helpful advice if you have questions. 31 | 32 | * [API Documentation](https://developer.xero.com/documentation/) 33 | * [Xero FAQ](https://developer.xero.com/faq) 34 | * [Community, the official Xero message board](https://community.xero.com/developer) 35 | * [Stackoverflow - Xero related](https://stackoverflow.com/questions/tagged/xero-api?sort=Newest) 36 | * [Submit requests for support](https://developer.xero.com/contact-xero-developer-platform-support/) to our API Support team. 37 | 38 | # How Can I Contribute? 39 | 40 | You can contribute by reporting bugs, suggesting enhancements, improving documentation i.e. [README](https://github.com/XeroAPI/xero-node-oauth2-app/blob/master/README.md) or submitting a pull request. 41 | 42 | 43 | ## Which version of the SDK are you using? 44 | 45 | This app is built using version 4.x of the xero-node SDK. 46 | 47 | ## Reporting Bugs 48 | 49 | Bugs are tracked as issues in this repository. 50 | 51 | Before opening a new issue: 52 | * **check [the README](https://github.com/XeroAPI/xero-node-oauth2-app/blob/master/README.md)** to see if the behavior you observed might be expected and if configuration options are available to provide you with the desired behavior. 53 | 54 | * **perform a cursory search** to see if there's [an existing issue](https://github.com/XeroAPI/xero-node-oauth2-app/issues) covering your feedback. If there is one and the issue is still open, **add a :+1: reaction** on the issue to express interest in the issue being resolved. That will help the team gauge interest without the noise of comments which trigger notifications to all watchers. Comments should be used only if you have new and useful information to share. 55 | 56 | ### Write bug reports with detail, background, and sample code 57 | 58 | - A quick summary and/or background 59 | - Steps to reproduce 60 | - Be specific! 61 | - Give sample code if you can. 62 | - What you expected would happen 63 | - What actually happens 64 | - Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) 65 | 66 | ## Suggesting Enhancements 67 | 68 | When opening an issue for a feature request: 69 | * **use a clear and descriptive title** for the issue to identify the problem. 70 | * **include as many details as possible in the body**. Explain your use-case, the problems you're hitting and the solutions you'd like to see to address those problems. 71 | 72 | ## Pull requests 73 | 74 | We welcome your feedback and pull requests. Be aware some code is generated and pull requests may not be the best solution - see below. 75 | 76 | ### Submit a pull request 77 | 78 | 1. Fork and clone the repository 79 | 1. Create a new branch: `git checkout -b my-branch-name` 80 | 1. Make your change, add tests if needed 81 | 1. Make sure the tests pass on your machine: `npm run test` 82 | 1. Push to your fork and submit a pull request 83 | 1. Pat yourself on the back and wait for your pull request to be reviewed and merged. 84 | 85 | Here are a few things you can do that will increase the likelihood of your pull request being accepted: 86 | 87 | - Follow the [style guide](#style-guide). 88 | - Write tests. 89 | - Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. 90 | - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). 91 | 92 | ### Style Guide 93 | 94 | * 2 spaces for indentation rather than tabs 95 | 96 | Our code style is codified in [.editorconfig](.editorconfig). You can install an EditorConfig IDE plugin to automatically format each source file, or do it by hand. 97 | 98 | ## License 99 | 100 | By contributing, you agree that your contributions will be licensed under the [MIT License](LICENSE). -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Xero Developer API 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: node dist/server.js 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Xero NodeJS OAuth 2.0 App 2 | This Node project demonstrates how to use the https://github.com/XeroAPI/xero-node SDK. 3 | 4 | Its purpose is to help javascript developers looking to build amazing applications with the data of users of the Xero Accounting platform: https://xero.com/. Secure authentication is setup using industry standard OAuth2.0. Access tokens fuel authorized api calls. 5 | 6 | ## Setup 7 | ``` 8 | git clone git@github.com:XeroAPI/xero-node-oauth2-app.git 9 | cd xero-node-oauth2-app 10 | ``` 11 | 12 | ### Configure with your credentials 13 | Create an API app in Xero to get a *CLIENT_ID* and *CLIENT_SECRET*. 14 | 15 | * Create a free Xero user account (if you don't have one) 16 | * Login to Xero Developer center https://developer.xero.com/myapps 17 | * Click "New App" 18 | * Enter your app details (the redirect URI for this app is: `http://localhost:5000/callback`) This URI does not need to be Internet-accessible. 19 | * Click "Create App" 20 | * Click "Generate a secret" 21 | * Create a `.env` file in the root of your project or rename & replace the vars in the provided `sample.env` file 22 | > `touch .env` 23 | ``` 24 | CLIENT_ID=... 25 | CLIENT_SECRET=... 26 | REDIRECT_URI=http://localhost:5000/callback 27 | ``` 28 | 29 | The redirect URI configured for the app created at https://developer.xero.com/myapps must match the REDIRECT_URI variable otherwise an "Invalid URI" error will be reported when attempting the initial connection to Xero. 30 | 31 | ### Build and run 32 | 33 | ```sh 34 | npm install 35 | npm run start-dev 36 | ``` 37 | 38 | *THIS APP WILL INTERACT WITH YOUR XERO ORG DATABASE. DO NOT CONNECT TO IT WITH A PRODUCTION ACCOUNTING ORG!* 39 | 40 | Set up a *Demo Company* if you plan on exploring all the routes: https://developer.xero.com/documentation/getting-started/development-accounts 41 | 42 | ## Project structure 43 | The project is best explored by cloning/running the app. While we've tried to keep dependencies at a minumum, we have chosen certain tools such as express and jwt-decode to make it easier to show practical usage of the SDK. 44 | 45 | The bulk of the helpful code is in `src/app.ts` - each SDK function is grouped by its corresponding object model and can be read about in more depth in the corresponding API set's documentation on our developer portal: https://developer.xero.com/documentation/api/api-overview 46 | 47 | We've done our best to make each route [idempotent](https://www.restapitutorial.com/lessons/idempotency.html). Most routes will run through the group of CRUD like actions for each model, showing practical usage for most every API interaction you might need. 48 | 49 | > For example the `Invoices` endpoint (`router.get("/invoices"`) will show the all data dependencies you will often be required to interact with in order to successfully interact with that endpoint. ex. How to import and setup expected types, structuring of params `contact: { contactID: contactID }`, or dependent objects or expected account codes that are not always obvious due to the complexity of financial accounting data. 50 | 51 | However, please be aware that based on the Organisation region, chart of accounts, or other data discrepency that certain routes may return an error. If its not obvious by the validation error, ex. "Account code '500' is not a valid code for this document." please raise an issue and we will try to get it sorted for you. 52 | 53 | # Token Management 54 | 55 | Since typescript will recompile each time the `src` directory is saved this can be a painpoint as the session is wiped out for each server change which includes the tokenSet. To help with this we've set it up to store your previous session in a `/sessions/` file as a low tech/dependency database for this repo. This will enable you to persist the tokenSet, and other utilized data such as the `activeTenant` between re-compiles. 56 | 57 | Occasionaly the file based session storage can get out of whack -`UnhandledPromiseRejectionWarning: #` If you find node hanging on that you can simply delete the sessions in that `/sessions/` folder and start fresh. 58 | 59 | ### IMPORTANT 60 | **Between each session restart - you will need to visit the root route "/" in order to set the session back onto the XeroClient** 61 | 62 | We recommend setting up a proper datastore in your production usage of the `xero-node` project. 63 | 64 | # Multiple Organisations 65 | 66 | Once you have connected to a Xero org, to connect to an additional org by clicking the Xero logo in the header. This will take you through the auth flow where you can select additional orgs to authorize. You can then choose from a dropdown which tenant you would like to pass to your api calls. Having > 1 org authenticated will also unlock some functionality like the `/disconnect` route. 67 | 68 | ## Debugging 69 | 70 | API Errors will be returned on the response body in an array. If you are working with a batch endpoint like `createContacts` its possible there will be multiple validation errors returned which you can summarize to an array with a batch functions optional `summarizeErrors` parameter. 71 | 72 | ``` 73 | response.body.invoices[i].validationErrors 74 | 75 | # example errors 76 | 77 | "The TaxType code does not exist or cannot be used for this type of transaction" 78 | "Account code '' is not a valid code for this document." 79 | ``` 80 | 81 | Also be aware that due to the size of Xero's many API sets, return errors may be structured a bit differently depending on which API set you are working with. 82 | 83 | ## Contributing 84 | You are very welcome to add/improve functionality - we will continue to make improvements that show more complex API usage like filter/sorting, paginating, and will add more CRUD workflows as new API sets are added to the xero-node SDK. Please open an issue if something is not working correctly. 85 | -------------------------------------------------------------------------------- /nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": [ 3 | "src" 4 | ], 5 | "ext": "ts ejs", 6 | "exec": "ts-node -T ./src/server.ts" 7 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xero-node-oauth2-app", 3 | "version": "1.0.0", 4 | "description": "App to demonstrate xero-node OAuth 2.0.", 5 | "author": "Xero Platform Team", 6 | "license": "MIT", 7 | "main": "dist/server.js", 8 | "scripts": { 9 | "build-ts": "node ./utils/build.js", 10 | "postinstall": "npm run build-ts", 11 | "lint": "tslint --project \"tsconfig.json\"", 12 | "start-dev": "nodemon --config" 13 | }, 14 | "engines": { 15 | "node": "12.12.0" 16 | }, 17 | "devDependencies": { 18 | "@types/ejs": "^2.6.3", 19 | "@types/express": "^4.17.2", 20 | "@types/express-session": "^1.15.15", 21 | "@types/jwt-decode": "^2.2.1", 22 | "@types/node": "^12.12.11", 23 | "fs-extra": "^8.1.0", 24 | "openid-client": "^3.8.3", 25 | "ts-node": "^8.5.2", 26 | "tslint": "^5.20.1", 27 | "typescript": "^3.6.3" 28 | }, 29 | "dependencies": { 30 | "body-parser": "^1.19.0", 31 | "crypto": "^1.0.1", 32 | "dotenv": "^8.2.0", 33 | "ejs": "^3.1.10", 34 | "express": "^4.17.1", 35 | "express-session": "^1.17.0", 36 | "fs-extra": "^8.1.0", 37 | "helper": "0.0.13", 38 | "jwt-decode": "^2.2.0", 39 | "module-alias": "^2.2.2", 40 | "nodemon": "^1.19.4", 41 | "path": "^0.12.7", 42 | "session-file-store": "^1.4.0", 43 | "xero-node": "10.0.0" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /public/images/connect-blue.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/images/connect-white.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/images/disconnect-blue.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/images/disconnect-white.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/images/xero-dev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XeroAPI/xero-node-oauth2-app/be704b2d0a10e7ae333a39feea262784e33f1ed2/public/images/xero-dev.png -------------------------------------------------------------------------------- /public/xero.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XeroAPI/xero-node-oauth2-app/be704b2d0a10e7ae333a39feea262784e33f1ed2/public/xero.ico -------------------------------------------------------------------------------- /sample.env: -------------------------------------------------------------------------------- 1 | CLIENT_ID='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2 | CLIENT_SECRET='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx' 3 | REDIRECT_URI='http://localhost:5000/callback' 4 | WEBHOOK_KEY='xxxxx/xxxxx/xxx+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+xx/xxxxxxxxxx==' -------------------------------------------------------------------------------- /src/helper/index.ts: -------------------------------------------------------------------------------- 1 | export default class helper { 2 | public static getRandomNumber(range) { 3 | return Math.round(Math.random() * ((range || 100) - 1) + 1); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/server.ts: -------------------------------------------------------------------------------- 1 | import app from "./app"; 2 | 3 | const PORT = process.env.PORT || 5000; 4 | app.listen(PORT, () => console.log(`App listening on port ${PORT}!`)); 5 | -------------------------------------------------------------------------------- /src/types/index.ts: -------------------------------------------------------------------------------- 1 | import { Session } from 'express-session' 2 | import { XeroAccessToken, XeroIdToken, TokenSetParameters } from 'xero-node'; 3 | 4 | declare module 'express-session' { 5 | interface Session { 6 | decodedAccessToken: XeroAccessToken; 7 | decodedIdToken: XeroIdToken; 8 | tokenSet: TokenSetParameters; 9 | allTenants: any[]; 10 | activeTenant: any; 11 | } 12 | } -------------------------------------------------------------------------------- /src/views/accounting-activity.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Accounting Activity Account Usage:

11 |

<%= JSON.stringify(getAccountingActivityAccountUsage, null, 2) %>

12 |

Accounting Activity Lock History:

13 |

<%= JSON.stringify(getAccountingActivityLockHistory, null, 2) %>

14 |

Accounting Activity Report History:

15 |

<%= JSON.stringify(getAccountingActivityReportHistory, null, 2) %>

16 |

Accounting Activity User Activities:

17 |

<%= JSON.stringify(getAccountingActivityUserActivities, null, 2) %>

18 |
19 |
20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /src/views/accounts.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

Accounts

12 |
13 |

Read all Accounts - count: <%= accountsCount %>

14 |

Create Account - name : <%= createName %>

15 |

Read one Account - name : <%= getOneName %>

16 |

Updated Account - updateName : <%= updateName %>

17 |

Attached:

18 |
19 |             <%- JSON.stringify(attachments, null, 2) %>
20 |           
21 |

Delete Account - name : <%= deleteName %>

22 |
23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /src/views/assets.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

https://developer.xero.com/documentation/assets-api/overview

12 |
13 |

Assets Settings: <%- JSON.stringify(assetSettings, null, 2).replace(/[{}]/g, '') %>

14 |

Create Asset: <%= createAsset %>

15 |

Get One Assets: <%= getAsset %>

16 |

Get All Assets: <%- JSON.stringify(assets, null, 2).replace(/[{}]/g, '') %>

17 |

AssetTypes:

18 | <%- JSON.stringify(assetTypes, null, 2).replace(/[{}]/g, '') %> 19 |
20 |
21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /src/views/attachment-invoice.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

Attachments

12 |
13 |
14 |             <%- JSON.stringify(attachments, null, 2) %>
15 |           
16 |
17 |
18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /src/views/attachments.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

https://developer.xero.com/documentation/api/accounts

12 |
13 |

Read all Accounts - count: <%= accountsCount %>

14 |

Create Account - name : <%= createName %>

15 |

Read one Account - name : <%= getOneName %>

16 |

Updated Account - updateName : <%= updateName %>

17 |

Created Attachment - attachmentId : <%= createAttachmentId %>

18 |

Read Attachments - count : <%= attachmentsCount %>

19 |

Delete Account - name : <%= deleteName %>

20 |
21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /src/views/bank-statements-plus.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Bank Statements Plus:

11 |

<%= JSON.stringify(getBankStatementsPlus, null, 2) %>

12 |
13 |
14 |
15 | 16 | -------------------------------------------------------------------------------- /src/views/bankfeed-connections.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Bankfeeds: Count: <%= bankfeeds %>

12 |

Bankfeeds: Create: <%= created %>

13 |

Bankfeeds: Get: <%= get %>

14 |

Bankfeeds: Delete status code: <%= deleted %>

15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/bankfeed-statements.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Statements: Count: <%= count %>

12 |

Statements: Create: <%= created %>

13 |

Statements: Get:

14 |
15 |           <%- JSON.stringify(get, null, 2) %>
16 |         
17 |
18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/views/banktranfers.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

Bank Transfers

12 |
13 |

Total Bank Tranfers Count: (<%= allBankTransfers.length %>)

14 |

Created Bank Tranfer: <%= createBankTransferId %>

15 |

Get Bank Tranfer: <%= getBankTransferId %>

16 |
17 |
18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /src/views/banktransactions.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

Bank Transactions

12 |
13 |

all BankTransactions - count: <%= bankTransactionsCount %>

14 |

Create BankTransaction - ID : <%= createID %>

15 |

one BankTransaction - status : <%= getOneStatus %>

16 |

Updated BankTransaction - status : <%= updatedStatus %>

17 |
18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/views/batchpayments.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

Batch Payments

12 |
13 |
14 |

Created Batch Payments: <%= createBatchPayment %>

15 |
16 |

Get Batch Payment by ID:

17 |
18 |             <%= getByBatchPaymentID %>
19 |           
20 |

Created History Record for Batch Payment:

21 |
22 |
23 |             <%= createdHistoryRecord %>
24 |           
25 |
26 |

Get History Record for Batch Payment:

27 |
28 |             <%= getHistoryRecord %>
29 |           
30 |
31 |

Deleted Batch Payments:

32 |
33 |             <%= deletedBatchPayment %>
34 |           
35 |
36 |

Delete Batch Payments by ID:

37 |
38 |             <%= deletedBatchPaymentByURLParam %>
39 |           
40 |
41 |

Total Batch Payments: <%= count %>

42 |
43 |
44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /src/views/brandingthemes.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 | 12 |

Branding Themes

13 |
14 |

Branding Themes success: Count: <%= brandingThemesCount %>

15 |

Branding Themes success: Get Branding Theme: <%= brandingTheme %>

16 |

Branding Themes success: Create Branding Theme Payment Service: <%= createBrandingThemePaymentService %>

17 |

Branding Themes success: Get Branding Theme Payment Service: <%= getBrandingThemePaymentService %>

18 |
19 |
20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /src/views/budgets.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

Budgets

12 |
13 |

Get single Budget

14 |
15 |             <%- JSON.stringify(budget, null, 2) %>
16 |           
17 |
18 |             <%- JSON.stringify(budgets, null, 2) %>
19 |           
20 |
21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /src/views/callback.ejs: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | <%- include('shared/head') -%> 13 | 14 | <%- include('shared/nav') -%> 15 |
16 | <%- include('shared/header') -%> 17 |
18 |
19 | <% if (authenticated.decodedIdToken && authenticated.decodedAccessToken) { %> 20 |

You are authenticated with: <%= authenticated.activeTenant.tenantName %>

21 |
22 |
Token Expires: <%= authenticated.accessTokenExpires %>
23 |

Active Tenant:

24 |
25 |               
26 |                 <% if (authenticated.activeTenant.orgData) { %>}
27 |                   <%- JSON.stringify(authenticated.activeTenant.orgData, null, 2).replace(/[{}]/g, '').substring(0, 300) + ' ...' %>
28 |                 <%} else { %>
29 |                   <%- JSON.stringify(authenticated.activeTenant, null, 2).replace(/[{}]/g, '').substring(0, 300) + ' ...' %>
30 |                 <% } %>
31 |               
32 |             
33 |
34 |

Access Token Data:

35 |
36 |               
37 |                 <%- JSON.stringify(authenticated.decodedAccessToken, null, 2).replace(/[{}]/g, '') %>
38 |               
39 |             
40 |
41 |

Id Token Data:

42 |
43 |               
44 |                 <%- JSON.stringify(authenticated.decodedIdToken, null, 2).replace(/[{}]/g, '') %>
45 |               
46 |             
47 | <%} else { %> 48 |

This tutorial will show developers how to utilise our API endpoints with the "xero-node" SDK version in package.json

49 |

WARNING!

50 |

This tutorial will Create, Read, Update & Delete REAL objects in the authenticated Xero organisation.

51 |

Please only authenticate with a Demo Company or a non-production organisation.

52 | <% } %> 53 |
54 |
55 |
56 | 57 | 58 | -------------------------------------------------------------------------------- /src/views/cash-validation.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Cash Validation:

11 |

<%= JSON.stringify(getCashValidation, null, 2) %>

12 |
13 |
14 |
15 | 16 | -------------------------------------------------------------------------------- /src/views/contactgroups.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

createdContactGroupID: <%= createdContactGroupID %>

11 |

getContactGroupName: <%= getContactGroupName %>

12 |

updatedContactGroupContactID: <%= updatedContactGroupContactID %>

13 |

deletedContactGroupContact: <%= deletedContactGroupContact %>

14 |

Total Contact Groups count: <%= count %>

15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/contacts.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

https://developer.xero.com/documentation/api/contacts

12 |
13 |

Read all Contacts - count: <%= contactsCount %>

14 |

Create Contact - name : <%= createName %>

15 |

Read one Contact - name : <%= getOneName %>

16 |

Updated Contact : <%= JSON.stringify(updatedContact, null, 2).replace(/[{}]/g, '') %>

17 |
18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/views/creditnotes.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Credit Notes success: Count: <%= count %>

12 |

Credit Notes success: Create: <%= create %>

13 |

Credit Notes success: Update: <%= update %>

14 |

Credit Notes success: Create History Record: <%= createHistoryRecord %>

15 |

Credit Notes success: Create Allocation: <%= createAllocation %>

16 |

Credit Notes success: Create Attachment By File Name: <%= createAttachmentByFileName %>

17 |

Credit Notes success: Get One: <%= getOne %>

18 |

Credit Notes success: Get History Records (count): <%= historyRecords %>

19 |

Credit Notes success: Get Attachments (count): <%= attachmentsCount %>

20 |

Credit Notes success: Get Attachment By ID: buffer

21 |

Credit Notes success: Get Attachment By File Name: buffer

22 |

Credit Notes success: Get Attachment As PDF: buffer

23 |
24 |
25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /src/views/currencies.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Currencies:

12 | <% for(var i=0; i < currencies.length; i++) { %> 13 |

<%= currencies[i].code %> - <%= currencies[i].description %>

14 | <% } %> 15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/earnings-orders.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Earnings Orders: <%- JSON.stringify(deductions, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/earnings-rates.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Earnings Rates: <%- JSON.stringify(rates, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/employee-opening-balances.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Opening Balances: `Previous employer tax opening balances are now on the 12 | employee's taxes page.`

13 |
14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /src/views/employees-leave-balances.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Leave Balances: <%- JSON.stringify(leaveBalances, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/employees-leave-periods.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Leave Periods: <%- JSON.stringify(leavePeriods, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/employees-leave-types.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Leave Types: <%- JSON.stringify(leaveTypes, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/employees-leave.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Leaves: <%- JSON.stringify(leaves, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/employees-pay-templates.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Pay Template: <%- JSON.stringify(payTemplate, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/employees-statutory-leave-balances.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Statutory Leave Balances: <%- JSON.stringify(leaveBalance, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/employees-statutory-leave-summary.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Leave Summary: <%- JSON.stringify(leaveSummary, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/employees-statutory-sick-leave.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Statutory Sick Leave: `TODO sick leave`

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/employees-tax.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Tax: <%- JSON.stringify(employeeTax, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/employees.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Employees success: Count: <%= count %>

11 |

createdEmployeeId: <%= createdEmployeeId %>

12 |

getEmployeeName: <%= getEmployeeName %>

13 |

updatedEmployeeId: <%= updatedEmployeeId %>

14 |
15 |
16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /src/views/employer-pensions.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employer Pensions: <%- JSON.stringify(benefits, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/employment.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Create Employment: `TODO employment`

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/feedconnections.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

https://developer.xero.com/documentation/bank-feeds-api/feed-connections

12 |
13 |

Read all Feed Connections - count: <%= count %>

14 |

Create Feed Connection - token : <%= createName %>

15 |

Read one Feed Connection - name : <%= getOneName %>

16 |

Delete Account - ID : <%= deleteId %>

17 |
18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/views/files-association.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Associations:

11 |

<%= JSON.stringify(createAssociation, null, 2).replace(/[{}]/g, '') %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/files.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Uploaded:

11 | <%- JSON.stringify(uploadFile, null, 2) %> 12 |

Files:

13 | <% for(var i=0; i < files.length; i++) { %> 14 |

<%= files[i].name %> - <%= files[i].id %>

15 | <% } %> 16 |
17 |
18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /src/views/financial-statement.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Financial Statement Balance Sheet:

11 |

<%= JSON.stringify(getFinancialStatementBalanceSheet, null, 2) %>

12 |

Financial Statement Cashflow:

13 |

<%= JSON.stringify(getFinancialStatementCashflow, null, 2) %>

14 |

Financial Statement Profit And Loss:

15 |

<%= JSON.stringify(getFinancialStatementProfitAndLoss, null, 2) %>

16 |

Financial Statement Trial Balance:

17 |

<%= JSON.stringify(getFinancialStatementTrialBalance, null, 2) %>

18 |

Financial Statement Contacts Expense:

19 |

<%= JSON.stringify(getFinancialStatementContactsExpense, null, 2) %>

20 |

Financial Statement Contacts Revenue:

21 |

<%= JSON.stringify(getFinancialStatementContactsRevenue, null, 2) %>

22 |
23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /src/views/folders.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Folders:

11 | <% for(var i=0; i < folders.length; i++) { %> 12 |

<%= folders[i].name %> - <%= folders[i].id %>

13 | <% } %> 14 |
15 |
16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /src/views/home.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | <% if (authenticated.decodedIdToken && authenticated.decodedAccessToken && authenticated.activeTenant) { %> 11 |

You are authenticated with: <%= authenticated.activeTenant.tenantName %>

12 |
13 |
Token Expires: <%= authenticated.accessTokenExpires %>
14 |

Active Tenant:

15 |
16 |               
17 |                 <% if (authenticated.activeTenant.orgData) { %>}
18 |                   <%- JSON.stringify(authenticated.activeTenant.orgData, null, 2).replace(/[{}]/g, '').substring(0, 300) + ' ...' %>
19 |                 <%} else { %>
20 |                   <%- JSON.stringify(authenticated.activeTenant, null, 2).replace(/[{}]/g, '').substring(0, 300) + ' ...' %>
21 |                 <% } %>
22 |               
23 |             
24 |
25 |

Access Token Data:

26 |
27 |               
28 |                 <%- JSON.stringify(authenticated.decodedAccessToken, null, 2).replace(/[{}]/g, '') %>
29 |               
30 |             
31 |
32 |

Id Token Data:

33 |
34 |               
35 |                 <%- JSON.stringify(authenticated.decodedIdToken, null, 2).replace(/[{}]/g, '') %>
36 |               
37 |             
38 | 39 | <%} else { %> 40 |

Please authenticate to explore the tutorial

41 |

This tutorial will show developers how to utilise our API endpoints with the "xero-node" SDK version in package.json

42 |

WARNING!

43 |

This tutorial will Create, Read, Update & Delete REAL objects in the authenticated Xero organisation.

44 |

Please only authenticate with a Demo Company or a non-production organisation.

45 | <% } %> 46 |
47 |
48 |
49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/views/invoice-attachments.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Invoice attachements: <%= attachments %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/invoicereminders.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Invoice Reminders success: Count: <%= count %>

12 |

Invoice Reminders success: Enabled: <%= enabled %>

13 |
14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /src/views/invoices-filtered.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

Invoices

12 |
13 |

Filtered Invoices: <%- JSON.stringify(filteredInvoices, null, 2).replace(/[{}]/g, '') %>

14 |
15 |
16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /src/views/invoices.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

Invoices

12 |
13 | 14 | <% if ((typeof(createdInvoice) !== 'undefined' && createdInvoice && typeof(createdInvoice) !== 'undefined')) { %> 15 |

Created Invoice Number: $<%= createdInvoice.reference %>

16 |

Created Invoice: <%- JSON.stringify(createdInvoice, null, 2).replace(/[{}]/g, '') %>

17 |

Updated Invoice: $<%= updatedInvoice.reference %>

18 |

Get Invoice: <%= invoiceId %>

19 |

Total Invoices: <%= count %>

20 | 21 |

WARNING!

22 | Email will actually go out to: <%= email %> 23 | <% url = "/email-invoice?invoiceID=" + createdInvoice.invoiceID %> 24 |

Email invoice:

25 | > 26 | <%= createdInvoice.invoiceID %> 27 | 28 | <% } else { %> 29 | Email sent! 30 | <% } %> 31 |
32 |
33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /src/views/items.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Read all Items - count: <%= itemsCount %>

11 |

Create Item - name : <%= createName %>

12 |

Read one Item - name : <%= getOneName %>

13 |

Updated Item - name : <%= updateName %>

14 |

Deleted Item - response code : <%= deleteResponse %>

15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/journals.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Journals: <%= %>

11 | <% for(var i=0; i < journals.length; i++) { %> 12 |

<%= JSON.stringify(journals[i]) %>

13 | <% } %> 14 |

Journal by number:

15 |

<%= JSON.stringify(journal, null, 2) %>

16 |
17 |
18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /src/views/leave-application.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Leave Items: 11 |

    12 | <% for(var i=0; i < leaveItems.length; i++) { %> 13 |
  • <%- JSON.stringify(leaveItems[i], null, 2).replace(/[{}]/g, '') %>
  • 14 |
    15 | <% } %> 16 |
17 |
18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/views/leave-types.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Leave Types: <%- JSON.stringify(types, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/linked-transactions.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Linked Transactions success: Count: <%= count %>

12 |

Linked Transactions success: Create: <%= create %>

13 |

Linked Transactions success: Get:

14 |
15 |             <%- JSON.stringify(get, null, 2) %>
16 |         
17 |

Linked Transactions success: Update:

18 |
19 |             <%- JSON.stringify(update, null, 2) %>
20 |         
21 |

Linked Transactions success: Delete: <%= deleted %>

22 |
23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /src/views/manualjournals.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Manual Journals success: Count: <%= count %>

12 |

Manual Journals success: Create: <%= create %>

13 |

Manual Journals success: Create Attachments by File Name:

14 |
15 |             <%- JSON.stringify(mjAttachmentByFileName, null, 2) %>
16 |         
17 |

Manual Journals success: Get One: <%= getMJ %>

18 |

Manual Journals success: Get Attachments:

19 |
20 |             <%- JSON.stringify(getMJAttachments, null, 2) %>
21 |         
22 |

Manual Journals success: Get Attachments by File Name: buffered

23 |

Manual Journals success: Get Attachments by ID: buffered

24 |

Manual Journals success: Update: <%= updateMJ %>

25 |
26 |
27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /src/views/organisations.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

Organisation

12 |
13 | <% for(var i=0; i < orgs.length; i++) { %> 14 |

Name: <%= orgs[i].name %>

15 |

organisationID: <%= orgs[i].organisationID %>

16 |

aPIKey: <%= orgs[i].aPIKey %>

17 |

name: <%= orgs[i].name %>

18 |

legalName: <%= orgs[i].legalName %>

19 |

paysTax: <%= orgs[i].paysTax %>

20 |

version: <%= orgs[i].version %>

21 |

organisationType: <%= orgs[i].organisationType %>

22 |

baseCurrency: <%= orgs[i].baseCurrency %>

23 |

countryCode: <%= orgs[i].countryCode %>

24 |

isDemoCompany: <%= orgs[i].isDemoCompany %>

25 |

organisationStatus: <%= orgs[i].organisationStatus %>

26 |

timezone: <%= orgs[i].timezone %>

27 |

organisationEntityType: <%= orgs[i].organisationEntityType %>

28 |

shortCode: <%= orgs[i].shortCode %>

29 |

edition: <%= orgs[i].edition %>

30 | <% } %> 31 |
32 |
33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /src/views/overpayments.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Over payments success: Count: <%= count %>

12 |

Over payments success: Create: <%= overpayment %>

13 |

Over payments success: Allocate: <%= allocation %>

14 |

Over payments success: Get One: <%= getOne %>

15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/pay-item.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Pay Items:

11 |
12 |             <%- JSON.stringify(payItems, null, 2) %>
13 |           
14 |
15 |
16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /src/views/pay-run-calendars.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Pay Run Calendars: <%- JSON.stringify(payRunCalendars, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/pay-run.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Pay Runs: 11 |

    12 | <% for(var i=0; i < payRuns.length; i++) { %> 13 |
  • <%- JSON.stringify(payRuns[i], null, 2).replace(/[{}]/g, '') %>
  • 14 |
    15 | <% } %> 16 |
17 |
18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/views/pay-runs.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Pay Runs: <%- JSON.stringify(payRuns, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payment-methods.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Payment Method: <%- JSON.stringify(paymentMethod, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payments.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Payments success: Count: <%= count %>

12 |

Payments success: Create - PaymentID: <%= newPayment %>

13 |

Payments success: Get - Invoice Contact Name: <%= getPayment %>

14 |
15 |
16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /src/views/paymentservices.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Payment Services success: Count: <%= count %>

12 |

Payment Services success: Created: <%= create %>

13 |
14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /src/views/payroll-au-employee.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Created Employee: <%- JSON.stringify(createdEmployee, null, 2) %>

11 |

Get Payroll Employees: <%- JSON.stringify(getEmployees, null, 2) %>

12 |

Get Payroll Employees: <%- JSON.stringify(updateEmployee, null, 2) %>

13 |
14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /src/views/payroll-au-settings.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Payroll Settings:

12 |
13 |             <%- JSON.stringify(payrollSettings, null, 2) %>
14 |           
15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/payroll-calendar.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Pay Calendars: 11 |

    12 | <% for(var i=0; i < getPayrollCalendars.length; i++) { %> 13 |
  • <%- JSON.stringify(getPayrollCalendars[i], null, 2).replace(/[{}]/g, '') %>
  • 14 |
    15 | <% } %> 16 |
17 |
18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/views/payroll-nz-deductions.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Deductions: Count: <%= count %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-earnings-rates.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Earnings rates: Count: <%= count %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-employees-leave-periods.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Leave Periods: <%- JSON.stringify(periods, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-employees-leave-setup.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Leave Setup: `TODO leave setup`

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-employees-leave-types.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Leave Types: <%- JSON.stringify(leaveTypes, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-employees-leave.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Employees leave: Count: <%= count %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-employees-opening-balances.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Opening Balances: <%- JSON.stringify(openingBalances, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-employees-pay-templates.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Pay Templates: <%- JSON.stringify(payTemplate, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-employees-tax.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employees Tax: <%- JSON.stringify(tax, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-employees.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Employees: Count: <%= count %>

12 |

Employees: Create: <%= create %>

13 |

Employees: Update: <%= updated %>

14 |

Get Employee: <%- JSON.stringify(getOne, null, 2) %>

15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/payroll-nz-employment.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Create Employment: `TODO employment`

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-leave-balances.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Leave Balances: <%- JSON.stringify(leaveBalances, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-leave-types.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Leave Types: <%- JSON.stringify(leaveTypes, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-pay-run-calendars.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Pay Run Calendars: <%- JSON.stringify(calendars, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-pay-runs.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Pay Runs: <%- JSON.stringify(payRuns, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-pay-slips.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Pay Slips: <%- JSON.stringify(slips, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-payment-methods.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Payment Methods: <%- JSON.stringify(method, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-reimbursements.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Reimbursements: <%- JSON.stringify(reimbursements, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-salary-wages.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Employee Salary and Wages: <%- JSON.stringify(salaryAndWages, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-settings.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Settings: <%- JSON.stringify(settings, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-timesheets.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Timesheets: <%- JSON.stringify(timesheets, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-nz-tracking-categories.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Tracking Categories: <%- JSON.stringify(categories, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/payroll-uk-employees.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Payroll Employees: <%- JSON.stringify(employees, null, 2) %>

12 |

Create Payroll Employee: <%- JSON.stringify(created, null, 2) %>

13 |

Get Payroll Employee: <%- JSON.stringify(got, null, 2) %>

14 |

Update Payroll Employee: <%- JSON.stringify(updated, null, 2) %>

15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/payslip.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Payslips: `TODO payslips`

11 |
12 |
13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /src/views/payslips.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Payslips: <%- JSON.stringify(paySlips, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/prepayments.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Pre Payments success: Count: <%= count %>

12 |

Pre Payments success: Prepayment ID: <%= prepayment %>

13 |

Pre Payments success: Allocation: <%= allocation %>

14 |

Pre Payments success: Remaining Credit: <%= remainingCredit %>

15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/project-users.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 | 12 |

https://developer.xero.com/documentation/projects/overview-projects

13 |
14 |

Get Project Users:

15 |
16 |             <%- JSON.stringify(users, null, 2) %>
17 |         
18 |
19 |
20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /src/views/projects.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 | 12 |

https://developer.xero.com/documentation/projects/overview-projects

13 |
14 |

Total Projects: <%= count %>

15 |

Create Project: <%= create %>

16 |

Get Project: <%= get %>

17 |

Update Project: <%= update %>

18 |

Patch Project: <%= patch %>

19 |
20 |
21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /src/views/purchaseorders.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Purchase Orders success: Count: <%= count %>

12 |

Purchase Orders success: Create: <%= create %>

13 |

Purchase Orders success: Get: <%= get %>

14 |

Purchase Orders success: Update: <%= update %>

15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/quotes.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 | 11 |

https://developer.xero.com/documentation/api/quotes

12 |
13 |

Read all Quotes - count: <%= count %>

14 |

Read one Quote - quote number : <%= getOneQuoteNumber %>

15 |

Created quote: <%= createdQuotesId %>

16 |

Attached:

17 |
18 |               <%- JSON.stringify(addQuoteAttachment, null, 2) %>
19 |             
20 |
21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /src/views/receipts.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Receipts success: Count: <%= count %>

12 |

Receipts success: Create: <%= create %>

13 |

Receipts success: Get One: <%= getOne %>

14 |

Receipts success: Update: <%= update %>

15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/reimbursements.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Reimbursements: <%- JSON.stringify(reimbursements, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/repeating-invoices.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Repeating Invoices: Count: <%= count %>

12 |

Get Repeating Invoice by ID: Total: <%= getOne %>

13 |

Create Repeating Invoice: ID: <%= created %>

14 |

Update Repeating Invoice by ID: status: <%= updated %>

15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/views/reports.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Bank Summary Report Title: <%= bankSummaryReportTitle %>

11 |

1099 Report Title: <%= tenNinetyNineReportTitle %>

12 |

Aged Payables by Contact Report Title & Date: <%= agedPayablesByContactReportTitle %>

13 |

Aged Receivables by Contact Report Title & Date: <%= agedReceivablesByContactReportTitle %>

14 |

Balance Sheet Report Title & Date: <%= getBalanceSheetReportTitle %>

15 |

Bank Summary Report Title & Date: <%= getReportBankSummaryReportTitle %>

16 |

Budget Summary Report Title & Date: <%= getBudgetSummaryReportTitle %>

17 |

Executive Summary Report Title & Date: <%= getExecutiveSummaryReportTitle %>

18 |

Profit and Loss Report Title & Date: <%= getProfitAndLossReportTitle %>

19 |

Trial Balance Report Title & Date: <%= getTrialBalanceReportTitle %>

20 |

Get Rport from List -> ID Title & Date: <%= getReportFromId %>

21 |
22 |
23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /src/views/salary-wages.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Salary and Wages: <%- JSON.stringify(salaryAndWages, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/settings.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Settings: <%- JSON.stringify(settings, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/shared/error.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('head') -%> 4 | 5 | <%- include('nav') -%> 6 |
7 | <%- include('header') -%> 8 |
9 |

Error:

10 |
11 |           
12 |             <% if(error && error.toString().includes("TypeError: Cannot read property 'access_token' of undefined")) { %>
13 |               <%= error %>
14 |               
15 | Re-Authenticate 16 | <% } else if (error && error.response) { %> 17 | <%- JSON.stringify(error, null, 2).replace(/[{}]/g, '') %> 18 | <% } else{ %> 19 | <%= error %> 20 | <% } %> 21 |
22 |
23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /src/views/shared/head.ejs: -------------------------------------------------------------------------------- 1 | xero-node SDK tutorial 2 | 3 | 4 | 5 | 6 | 7 | 8 | 249 | 250 | -------------------------------------------------------------------------------- /src/views/shared/header.ejs: -------------------------------------------------------------------------------- 1 |
2 | <% const loggedIn=typeof(authenticated) !=='undefined' && typeof(authenticated.allTenants) !=='undefined' && 3 | authenticated.allTenants && authenticated.allTenants.length %> 4 | 5 | <% if ((typeof(consentUrl) !=='undefined' && consentUrl && typeof(authenticated) !=='undefined' ) && !loggedIn) { %> 6 | 7 | 8 | 9 | <% } else { %> 10 | 11 | 12 | 13 | <% } %> 14 | 15 | 16 | <% if (loggedIn) { %> 17 | 22 | 29 | 34 | 48 | <% } %> 49 |
-------------------------------------------------------------------------------- /src/views/shared/layout.ejs: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | ☺️ org name 6 |
7 | -------------------------------------------------------------------------------- /src/views/shared/nav.ejs: -------------------------------------------------------------------------------- 1 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /src/views/superfund.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Super Funds: 11 |

    12 | <% for(var i=0; i < getSuperFunds.length; i++) { %> 13 |
  • <%- JSON.stringify(getSuperFunds[i], null, 2).replace(/[{}]/g, '') %>
  • 14 |
    15 | <% } %> 16 |
17 |
18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/views/tasks.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 | 12 |

https://developer.xero.com/documentation/projects/overview-projects

13 |
14 |

Project Tasks: <%= count %>

15 |

Project Task Get: <%= get %>

16 |

Project Task Create: <%= create %>

17 |

Project Task Update: <%= update %>

18 |

Project Task Deleted: <%= deleted %>

19 |
20 |
21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /src/views/taxrates.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

Tax Rates success: Count: <%= count %>

11 |

Tax Rates success: Created: <%= created %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/time.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 | 12 |

https://developer.xero.com/documentation/projects/overview-projects

13 |
14 |

Time Entries: <%= count %>

15 |

Time Entry Create: <%= create %>

16 |

Time Entry Get: <%= get %>

17 |

Time Entry Update: <%= update %>

18 |

Time Entry Delete: <%= deleted %>

19 |
20 |
21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /src/views/timesheet.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | <%- include('shared/nav') -%> 6 |
7 | <%- include('shared/header') -%> 8 |
9 |
10 |

TimeSheets: 11 |

    12 | <% for(var i=0; i < timeSheets.length; i++) { %> 13 |
  • <%- JSON.stringify(timeSheets[i], null, 2).replace(/[{}]/g, '') %>
  • 14 |
    15 | <% } %> 16 |
17 |
18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/views/timesheets.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Timesheets: <%- JSON.stringify(timesheets, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/tracking-categories.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Get Tracking Categories: <%- JSON.stringify(trackingCategories, null, 2) %>

12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/views/trackingcategories.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Tracking Categories success: Count: <%= count %>

12 |

Tracking Categories success: Created: <%= created %>

13 |

Tracking Categories success: Get: <%= got %>

14 |

Tracking Categories success: Updated: <%= updated %>

15 |

Tracking Categories success: Status: <%= deleted %>

16 |
17 |
18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /src/views/users.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- include('shared/head') -%> 4 | 5 | 6 | <%- include('shared/nav') -%> 7 |
8 | <%- include('shared/header') -%> 9 |
10 |
11 |

Users success: Count: <%= count %>

12 |

User success: Email: <%= user %>

13 |
14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "esModuleInterop": true, 5 | "target": "es6", 6 | "moduleResolution": "node", 7 | "sourceMap": true, 8 | "outDir": "dist", 9 | "rootDir": "./src" 10 | }, 11 | "lib": [ 12 | "es2015" 13 | ], 14 | "exclude": [ 15 | "node_modules" 16 | ], 17 | "typeRoots": [ 18 | "./src/types", 19 | "./node_modules/@types" 20 | ] 21 | } -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended"], 4 | "jsRules": {}, 5 | "rules": { 6 | "no-console": false 7 | }, 8 | "rulesDirectory": [] 9 | } 10 | -------------------------------------------------------------------------------- /utils/build.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs-extra'); 2 | const childProcess = require('child_process'); 3 | 4 | 5 | try { 6 | // Remove current build 7 | fs.removeSync('./dist/'); 8 | // Copy front-end files 9 | fs.copySync('./public', './dist/public'); 10 | fs.copySync('./src/views', './dist/views'); 11 | // Transpile the typescript files 12 | childProcess.exec('tsc --build tsconfig.json'); 13 | } catch (err) { 14 | console.log(err); 15 | } 16 | --------------------------------------------------------------------------------