UNPKG

baasic-sdk-nodejs

Version:

NodeJS SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).

108 lines (107 loc) 5.16 kB
import { BaasicApp } from 'baasic-sdk-javascript'; import { IBaasicQueryModel, IGetRequestOptions, IHttpResponse, IOptions } from '../../infrastructure/common/contracts'; import { ICommerceLookups, ICustomerClient, IInvoiceClient, IPaymentTransaction, IProductClient } from './contracts'; export declare class CommerceClient { private baasicApp; constructor(baasicApp: BaasicApp); /** * Returns a promise that is resolved once the find action has been performed. Success response returns a list of commerce resources matching the given criteria. * @method * @example CommerceClient.find({ pageNumber : 1, pageSize : 10, orderBy : '<field>', orderDirection : '<asc|desc>', customerId: '<customer-id>' }) .then(function (collection) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ find(options?: IOptions): PromiseLike<IHttpResponse<IBaasicQueryModel<any>>>; /** * Returns a promise that is resolved once the get action has been performed. Success response returns the commerce resource. * @method * @example CommerceClient.get('<id>', {}) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ get(id: string, options?: IGetRequestOptions): PromiseLike<IHttpResponse<any>>; /** * Returns a promise that is resolved once the get action has been performed. Success response returns the commerce resource. * @method * @example CommerceClient.validateVAT({ countryCode: 'DE', vatId: 'DE999999999' }) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ validateVAT(countryCode: string, vatId: string): PromiseLike<IHttpResponse<any>>; /** * Returns a promise that is resolved once the subscribe pre-process commerce action has been performed; this action performes pre-subscribe operations such as getting client tokens etc. * @method * @example CommerceClient.preprocess({ systemName : '<system-name>', productId : '<product-id>', customerId: '<id>' }) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ preprocess(data: any): PromiseLike<IHttpResponse<any>>; /** * Returns a promise that is resolved once the subscribe commerce action has been performed; this action creates a new commerce subscription resource. * @method * @example CommerceClient.subscribe({ systemName : '<system-name>', productId : '<product-id>', customer: { id: '<id>', firstName: '<first-name>', lastName: '<last-name>' } }) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ subscribe(data: any): PromiseLike<IHttpResponse<any>>; /** * Returns a promise that is resolved once the cancel subscription action has been performed. This action will remove a commerce subscription resource from the system if successfully completed. This route obtain routes from `baasicCommerceRouteDefinition` route template. Here is an example of how execute this action: * @method * @example CommerceClient.cancel({ systemName: '<system-name>', id: '<subscription-id>', requestRefund: <true/false>, refundAmount: <refund-amount> }) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ cancel(data: any): PromiseLike<IHttpResponse<void>>; readonly customers: ICustomerClient; readonly invoices: IInvoiceClient; readonly products: IProductClient; readonly paymentTransactions: IPaymentTransaction; readonly lookups: ICommerceLookups; }