paypal-rest-api
Version:
A typescript module for integrating with PayPal REST APIs.
28 lines (27 loc) • 890 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const abstracts_1 = require("../abstracts");
const schemas_1 = require("./schemas");
class SaleApi extends abstracts_1.Api {
constructor(client) {
super(client, SaleApi.schemas, SaleApi.paths);
}
refund(id, options = {}) {
if (SaleApi.schemas.id) {
id = this.schemaValidate(id, SaleApi.schemas.id);
}
options.uri = this.parsePath(SaleApi.paths.refund, { id });
options = this.schemaValidate(options, SaleApi.schemas.refund);
return this.client.request(options);
}
}
SaleApi.paths = {
get: `/v1/payments/sale/{id}`,
refund: `/v1/payments/sale/{id}/refund`,
};
SaleApi.schemas = {
get: schemas_1.saleGetRequestSchema,
id: schemas_1.saleIdSchema,
refund: schemas_1.saleRefundRequestSchema,
};
exports.SaleApi = SaleApi;