UNPKG

bankson-js

Version:
55 lines (43 loc) 1.99 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _qs = require('qs'); var _qs2 = _interopRequireDefault(_qs); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var InboundPayments = function () { function InboundPayments(base) { _classCallCheck(this, InboundPayments); this.base = base; } _createClass(InboundPayments, [{ key: 'fetch', value: function fetch(opts) { return this.base.get('/inboundpayments?' + _qs2.default.stringify(opts)); } }, { key: 'refresh', value: function refresh(certificateId) { return this.base.post('/inboundpayments', { certificate_id: certificateId }); } }, { key: 'batch', value: function batch(batchId) { var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'json'; var opts = void 0; if (type !== 'json') { opts = { headers: { 'Accept': type === 'xml' ? 'application/xml' : 'text/plain' }, responseType: 'arraybuffer' }; } return this.base.get('/inboundpayments/batches/' + batchId, opts); } }]); return InboundPayments; }(); exports.default = InboundPayments;