UNPKG

gamemoney-frorff

Version:
89 lines 2.92 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GameMoney = void 0; const request_1 = __importDefault(require("./request")); const utils_1 = require("./utils"); class GameMoney { constructor(config) { this.config = config; const { hmacKey, privateKey } = config; this.request = new request_1.default(hmacKey, privateKey); } send(url, body = {}, signType = 'hmac') { body.project = this.config.project; if (signType === 'rsa' && !this.config.privateKey) { throw new Error('To make requests with signType: \'rsa\', privateKey must be specified'); } return this.request.send(url, body, signType); } generateHmacSignature(body) { return utils_1.generateHmacSignature(body, this.config.hmacKey); } createInvoice(body) { return this.send('/invoice/', body); } getInvoiceStatus(body) { return this.send('/invoice/status', body); } getInvoiceList(body) { return this.send('/invoice/list', body); } createCheckout(body) { return this.send('/checkout/insert', body, 'rsa'); } cancelCheckout(body) { return this.send('/checkout/cancel', body); } getCheckoutStatus(body) { return this.send('/checkout/status', body); } getCheckoutList(body) { return this.send('/checkout/list', body); } addCard(body) { return this.send('/card/add', body); } getCardList(body) { return this.send('/card/list', body); } deleteCard(body) { return this.send('/card/delete', body); } prepareExchange(body) { return this.send('/exchange/prepare', body); } convertExchange(body) { return this.send('/exchange/convert', body); } fastConvertExchange(body) { return this.send('/exchange/fastconvert', body); } getExchangeInfo(body) { return this.send('/exchange/info', body); } getExchangeRate(body) { return this.send('/exchange/rate', body); } getExchangeStatus(body) { return this.send('/exchange/status', body); } getBalanceStatistics(body) { return this.send('/statistics/balance', body); } getDaysBalanceStatistics(body) { return this.send('/statistics/days_balance_project', body); } getPayTypesStatistics() { return this.send('/statistics/paytypes'); } createTerminal(body) { return this.send('/terminal/create', body); } } exports.GameMoney = GameMoney; var utils_2 = require("./utils"); Object.defineProperty(exports, "verifyRsaSignature", { enumerable: true, get: function () { return utils_2.verifyRsaSignature; } }); //# sourceMappingURL=index.js.map