@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
49 lines (47 loc) • 2.44 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/customer_payment_sources.ts
var CustomerPaymentSources = class _CustomerPaymentSources extends ApiResource {
static TYPE = "customer_payment_sources";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _CustomerPaymentSources.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _CustomerPaymentSources.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _CustomerPaymentSources.TYPE } : id, options);
}
async customer(customerPaymentSourceId, params, options) {
const _customerPaymentSourceId = customerPaymentSourceId.id || customerPaymentSourceId;
return this.resources.fetch({ type: "customers" }, `customer_payment_sources/${_customerPaymentSourceId}/customer`, params, options);
}
async payment_method(customerPaymentSourceId, params, options) {
const _customerPaymentSourceId = customerPaymentSourceId.id || customerPaymentSourceId;
return this.resources.fetch({ type: "payment_methods" }, `customer_payment_sources/${_customerPaymentSourceId}/payment_method`, params, options);
}
async versions(customerPaymentSourceId, params, options) {
const _customerPaymentSourceId = customerPaymentSourceId.id || customerPaymentSourceId;
return this.resources.fetch({ type: "versions" }, `customer_payment_sources/${_customerPaymentSourceId}/versions`, params, options);
}
async event_stores(customerPaymentSourceId, params, options) {
const _customerPaymentSourceId = customerPaymentSourceId.id || customerPaymentSourceId;
return this.resources.fetch({ type: "event_stores" }, `customer_payment_sources/${_customerPaymentSourceId}/event_stores`, params, options);
}
isCustomerPaymentSource(resource) {
return resource.type && resource.type === _CustomerPaymentSources.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _CustomerPaymentSources.TYPE;
}
};
var instance = new CustomerPaymentSources();
var customer_payment_sources_default = instance;
export { customer_payment_sources_default };
//# sourceMappingURL=chunk-VKNNJ5CS.js.map
//# sourceMappingURL=chunk-VKNNJ5CS.js.map