pancake-client-sdk
Version:
Official TypeScript SDK for Pancake POS API
98 lines • 2.85 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoyaltyResource = void 0;
const base_1 = require("./base");
class LoyaltyResource extends base_1.BaseResource {
/**
* Get loyalty program details
*/
async getProgram() {
return this.client.get(this.getShopPath('/loyalty/program'));
}
/**
* Create or update loyalty program
*/
async setupProgram(data) {
return this.client.post(this.getShopPath('/loyalty/program'), data);
}
/**
* Update loyalty program
*/
async updateProgram(data) {
return this.client.put(this.getShopPath('/loyalty/program'), data);
}
/**
* Get list of loyalty tiers
*/
async listTiers() {
return this.client.get(this.getShopPath('/loyalty/tiers'));
}
/**
* Create loyalty tier
*/
async createTier(data) {
return this.client.post(this.getShopPath('/loyalty/tiers'), data);
}
/**
* Update loyalty tier
*/
async updateTier(tierId, data) {
return this.client.put(this.getShopPath(`/loyalty/tiers/${tierId}`), data);
}
/**
* Delete loyalty tier
*/
async deleteTier(tierId) {
return this.client.delete(this.getShopPath(`/loyalty/tiers/${tierId}`));
}
/**
* Get customer loyalty information
*/
async getCustomerLoyalty(customerId) {
return this.client.get(this.getShopPath(`/customers/${customerId}/loyalty`));
}
/**
* List loyalty transactions
*/
async listTransactions(params) {
return this.client.get(this.getShopPath('/loyalty/transactions'), params);
}
/**
* Get customer loyalty transactions
*/
async getCustomerTransactions(customerId, params) {
return this.client.get(this.getShopPath(`/customers/${customerId}/loyalty/transactions`), params);
}
/**
* Adjust customer points
*/
async adjustPoints(data) {
return this.client.post(this.getShopPath('/loyalty/adjust-points'), data);
}
/**
* Redeem points
*/
async redeemPoints(data) {
return this.client.post(this.getShopPath('/loyalty/redeem-points'), data);
}
/**
* Calculate points for order
*/
async calculateOrderPoints(orderId) {
return this.client.get(this.getShopPath(`/orders/${orderId}/calculate-points`));
}
/**
* Get loyalty program analytics
*/
async getAnalytics(params) {
return this.client.get(this.getShopPath('/loyalty/analytics'), params);
}
/**
* Get expiring points notifications
*/
async getExpiringPoints(params) {
return this.client.get(this.getShopPath('/loyalty/expiring-points'), params);
}
}
exports.LoyaltyResource = LoyaltyResource;
//# sourceMappingURL=loyalty.js.map