@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
45 lines (43 loc) • 2.14 kB
JavaScript
import { ApiResource } from './chunk-XDRKC6JM.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 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-I4A63K2Q.js.map
//# sourceMappingURL=chunk-I4A63K2Q.js.map