@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
47 lines (44 loc) • 1.93 kB
JavaScript
;
var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs');
// src/resources/payment_options.ts
var PaymentOptions = class _PaymentOptions extends chunkU22VLCMN_cjs.ApiResource {
static TYPE = "payment_options";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _PaymentOptions.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _PaymentOptions.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _PaymentOptions.TYPE } : id, options);
}
async order(paymentOptionId, params, options) {
const _paymentOptionId = paymentOptionId.id || paymentOptionId;
return this.resources.fetch({ type: "orders" }, `payment_options/${_paymentOptionId}/order`, params, options);
}
async attachments(paymentOptionId, params, options) {
const _paymentOptionId = paymentOptionId.id || paymentOptionId;
return this.resources.fetch({ type: "attachments" }, `payment_options/${_paymentOptionId}/attachments`, params, options);
}
async event_stores(paymentOptionId, params, options) {
const _paymentOptionId = paymentOptionId.id || paymentOptionId;
return this.resources.fetch({ type: "event_stores" }, `payment_options/${_paymentOptionId}/event_stores`, params, options);
}
isPaymentOption(resource) {
return resource.type && resource.type === _PaymentOptions.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _PaymentOptions.TYPE;
}
};
var instance = new PaymentOptions();
var payment_options_default = instance;
exports.payment_options_default = payment_options_default;
//# sourceMappingURL=chunk-EVVUYC7T.cjs.map
//# sourceMappingURL=chunk-EVVUYC7T.cjs.map