UNPKG

@commercelayer/sdk

Version:
65 lines (62 loc) 3.05 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/payment_methods.ts var PaymentMethods = class _PaymentMethods extends chunkU22VLCMN_cjs.ApiResource { static TYPE = "payment_methods"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _PaymentMethods.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _PaymentMethods.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _PaymentMethods.TYPE } : id, options); } async market(paymentMethodId, params, options) { const _paymentMethodId = paymentMethodId.id || paymentMethodId; return this.resources.fetch({ type: "markets" }, `payment_methods/${_paymentMethodId}/market`, params, options); } async payment_gateway(paymentMethodId, params, options) { const _paymentMethodId = paymentMethodId.id || paymentMethodId; return this.resources.fetch({ type: "payment_gateways" }, `payment_methods/${_paymentMethodId}/payment_gateway`, params, options); } async store(paymentMethodId, params, options) { const _paymentMethodId = paymentMethodId.id || paymentMethodId; return this.resources.fetch({ type: "stores" }, `payment_methods/${_paymentMethodId}/store`, params, options); } async attachments(paymentMethodId, params, options) { const _paymentMethodId = paymentMethodId.id || paymentMethodId; return this.resources.fetch({ type: "attachments" }, `payment_methods/${_paymentMethodId}/attachments`, params, options); } async versions(paymentMethodId, params, options) { const _paymentMethodId = paymentMethodId.id || paymentMethodId; return this.resources.fetch({ type: "versions" }, `payment_methods/${_paymentMethodId}/versions`, params, options); } async event_stores(paymentMethodId, params, options) { const _paymentMethodId = paymentMethodId.id || paymentMethodId; return this.resources.fetch({ type: "event_stores" }, `payment_methods/${_paymentMethodId}/event_stores`, params, options); } async _disable(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _PaymentMethods.TYPE, _disable: true }, params, options); } async _enable(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _PaymentMethods.TYPE, _enable: true }, params, options); } isPaymentMethod(resource) { return resource.type && resource.type === _PaymentMethods.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _PaymentMethods.TYPE; } }; var instance = new PaymentMethods(); var payment_methods_default = instance; exports.payment_methods_default = payment_methods_default; //# sourceMappingURL=chunk-H7EX22DB.cjs.map //# sourceMappingURL=chunk-H7EX22DB.cjs.map