@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
54 lines (52 loc) • 2.57 kB
JavaScript
import { ApiResource } from './chunk-XDRKC6JM.js';
// src/resources/braintree_gateways.ts
var BraintreeGateways = class _BraintreeGateways extends ApiResource {
static TYPE = "braintree_gateways";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _BraintreeGateways.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _BraintreeGateways.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _BraintreeGateways.TYPE } : id, options);
}
async payment_methods(braintreeGatewayId, params, options) {
const _braintreeGatewayId = braintreeGatewayId.id || braintreeGatewayId;
return this.resources.fetch({ type: "payment_methods" }, `braintree_gateways/${_braintreeGatewayId}/payment_methods`, params, options);
}
async event_stores(braintreeGatewayId, params, options) {
const _braintreeGatewayId = braintreeGatewayId.id || braintreeGatewayId;
return this.resources.fetch({ type: "event_stores" }, `braintree_gateways/${_braintreeGatewayId}/event_stores`, params, options);
}
async braintree_payments(braintreeGatewayId, params, options) {
const _braintreeGatewayId = braintreeGatewayId.id || braintreeGatewayId;
return this.resources.fetch({ type: "braintree_payments" }, `braintree_gateways/${_braintreeGatewayId}/braintree_payments`, params, options);
}
async _disable(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _BraintreeGateways.TYPE, _disable: true }, params, options);
}
async _enable(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _BraintreeGateways.TYPE, _enable: true }, params, options);
}
async _check(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _BraintreeGateways.TYPE, _check: true }, params, options);
}
isBraintreeGateway(resource) {
return resource.type && resource.type === _BraintreeGateways.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _BraintreeGateways.TYPE;
}
};
var instance = new BraintreeGateways();
var braintree_gateways_default = instance;
export { braintree_gateways_default };
//# sourceMappingURL=chunk-HJFTJL3E.js.map
//# sourceMappingURL=chunk-HJFTJL3E.js.map