@mozaic-io/mozaic-sdk-node
Version:
The Mozaic Node SDK enables you to pay your creators easily via the Mozaic API.
53 lines (52 loc) • 2.08 kB
JavaScript
;
/**
* This is the main entry point for working with Payment Cycles.
* @group ResourcesGroup
* @category ResourcesCat
* @document ../../../documents/resources/PaymentCycles.md
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Payments = void 0;
const api_1 = require("../../api");
const BaseResource_1 = require("../BaseResource");
const Payment_1 = require("./Payment");
class Payments extends BaseResource_1.BaseResource {
/**
* @internal
* You should not call this constructor directly. Instead, use the Mozaic main
* entry point to get access to the SDK classes.
* @param configuration
*/
constructor(mozaic, configuration) {
super();
this._mozaic = mozaic;
this._paymentsApi = new api_1.PaymentsApi(configuration);
}
/**
* Get the underlying API for direct calls to the Mozaic API.
*/
get PaymentsApi() {
return this._paymentsApi;
}
/**
* Get a payment by ID
* @param paymentId The ID of the payment to retrieve
* @returns A Payment object
*/
getPayment(paymentId) {
return __awaiter(this, void 0, void 0, function* () {
const result = yield this.execute(() => this._paymentsApi.getPayment(paymentId));
return new Payment_1.Payment(this._mozaic, result);
});
}
}
exports.Payments = Payments;