baasic-sdk-angularjs
Version:
AngularJS SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
158 lines (111 loc) • 3.96 kB
Markdown
Baasic Commerce Service provides an easy way to consume Baasic Commerce REST API end-points. In order to obtain a needed routes `baasicCommerceService` uses `baasicCommerceRouteService`.
* * *
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.
**Example**:
```js
baasicCommerceService.find({
pageNumber : 1,
pageSize : 10,
orderBy : '<field>',
orderDirection : '<asc|desc>',
customerId: '<customer-id>'
})
.success(function (collection) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
Returns a promise that is resolved once the get action has been performed. Success response returns the commerce resource.
**Example**:
```js
baasicCommerceService.get('<id>', {})
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
Returns a promise that is resolved once the get action has been performed. Success response returns the commerce resource.
**Example**:
```js
baasicCommerceService.validateVAT({ countryCode: 'DE', vatId: 'DE999999999' })
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
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.
**Example**:
```js
baasicCommerceService.preprocess({
systemName : '<system-name>',
productId : '<product-id>',
customerId: '<id>'
})
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
Returns a promise that is resolved once the subscribe commerce action has been performed; this action creates a new commerce subscription resource.
**Example**:
```js
baasicCommerceService.subscribe({
systemName : '<system-name>',
productId : '<product-id>',
customer: {
id: '<id>',
firstName: '<first-name>',
lastName: '<last-name>'
}}
})
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
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 `baasicCommerceRouteService` route template. Here is an example of how execute this action:
**Example**:
```js
baasicCommerceService.cancel({
systemName: '<system-name>',
id: '<subscription-id>',
requestRefund: <true/false>,
refundAmount: <refund-amount>
}})
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
Provides direct access to `routeService`.
**Example**:
```js
baasicCommerceService.routeService.get(expandObject);
```
* * *
**Notes:**
- Refer to the [Baasic REST API](http://dev.baasic.com/api/reference/home) for detailed information about available Baasic REST API end-points.
- All end-point objects are transformed by the associated route service.
*(c) 2017 Mono Ltd*
**Author:** Mono Ltd
**License:** MIT