UNPKG

@snapp-store/snapp-box-sdk

Version:
100 lines (99 loc) 3.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebhooksService = void 0; class WebhooksService { constructor(httpRequest) { this.httpRequest = httpRequest; } /** * ORDER ACCEPTED * Following payload will be sent through Webhooks/FCM when a biker is allocated to the order, you can test this webhook with your webhook handler url. * @param requestBody * @returns any * @throws ApiError */ orderaccepted(requestBody) { return this.httpRequest.request({ method: 'POST', url: '/v1/order/verification', body: requestBody, mediaType: 'application/json', }); } /** * ORDER ARRIVED * Following payload will be sent through Webhooks/FCM when a biker is allocated to the order, you can test this webhook with your webhook handler url. * @param requestBody * @returns any * @throws ApiError */ orderarrived(requestBody) { return this.httpRequest.request({ method: 'POST', url: '/#arrived', body: requestBody, mediaType: 'application/json', }); } /** * ORDER PICKED UP * Following payload will be sent through Webhooks/FCM when the biker has picked up the package, you can test this webhook with your webhook handler url. * @param requestBody * @returns any * @throws ApiError */ orderpickedup(requestBody) { return this.httpRequest.request({ method: 'POST', url: '/#pickedup', body: requestBody, mediaType: 'application/json', }); } /** * ORDER DELIVERED * Following payload will be sent through Webhooks/FCM when the biker has delivered the package, you can test this webhook with your webhook handler url. * @param requestBody * @returns any * @throws ApiError */ orderdelivered(requestBody) { return this.httpRequest.request({ method: 'POST', url: '/#delivered', body: requestBody, mediaType: 'application/json', }); } /** * ORDER CANCELED * Following payload will be sent through Webhooks/FCM when the order is cancelled, you can test this webhook with your webhook handler url. * @param requestBody * @returns any * @throws ApiError */ ordercanceled(requestBody) { return this.httpRequest.request({ method: 'POST', url: '/#canceled', body: requestBody, mediaType: 'application/json', }); } /** * ORDER CANCELED (by system) * If you create an order and in its time of "allocation" no biker accepts your order , it'll be cancelled by system. * @param requestBody * @returns any * @throws ApiError */ ordercanceledBysystem(requestBody) { return this.httpRequest.request({ method: 'POST', url: '/#canceled-by-system', body: requestBody, mediaType: 'application/json', }); } } exports.WebhooksService = WebhooksService;