@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
51 lines (48 loc) • 2.51 kB
JavaScript
var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs');
// src/resources/customer_payment_sources.ts
var CustomerPaymentSources = class _CustomerPaymentSources extends chunkU22VLCMN_cjs.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;
exports.customer_payment_sources_default = customer_payment_sources_default;
//# sourceMappingURL=chunk-4L73VYT5.cjs.map
//# sourceMappingURL=chunk-4L73VYT5.cjs.map
;