@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
49 lines (47 loc) • 2.24 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/braintree_payments.ts
var BraintreePayments = class _BraintreePayments extends ApiResource {
static TYPE = "braintree_payments";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _BraintreePayments.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _BraintreePayments.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _BraintreePayments.TYPE } : id, options);
}
async order(braintreePaymentId, params, options) {
const _braintreePaymentId = braintreePaymentId.id || braintreePaymentId;
return this.resources.fetch({ type: "orders" }, `braintree_payments/${_braintreePaymentId}/order`, params, options);
}
async payment_gateway(braintreePaymentId, params, options) {
const _braintreePaymentId = braintreePaymentId.id || braintreePaymentId;
return this.resources.fetch({ type: "payment_gateways" }, `braintree_payments/${_braintreePaymentId}/payment_gateway`, params, options);
}
async versions(braintreePaymentId, params, options) {
const _braintreePaymentId = braintreePaymentId.id || braintreePaymentId;
return this.resources.fetch({ type: "versions" }, `braintree_payments/${_braintreePaymentId}/versions`, params, options);
}
async event_stores(braintreePaymentId, params, options) {
const _braintreePaymentId = braintreePaymentId.id || braintreePaymentId;
return this.resources.fetch({ type: "event_stores" }, `braintree_payments/${_braintreePaymentId}/event_stores`, params, options);
}
isBraintreePayment(resource) {
return resource.type && resource.type === _BraintreePayments.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _BraintreePayments.TYPE;
}
};
var instance = new BraintreePayments();
var braintree_payments_default = instance;
export { braintree_payments_default };
//# sourceMappingURL=chunk-Y3NZRCF4.js.map
//# sourceMappingURL=chunk-Y3NZRCF4.js.map