@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
55 lines (53 loc) • 2.49 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/stripe_payments.ts
var StripePayments = class _StripePayments extends ApiResource {
static TYPE = "stripe_payments";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _StripePayments.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _StripePayments.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _StripePayments.TYPE } : id, options);
}
async order(stripePaymentId, params, options) {
const _stripePaymentId = stripePaymentId.id || stripePaymentId;
return this.resources.fetch({ type: "orders" }, `stripe_payments/${_stripePaymentId}/order`, params, options);
}
async payment_gateway(stripePaymentId, params, options) {
const _stripePaymentId = stripePaymentId.id || stripePaymentId;
return this.resources.fetch({ type: "payment_gateways" }, `stripe_payments/${_stripePaymentId}/payment_gateway`, params, options);
}
async versions(stripePaymentId, params, options) {
const _stripePaymentId = stripePaymentId.id || stripePaymentId;
return this.resources.fetch({ type: "versions" }, `stripe_payments/${_stripePaymentId}/versions`, params, options);
}
async event_stores(stripePaymentId, params, options) {
const _stripePaymentId = stripePaymentId.id || stripePaymentId;
return this.resources.fetch({ type: "event_stores" }, `stripe_payments/${_stripePaymentId}/event_stores`, params, options);
}
async _update(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StripePayments.TYPE, _update: true }, params, options);
}
async _refresh(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StripePayments.TYPE, _refresh: true }, params, options);
}
isStripePayment(resource) {
return resource.type && resource.type === _StripePayments.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _StripePayments.TYPE;
}
};
var instance = new StripePayments();
var stripe_payments_default = instance;
export { stripe_payments_default };
//# sourceMappingURL=chunk-VGMMPMUL.js.map
//# sourceMappingURL=chunk-VGMMPMUL.js.map