"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.OxyServicesPaymentMixin = OxyServicesPaymentMixin;
var _mixinHelpers = require("./mixinHelpers");
/**
 * Payment Methods Mixin
 * 
 * Provides methods for payment processing and management
 */

function OxyServicesPaymentMixin(Base) {
  return class extends Base {
    constructor(...args) {
      super(...args);
    }

    /**
     * Create a payment
     * @param data - Payment data
     * @returns Created payment object
     */
    async createPayment(data) {
      try {
        return await this.makeRequest('POST', '/api/payments', data, {
          cache: false
        });
      } catch (error) {
        throw this.handleError(error);
      }
    }

    /**
     * Get payment by ID
     * @param paymentId - The payment ID
     * @returns Payment object
     */
    async getPayment(paymentId) {
      try {
        return await this.makeRequest('GET', `/api/payments/${paymentId}`, undefined, {
          cache: true,
          cacheTTL: _mixinHelpers.CACHE_TIMES.LONG
        });
      } catch (error) {
        throw this.handleError(error);
      }
    }

    /**
     * Get user payments
     * @returns Array of user payments
     */
    async getUserPayments() {
      try {
        return await this.makeRequest('GET', '/api/payments/user', undefined, {
          cache: false // Don't cache user payments - always get fresh data
        });
      } catch (error) {
        throw this.handleError(error);
      }
    }
  };
}
//# sourceMappingURL=OxyServices.payment.js.map