@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
58 lines (56 loc) • 2.37 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/refunds.ts
var Refunds = class _Refunds extends ApiResource {
static TYPE = "refunds";
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _Refunds.TYPE }, params, options);
}
async order(refundId, params, options) {
const _refundId = refundId.id || refundId;
return this.resources.fetch({ type: "orders" }, `refunds/${_refundId}/order`, params, options);
}
async attachments(refundId, params, options) {
const _refundId = refundId.id || refundId;
return this.resources.fetch({ type: "attachments" }, `refunds/${_refundId}/attachments`, params, options);
}
async events(refundId, params, options) {
const _refundId = refundId.id || refundId;
return this.resources.fetch({ type: "events" }, `refunds/${_refundId}/events`, params, options);
}
async versions(refundId, params, options) {
const _refundId = refundId.id || refundId;
return this.resources.fetch({ type: "versions" }, `refunds/${_refundId}/versions`, params, options);
}
async event_stores(refundId, params, options) {
const _refundId = refundId.id || refundId;
return this.resources.fetch({ type: "event_stores" }, `refunds/${_refundId}/event_stores`, params, options);
}
async reference_capture(refundId, params, options) {
const _refundId = refundId.id || refundId;
return this.resources.fetch({ type: "captures" }, `refunds/${_refundId}/reference_capture`, params, options);
}
async return(refundId, params, options) {
const _refundId = refundId.id || refundId;
return this.resources.fetch({ type: "returns" }, `refunds/${_refundId}/return`, params, options);
}
async _forward(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Refunds.TYPE, _forward: true }, params, options);
}
isRefund(resource) {
return resource.type && resource.type === _Refunds.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _Refunds.TYPE;
}
};
var instance = new Refunds();
var refunds_default = instance;
export { refunds_default };
//# sourceMappingURL=chunk-ME2ZNNMA.js.map
//# sourceMappingURL=chunk-ME2ZNNMA.js.map