enhancv/mongoose-subscriptions

View on GitHub
src/AbstractProcessor.js

Summary

Maintainability
A
0 mins
Test Coverage
/* eslint class-methods-use-this: "off" */
/* eslint no-unused-vars: "off" */

const EventEmitter = require("events");

class AbstractProcessor extends EventEmitter {
    isNotImplemented(featureName) {
        throw new Error(`${featureName} is not implemented by ${this.constructor.name}`);
    }

    load(customer) {
        this.isNotImplemented("Load customer");
    }

    save(customer) {
        this.isNotImplemented("Save customer");
    }

    cancelSubscription(customer, subscriptionId) {
        this.isNotImplemented("Cancel subscription");
    }

    refundTransaction(customer, transactionId, amount) {
        this.isNotImplemented("Refund transaction");
    }

    voidTransaction(customer, transactionId) {
        this.isNotImplemented("Void transaction");
    }
}

module.exports = AbstractProcessor;