UNPKG

paypal-rest-api

Version:

A typescript module for integrating with PayPal REST APIs.

34 lines (33 loc) 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const abstracts_1 = require("../abstracts"); const schemas_1 = require("./schemas"); class PaymentApi extends abstracts_1.Api { constructor(client) { super(client, PaymentApi.schemas, PaymentApi.paths); } execute(id, options = {}) { if (PaymentApi.schemas.id) { id = this.schemaValidate(id, PaymentApi.schemas.id); } options.uri = this.parsePath(PaymentApi.paths.execute, { id }); options = this.schemaValidate(options, PaymentApi.schemas.execute); return this.client.request(options); } } PaymentApi.paths = { create: `/v1/payments/payment`, execute: `/v1/payments/payment/{id}/execute`, get: `/v1/payments/payment/{id}`, list: `/v1/payments/payment`, update: `/v1/payments/payment/{id}`, }; PaymentApi.schemas = { create: schemas_1.createPaymentRequestSchema, execute: schemas_1.executePaymentRequestSchema, get: schemas_1.getPaymentRequestSchema, id: schemas_1.paymentIdSchema, list: schemas_1.listPaymentRequestSchema, update: schemas_1.updatePaymentRequestSchema, }; exports.PaymentApi = PaymentApi;