npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zuora-request-service

v1.0.0

Published

terse description goes here

Downloads

139

Readme

Zuora Request Service

Zuora Request Service is a promise based library that facilitates interaction with the zuora http API. This service provides several conveniences for using the zuora api:

  • Automatically append auth and content type headers to every out going request,
  • Manages all the URL's for the zuora api.
  • Intercepts errors returned from zuora as 200's and automatically rethrows them as proper errors.
  • Configure requests to retry under specific conditions.
  • Can handle logging your interactions out with zuora.
  • Configurable time out feature on your requests to keep your processes from hanging if zuora becomes unresponsive.

API

  • setup( )

The setup method should be invoked when your server is being initialized with these arguments:

  • keyId: your zuora supplied apiAccessKeyId
  • accessKey: your zuora supplied apiSecretAccessKey
  • isProd: boolean - boolean indicating if the code is in production environment or not. Controls the base URL for zuora.
  • logger: optional - an object with a .info function for logging.

const zuora = require('zuora-service');
zuora.setup('dummyUser', 'dummyPassword', false, yourLogger);
  • api( )

Every method accepts a request options object that can be used to configure the out going request to your needs.

request options object properties:

  • body: object - required for requests that need to send a message body, PUT/POST calls.
  • queryString: object - optional, pass key value pairs on this object to be added to your http requests
  • timeout: number - optional, override timeout(ms). Default timeout is 25000 ms.
  • maxTries: number - optional*, specify the maximum number of retry attempts.
  • errCond: function - optional*, function that accepts an error object for evaluation and returns a boolean indicating if the request should be retried or not.

** maxTries and errCond cannot be used independently of each other. I.E if you set a max tries and do not pass a function to errCond no retries will be attempted.

