UNPKG

@magic.batua/recharge

Version:

The Recharge module manages all the mobile prepaid, datacard and DTH recharge functionalities of the Magic Batua platform.

30 lines 1.06 kB
"use strict"; /** * @module RechargeError * @overview Defines methods that parse Rocket in Pocket response and look for errors. * * @author Animesh Mishra <hello@animesh.ltd> * @copyright © Animesh Ltd. All Rights Reserved. */ Object.defineProperty(exports, "__esModule", { value: true }); const error_1 = require("@magic.batua/error"); /** @exports RechargeError */ exports.description = "Defines method that parse Rocket in Pocket response and look for errors."; /** * Checks whether the given Rocket in Pocket API `response` has any errors. If not, returns * `null`, otherwise returns an `ExternalError` describing the failure. * * @param {any} response Response sent by Rocket in Pocket API * * @returns {ExternalError | null} */ function Check(response) { if (response.message) { return new error_1.ExternalError(response.message, "Rocket in Pocket", "RIP error code: " + response.errorCode); } else { return null; } } exports.Check = Check; //# sourceMappingURL=RechargeError.js.map