zuora-request-service
v1.0.0
Published
terse description goes here
Downloads
139
Keywords
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)
- list:
- 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)
- list:
- codes
- accounts
- 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)
- amend:
- amendments
- bySubscriptionId:
zuora.api().amendments.bySubscriptionId(subscriptionId, requestOptions)
- byAmendmentKey:
zuora.api().amendments.byAmendmentKey(amendmentKey, requestOptions)
- bySubscriptionId:
- 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)
- add:
- catalog
- list:
zuora.api().catalog.list(requestOptions)
- list:
- chargeRevenueSummaries
- byChargeId:
zuora.zpi().chargeRevenueSummaries.byChargeId(chargeKey, requestOptions)
- byCrsNumber:
zuora.zpi().chargeRevenueSummaries.byCrsNumber(crsNumber, requestOptions)
- byChargeId:
- connections
- connect:
zuora.api().connections.connect(requestOptions)
- connect:
- getFiles
- find:
zuora.api().getFiles.find(fileId, requestOptions)
- find:
- hmacSignatures
- create:
zuora.api().hmacSignatures.create(requestOptions)
- create:
- hostedPages
- list:
zuora.api().hostedPages.list(requestOptions)
- list:
- 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)
- create:
- runs
- entries
- massUpdater
- notificationHistory
- operations
- invoiceCollect:
zuora.api().operations.invoiceCollect(requestOptions)
- invoiceCollect:
- paymentMethods
- quotesDocument
- document:
zuora.api().quotesDocument.document(requestOptions)
- document:
- revenue
- events
- 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)
- getBySummary:
- rules
- find:
zuora.api().revenue.rules.find(chargeKey, requestOptions)
- find:
- 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)
- getByAdjustment:
- rsaSignatures
- settings
- startDate:
zuora.api().settings.startDate(requestOptions)
- startDate:
- 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)
- create:
- transactions
- getInvoices:
zuora.api().transactions.getInvoices(accountKey, requestOptions)
- getPayments:
zuora.api().transactions.getPayments(accountKey, requestOptions)
- getInvoices:
- usage
- object -- the 'object' portion of the service API allows you to perform common CRUD operations on zuora objects