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