Merchants
Use the Bringg Dispatcher SDK Merchant methods to integrate Bringg merchant functionality into your own merchants' systems.
Overview
Use the Bringg Dispatcher SDK merchant functionality to:
- get merchants detailed information
- update merchant details
- create a a new merchant
Use the Bringg Dispatcher SDK merchant administration functionality to:
- get merchant administration detailed information
- clean - removes all tasks, teams, customers, and drivers from the current merchant
- copy merchant settings from one of your merchants to another
- validate the copying of merchant settings
Exception Handling
The Bringg Dispatcher SDK Merchant methods use a promise pattern and a decorator factory for error exception handling. You can chain your method callback using then and catch to customize error handling for your own application. You can also delegate the Bringg Dispatcher SDK Logger to various log levels and implement your own functionality. For more information, see Exception Handling.
Only Admin Users Can Use Merchant Administration Functionaly
Syntax
Merchant Methods
bringgDashboardSDK.merchant.
Merchant Administration Methods
bringgDashboardSDK.merchant.admin.
Examples
The following examples include three types of implementation:
- web
- node.js
- TypeScript
Merchant Methods
This code snippet demonstrates the merchant.get() method.
<!doctype html>
<html lang="en">
<head>
<!-- ... -->
<script src="/bringg-dashboard-sdk.js"></script>
</head>
<body>
<!-- ... -->
<script>
BringgDashboardSDK.initWithAuthToken(region, authToken).then(bringgDashboardSDK => {
bringgDashboardSDK.merchant.get().then(console.log).catch(console.error);
});
</script>
</body>
</html>
const BringgDashboardSDK = require("bringg-dashboard-sdk");
BringgDashboardSDK.initWithAuthToken(region, authToken).then(bringgDashboardSDK => {
bringgDashboardSDK.merchant.get().then(console.log).catch(console.error);
});
import BringgDashboardSDK = require("bringg-dashboard-sdk");
async function runAwait() {
try {
const bringgDashboardSDK = await BringgDashboardSDK.initWithAuthToken(region, authToken);
console.log(await bringgDashboardSDK.merchant.get());
} catch (e) {
console.error(e);
}
}
runAwait();
Merchant Administration Methods
This code snippet demonstrates the merchant.admin.getAll() method.
<!doctype html>
<html lang="en">
<head>
<!-- ... -->
<script src="/bringg-dashboard-sdk.js"></script>
</head>
<body>
<!-- ... -->
<script>
BringgDashboardSDK.initWithAuthToken(region, authToken).then(bringgDashboardSDK => {
bringgDashboardSDK.merchant.admin.getAll().then(console.log).catch(console.error);
});
</script>
</body>
</html>
const BringgDashboardSDK = require("bringg-dashboard-sdk");
BringgDashboardSDK.initWithAuthToken(region, authToken).then(bringgDashboardSDK => {
bringgDashboardSDK.merchant.admin.getAll().then(console.log).catch(console.error);
});
import BringgDashboardSDK = require("bringg-dashboard-sdk");
async function runAwait() {
try {
const bringgDashboardSDK = await BringgDashboardSDK.initWithAuthToken(region, authToken);
console.log(await bringgDashboardSDK.merchant.admin.getAll());
} catch (e) {
console.error(e);
}
}
runAwait();
Methods
Use Merchants Methods to get detailed merchant information and update merchant information.
merchant.get()
Gets detailed merchant information.
Input Parameters
None.
Response
Object JSON |
A Merchant object containing detailed merchant information. |
merchant.update(:id)
Updates merchant details.
Input Parameters
Id number |
REQUIRED The Id of the merchant whose detailed information is returned. |
Object JSON |
REQUIRED A Merchant object containing the merchant attritubes whose values will be updated. |
Response
Object JSON |
A Merchant object containing the merchant attributes changed by this update. |
Merchant Administration Methods
merchant.admin.getAll()
Gets details for all merchants.
Input Parameters
None
Response
Array of Objects JSON |
An array of Merchant objects containing detailed administration information about your merchants. |
merchant.admin.clean(:withDrivers)
Input Parameters
withDrivers boolean |
Indicates whether to remove all tasks, teams, customers, and drivers from the current merchant. The values are:
|
Response
boolean |
Indicates whether the removal of all tasks, teams, customers, and drivers from the current merchant was successful.
|
merchant.admin.createByAccountManager(:newMerchant)
Creates a new user for a merchant.
Input Parameters
newMerchant JSON |
A Merchant object containing the new user details. |
Response
string |
Pending Update |
merchant.admin.copyMerchantSettings(:copyData)
Copies merchant details from one merchant to another.
Input Parameters
copyData JSON |
A Merchant object containing the new merchant details. |
Response
Object JSON |
A object containing the following attributes:
|
Object JSON |
A Merchant object containing the merchant details to copy. |
merchant.admin.validateCopyMerchantSettings(:copyData, :Merchant)
Validates the copying of merchant details from one merchant to another.
Input Parameters
copyData JSON |
A CopyData object containing the following attributes:
|
Merchant JSON |
A Merchant object containing the merchant details to copy. |
Response
boolean |
Indicates whether the copyMerchantSettings() method was successful. The values are:
|
Updated over 6 years ago