baasic-sdk-angular
Version:
Angular (v5+) SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
110 lines (109 loc) • 5.29 kB
TypeScript
import { BaasicAppService } from '../index';
import { IBaasicQueryModel, IGetRequestOptions, IHttpResponse, IOptions } from '../../infrastructure/common/contracts';
import { ICommerceLookups, ICustomerService, IInvoiceService, IPaymentTransaction, IProductService, ICouponService, ICouponUseService } from './contracts';
export declare class CommerceService {
private baasicApp;
constructor(baasicApp: BaasicAppService);
/**
* 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 CommerceService.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 CommerceService.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 CommerceService.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 CommerceService.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 CommerceService.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 CommerceService.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: ICustomerService;
readonly coupons: ICouponService;
readonly couponUses: ICouponUseService;
readonly invoices: IInvoiceService;
readonly products: IProductService;
readonly paymentTransactions: IPaymentTransaction;
readonly lookups: ICommerceLookups;
}