shopify-admin-api
Version:
Shopify Admin API is a NodeJS library built to help developers easily authenticate and make calls against the Shopify API. It was inspired by and borrows heavily from ShopifySharp.
43 lines (42 loc) • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Charges = void 0;
const infrastructure_1 = require("../infrastructure");
/**
* A service for manipulating Shopify's ApplicationCharge API.
*/
class Charges extends infrastructure_1.BaseService {
constructor(shopDomain, accessToken) {
super(shopDomain, accessToken, "application_charges");
}
/**
* Creates a new charge.
*/
create(charge) {
return this.createRequest("POST", ".json", "application_charge", { application_charge: charge });
}
/**
* Gets a charge with the given id.
* @param id The id of the charge to get.
* @param options Options for filtering the result.
*/
get(id, options) {
return this.createRequest("GET", `${id}.json`, "application_charge", options);
}
/**
* Retrieves a list of all past and present charges.
* @param options Options for filtering the result.
*/
list(options) {
return this.createRequest("GET", ".json", "application_charges", options);
}
/**
* Activates a charge. Can only be activated if the charge's status is "accepted".
* @param id The id of the charge to activate.
*/
activate(id) {
return this.createRequest("POST", `${id}/activate.json`);
}
}
exports.Charges = Charges;
exports.default = Charges;