opaler
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Build Status npm version License

Opaler

Retrieve and parse information from your opal card account.
https://www.opal.com.au/

Opal cards are smartcard tickets that you keep, reload and reuse to pay for travel on public transport in the greater Sydney area of New South Wales, Australia.

Getting Started

Installing

npm install opaler

Usage

import Opaler from 'opaler';
 
const opaler = new Opaler('YOUR_USERNAME', 'YOUR_PASSWORD');
 
opaler.getCards().then(cards => {
  cards.forEach(card => {
    console.log(JSON.stringify(card, null, 2));
  })
});

API

#getCards(): Promise<Card[]>

Card

{
  cardNumberstring,
  displayCardNumbernull,
  fareCategoryCodenull,
  fareCategoryTitlenull,
  cardNickNamestring,
  cardStatestring,
  cardBalancenumber,
  activeboolean,
  svPendingnumber,
  toBeActivatedboolean,
  displayNamestring,
  cardIndexnumber,
  currentCardBalancenumber,
}

#getAccount(): Promise<Account>

Account

{
  firstNamestring,
  lastNamestring,
  addressstring,
  dateOfBirthstring,
  phoneNumberstring,
  mobileNumberstring,
  emailAddressstring,
  nameOnCardstring,
  cardTypestring,
  cardNumberstring,
  cardExpiresstring,
  passwordstring,
  opalPinstring,
  securityQuestionstring,
  securityAnswerstring,
}

#getOrders(): Promise<Order[]>

Order

{
  orderIdstring,
  orderDatestring,
  orderDateTimestampnumber,
  cardTypestring,
  orderStatusstring,
}

#getTransactions(options: TransactionRequestOptions): Promise<Transaction[]>

TransactionRequestOptions

{
  month?: number,
  year?: number,
  pageIndex?: number,
  cardIndexnumber,
}
  • month and year can be used to request transactions for a specific time
  • pageIndex requests a certain page inside the result set if no pageIndex is set all pages will be fetched continously. Depending on your result size this can take quite a while and is not recommended.
  • cardIndex refers to the cards index number within the Card[] array returned from #getCards()

Transaction

{
  transactionNumbernumber,
  timestampnumber,
  summarystring | null,
  modestring | null,
  fare{
    appliedstring | null,
    pricenumber,
    discountnumber,
    paidnumber,
  },
  journey{
    numbernumber,
    startstring,
    endstring,
  } | null,
 

Versioning

Opaler uses Semantic Versioning for versioning.
For the versions available, see the the published versions on npmjs.com.

License

MIT License

Copyright (c) 2014 Thorsten Basse

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i opaler

Weekly Downloads

9

Version

2.0.0

License

MIT

Unpacked Size

24.6 kB

Total Files

13

Last publish

Collaborators

  • tbasse