const requestOptions = {
  body: {
    some: 'amazing payload'
  },
  queryString: {
    description: 'some description',
    associatedObjectType: 'Account',
    associatedObjectKey: 'someKey'
  },
  timeout: 30000,
  maxTries: 15,
  errCond: error => error.status !== 200
};
  • Accounting
    • codes
      • list: zuora.api().accounting.codes.list(requestOptions)
      • create: zuora.api().accounting.codes.create(requestOptions)
      • delete: zuora.api().accounting.codes.delete(acId, requestOptions)
      • query: zuora.api().accounting.codes.query(acId, requestOptions)
      • update: zuora.api().accounting.codes.update(acId, requestOptions)
      • activate: zuora.api().accounting.codes.activate(acId, requestOptions)
      • deactivate: zuora.api().accounting.codes.deactivate(acId, requestOptions)
    • periods
      • list: zuora.api().accounting.periods.list(requestOptions)
      • create: zuora.api().accounting.periods.create(requestOptions)
      • delete: zuora.api().accounting.periods.delete(apId, requestOptions)
      • find: zuora.api().accounting.periods.find(apId, requestOptions)
      • update: zuora.api().accounting.periods.update(apId, requestOptions)
      • close: zuora.api().accounting.periods.close(apId, requestOptions)
      • pending: zuora.api().accounting.periods.pending(apId, requestOptions)
      • reopen: zuora.api().accounting.periods.reopen(apId, requestOptions)
      • runTrial: zuora.api().accounting.periods.runTrial(apId, requestOptions)
  • accounts
    • create: zuora.api().accounts.create(requestOptions)
    • find: zuora.api().accounts.find(accountKey, requestOptions)
    • update: zuora.api().accounts.update(accountKey, requestOptions)
    • summary: zuora.api().accounts.summary(accountKey, requestOptions)
  • actions
    • amend: zuora.api().actions.amend(requestOptions)
    • create: zuora.api().actions.create(requestOptions)
    • delete: zuora.api().actions.delete(requestOptions)
    • execute: zuora.api().actions.execute(requestOptions)
    • generate: zuora.api().actions.generate(requestOptions)
    • query: zuora.api().actions.query(requestOptions)
    • queryMore: zuora.api().actions.queryMore(requestOptions)
    • subscribe: zuora.api().actions.subscribe(requestOptions)
    • update: zuora.api().actions.update(requestOptions)
  • amendments
    • bySubscriptionId: zuora.api().amendments.bySubscriptionId(subscriptionId, requestOptions)
    • byAmendmentKey: zuora.api().amendments.byAmendmentKey(amendmentKey, requestOptions)
  • attachments
    • add: zuora.api().attachments.add(requestOptions)
    • delete: zuora.api().attachments.delete(attachmentId, requestOptions)
    • find: zuora.api().attachments.find(attachmentId, requestOptions)
    • update: zuora.api().attachments.update(attachmentId, requestOptions)
    • list: zuora.api().attachments.list(type, key, requestOptions)
  • catalog
    • list: zuora.api().catalog.list(requestOptions)
  • chargeRevenueSummaries
    • byChargeId: zuora.zpi().chargeRevenueSummaries.byChargeId(chargeKey, requestOptions)
    • byCrsNumber: zuora.zpi().chargeRevenueSummaries.byCrsNumber(crsNumber, requestOptions)
  • connections
    • connect: zuora.api().connections.connect(requestOptions)
  • getFiles
    • find: zuora.api().getFiles.find(fileId, requestOptions)
  • hmacSignatures
    • create: zuora.api().hmacSignatures.create(requestOptions)
  • hostedPages
    • list: zuora.api().hostedPages.list(requestOptions)
  • journal
    • entries
      • create: zuora.api().journal.entries.create(requestOptions)
      • findByJournalRun: zuora.api().journal.entries.findByJournalRun(jrNumber, requestOptions)
      • delete: zuora.api().journal.entries.delete(jrNumber, requestOptions)
      • find: zuora.api().journal.entries.find(jeNumber, requestOptions)
      • update: zuora.api().journal.entries.update(jeNumber, requestOptions)
      • cancel: zuora.api().journal.entries.cancel(jeNumber, requestOptions)
    • runs
      • create: zuora.api().journal.runs.create(requestOptions)
      • delete: zuora.api().journal.runs.delete(jrNumber, requestOptions)
      • find: zuora.api().journal.runs.find(jrNumber, requestOptions)
      • cancel: zuora.api().journal.runs.cancel(jrNumber, requestOptions)
  • massUpdater
    • bulk: zuora.api().massUpdater.bulk(requestOptions)
    • find: zuora.api().massUpdater.find(bulkKey, requestOptions)
    • stop: zuora.api().massUpdater.stop(bulkKey, requestOptions)
  • notificationHistory
    • callout: zuora.api().notificationHistory.callout(requestOptions)
    • email: zuora.api().notificationHistory.email(requestOptions)
  • operations
  • paymentMethods
    • create: zuora.api().paymentMethods.create(requestOptions)
    • find: zuora.api().paymentMethods.find(accountKey, requestOptions)
    • update: zuora.api().paymentMethods.update(paymentMethodId, requestOptions)
    • delete: zuora.api().paymentMethods.delete(paymentMethodId, requestOptions)
  • quotesDocument
    • document: zuora.api().quotesDocument.document(requestOptions)
  • revenue
    • events
      • find: zuora.api().revenue.events.find(rsNumber, requestOptions)
      • details: zuora.api().revenue.events.details(eventNumber, requestOptions)
    • items
      • getBySummary: zuora.api().revenue.items.getBySummary(crsNumber, requestOptions)
      • getByEvent: zuora.api().revenue.items.getByEvent(eventNumber, requestOptions)
      • updateByEvent: zuora.api().revenue.items.updateByEvent(eventNumber, requestOptions)
      • getBySchedule: zuora.api().revenue.items.getBySchedule(rsNumber, requestOptions)
      • updateBySchedule: zuora.api().revenue.items.updateBySchedule(rsNumber, requestOptions)
    • rules
      • find: zuora.api().revenue.rules.find(chargeKey, requestOptions)
    • schedules
      • getByAdjustment: zuora.api().revenue.schedules.getByAdjustment(invoiceItemAdjId, requestOptions)
      • createAdjustment: zuora.api().revenue.schedules.createAdjustment(invoiceItemAdjId, requestOptions)
      • createAdjustmentByRange: zuora.api().revenue.schedules.createAdjustmentByRange(invoiceItemAdjId, requestOptions)
      • getByInvoiceItem: zuora.api().revenue.schedules.getByInvoiceItem(invoiceItemId, requestOptions)
      • createForInvoiceItem: zuora.api().revenue.schedules.createForInvoiceItem(invoiceItemId, requestOptions)
      • createForInvoiceItemByRange: zuora.api().revenue.schedules.createForInvoiceItemByRange(invoiceItemId, requestOptions)
      • getBySubscription: zuora.api().revenue.schedules.getBySubscription(chargeKey, requestOptions)
      • createBySubscription: zuora.api().revenue.schedules.createBySubscription(chargeKey, requestOptions)
      • delete: zuora.api().revenue.schedules.delete(rsNumber, requestOptions)
      • getDetails: zuora.api().revenue.schedules.getDetails(rsNumber, requestOptions)
      • update: zuora.api().revenue.schedules.update(rsNumber, requestOptions)
      • distributeByPeriods: zuora.api().revenue.schedules.distributeByPeriods(rsNumber, requestOptions)
      • distributeByDate: zuora.api().revenue.schedules.distributeByDate(rsNumber, requestOptions)
      • distributeByRange: zuora.api().revenue.schedules.distributeByRange(rsNumber, requestOptions)
  • rsaSignatures
    • generate: zuora.api().rsaSignatures.generate(requestOptions)
    • decrypt: zuora.api().rsaSignatures.decrypt(requestOptions)
  • settings
    • startDate: zuora.api().settings.startDate(requestOptions)
  • subscriptions
    • create: zuora.api().subscriptions.create(requestOptions)
    • getByAccount: zuora.api().subscriptions.getByAccount(accountKey, requestOptions)
    • preview: zuora.api().subscriptions.preview(requestOptions)
    • getByKey: zuora.api().subscriptions.getByKey(subscriptionKey, requestOptions)
    • update: zuora.api().subscriptions.update(subscriptionKey, requestOptions)
    • cancel: zuora.api().subscriptions.cancel(subscriptionKey, requestOptions)
    • renew: zuora.api().subscriptions.renew(subscriptionKey, requestOptions)
    • resume: zuora.api().subscriptions.resume(subscriptionKey, requestOptions)
    • suspend: zuora.api().subscriptions.suspend(subscriptionKey, requestOptions)
  • transactions
    • getInvoices: zuora.api().transactions.getInvoices(accountKey, requestOptions)
    • getPayments: zuora.api().transactions.getPayments(accountKey, requestOptions)
  • usage
    • create: zuora.api().usage.create(requestOptions)
    • find: zuora.api().usage.find(accountKey, requestOptions)
  • object -- the 'object' portion of the service API allows you to perform common CRUD operations on zuora objects
    • find: zuora.api().object.find('accounting-code', id, requestOptions)
    • create: zuora.api().object.create('accounting-code', requestOptions)
    • delete: zuora.api().object.delete('accounting-code', id, requestOptions)
    • update: zuora.api().object.update('accounting-code', id, requestOptions)