declastruct-stripe-sdk
Version:
declarative control of stripe constructs, via declastruct
24 lines • 891 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.delInvoiceItem = void 0;
const helpful_errors_1 = require("helpful-errors");
const visualogic_1 = require("visualogic");
const getInvoiceItem_1 = require("./getInvoiceItem");
/**
* .what = deletes an invoice item
* .what.intent =
* - remove it from an invoice item
*/
exports.delInvoiceItem = (0, visualogic_1.withLogTrail)(async (input, context) => {
// find the item
const item = await (0, getInvoiceItem_1.getInvoiceItem)({ by: { ref: input.by.ref } }, context);
if (!item)
throw new helpful_errors_1.UnexpectedCodePathError('item does not exist by ref', {
input,
});
// delete it
await context.stripe.invoiceItems.del(item.id);
}, {
name: (0, visualogic_1.getResourceNameFromFileName)(__filename),
});
//# sourceMappingURL=delInvoiceItem.js.map