@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
53 lines (50 loc) • 2.34 kB
JavaScript
;
var chunkVRRJS3ZM_cjs = require('./chunk-VRRJS3ZM.cjs');
// src/resources/klarna_gateways.ts
var KlarnaGateways = class _KlarnaGateways extends chunkVRRJS3ZM_cjs.ApiResource {
static TYPE = "klarna_gateways";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _KlarnaGateways.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _KlarnaGateways.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _KlarnaGateways.TYPE } : id, options);
}
async payment_methods(klarnaGatewayId, params, options) {
const _klarnaGatewayId = klarnaGatewayId.id || klarnaGatewayId;
return this.resources.fetch({ type: "payment_methods" }, `klarna_gateways/${_klarnaGatewayId}/payment_methods`, params, options);
}
async event_stores(klarnaGatewayId, params, options) {
const _klarnaGatewayId = klarnaGatewayId.id || klarnaGatewayId;
return this.resources.fetch({ type: "event_stores" }, `klarna_gateways/${_klarnaGatewayId}/event_stores`, params, options);
}
async klarna_payments(klarnaGatewayId, params, options) {
const _klarnaGatewayId = klarnaGatewayId.id || klarnaGatewayId;
return this.resources.fetch({ type: "klarna_payments" }, `klarna_gateways/${_klarnaGatewayId}/klarna_payments`, params, options);
}
async _disable(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _KlarnaGateways.TYPE, _disable: true }, params, options);
}
async _enable(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _KlarnaGateways.TYPE, _enable: true }, params, options);
}
isKlarnaGateway(resource) {
return resource.type && resource.type === _KlarnaGateways.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _KlarnaGateways.TYPE;
}
};
var instance = new KlarnaGateways();
var klarna_gateways_default = instance;
exports.klarna_gateways_default = klarna_gateways_default;
//# sourceMappingURL=chunk-KACVNOCD.cjs.map
//# sourceMappingURL=chunk-KACVNOCD.cjs.map