1.2.4 • Published 8 years ago

@eda/xero-facade v1.2.4

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
8 years ago

Xero-facade npm Documentation

For usage with EDA admissions prototype

IMPORTANT FOR NPM TO WORK This Npm uses dotenv and fs for handling credentials for xero authentication.

Xero utilises a consumer key, consumer secret and a private key .pem file for authentication - Documentation for instructions Create a .env file and set the following:

  • CONSUMER_KEY - 'your consumer key'
  • CONSUMER_SECRET - 'your consumer secret'

Put the .pem file in the root directory. Initializing Xero is done below:

var xeroCredentials = {
  consumerKey: process.env.CONSUMER_KEY,
  consumerSecret: process.env.CONSUMER_SECRET,
  privateKey: fs.readFileSync('path to .pem file')
};
var xero = require('@eda/xero-facade')(xeroCredentials);

createAnInvoice(invoiceInfo) function -

Creates a new invoice in Xero marked as DRAFT

xero.createAnInvoice(invoiceInfo)

Expects a student object with the following structure:

var invoiceInfo = {
  contactName: 'Example Name',
  contactId: 'Xero contactId',
  date:{
    P0: phase Zero date,
    BC: bootcamp date,
    Grad: graduation date
  }
};

AccountCode - Must match Xero account codes otherwise will default to invoice code Dates - Must match following format - Year/month/Day - '2015-02-23'

Console logs the response message from Xero

fetchContacts() function -

Returns all contacts in Xero

##createContact(contacInfo) function ###Creates a new contact in xero A new contact in xero is created when a student object is passed in that matches the structure below - all fields must be entered

 {
      FirstName: example First Name,
      LastName: example Last Name,
      EmailAddress: example Email Address,
      AccountNumber: example relate iq Id,
      ContactNumber: example relate iq Id
}
1.2.4

8 years ago

1.2.3

8 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago