moip-sdk-node-ts
Version:
Moip v2 API wrapper
35 lines (34 loc) • 2.13 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const api_assinaturas_1 = __importDefault(require("../client/api_assinaturas"));
const getOne = (opts, _code) => api_assinaturas_1.default.get(opts, `/subscriptions/${_code}`);
const getAll = (opts) => api_assinaturas_1.default.get(opts, '/subscriptions');
const create = (opts, subscription, config) => api_assinaturas_1.default.post(opts, '/subscriptions', subscription, config);
const update = (opts, _code, subscription) => api_assinaturas_1.default.put(opts, `/subscriptions/${_code}`, subscription);
const updatePaymentMethod = (opts, _code, paymentMethod) => api_assinaturas_1.default.put(opts, `/subscriptions/${_code}/change_payment_method`, paymentMethod);
const suspend = (opts, _code) => api_assinaturas_1.default.put(opts, `/subscriptions/${_code}/suspend`);
const activate = (opts, _code) => api_assinaturas_1.default.put(opts, `/subscriptions/${_code}/activate`);
const cancel = (opts, _code) => api_assinaturas_1.default.put(opts, `/subscriptions/${_code}/cancel`);
const getOneInvoice = (opts, _id) => api_assinaturas_1.default.get(opts, `/invoices/${_id}`);
const getAllInvoices = (opts, _code) => api_assinaturas_1.default.get(opts, `/subscriptions/${_code}/invoices`);
const getOnePayment = (opts, _id) => api_assinaturas_1.default.get(opts, `/payments/${_id}`);
const getAllPayments = (opts, _id) => api_assinaturas_1.default.get(opts, `/invoices/${_id}/payments`);
const createNotification = (opts, notification) => api_assinaturas_1.default.post(opts, '/users/preferences', notification);
exports.default = {
getOne: getOne,
getAll: getAll,
create: create,
update: update,
updatePaymentMethod: updatePaymentMethod,
suspend: suspend,
activate: activate,
cancel: cancel,
getOneInvoice: getOneInvoice,
getAllInvoices: getAllInvoices,
getOnePayment: getOnePayment,
getAllPayments: getAllPayments,
createNotification: createNotification,
};