import { PathEventEmitter } from '@ztimson/utils';
import { Api } from './api';
import { Meta } from './core';
import { Discounts } from './discounts';
/** Credit-card information for payments */
export type Card = {
    /** Credit-card number */
    number: number | string;
    /** Year card expires */
    expYear: number | string;
    /** Month card expires */
    expMonth: number | string;
    /** 3 digit security code */
    csv: number | string;
    /** Additional details for anti-fraud */
    details?: {
        /** Cardholder name */
        name?: string;
        /** Billing address */
        address?: {
            postal_code?: string;
        };
    };
};
/** User financial status */
export type Finances = {
    /** Username */
    _id?: string;
    /** Account balance */
    balance: number;
    /** Account subscriptions */
    subscriptions: {
        /** Product ID */
        _id: string;
        /** Date subscription started */
        created: Date;
        /** Number of days the subscription lasts */
        interval: number;
        /** Date of next renewal, null if cancelled */
        renewal?: Date | null;
    }[];
};
/** Payment API options */
export type PaymentOptions = {
    /** Path to payment page */
    paymentUrl?: string;
};
/** Returned products */
export type Product<T = any> = T & {
    _id: number;
    name: string;
    cost: number;
    subscription?: number;
    socked: boolean;
};
/** Purchase options */
export type Transaction = Meta & {
    /** Purchased items */
    cart: {
        /** Product ID number, 'balance' for credit or null if custom */
        _id?: number | 'balance';
        /** Product name or description */
        name: string;
        /** Number of units to purchase */
        quantity: number;
        /** Individual unit cost */
        cost: number;
    }[];
    /** How was the transaction completed */
    complete?: string;
    /** Apply credit (Infinity to use all credit) */
    credit: number;
    /** Apply discount */
    discount?: {
        code?: string;
        type: 'fixed' | 'percent';
        value: number;
    };
    /** Receipt/Invoice number */
    invoiceNum?: string;
    /** Transaction notes */
    notes?: string | null;
    /** Recipient username or information */
    recipient?: {
        /** Billing address */
        address?: string;
        /** Delivery email */
        email?: string;
        /** Receipt name */
        name?: string;
        /** Account name */
        username?: string;
    };
    /** Whether the transaction/invoice has been refunded / canceled respectively */
    refunded?: boolean;
    /** Current status of transaction - null for self-checkout */
    status?: 'Invoice' | 'Cancelled' | 'Receipt' | 'Refunded';
    /** Transaction total */
    subtotal: number;
    /** Tax percentage as float */
    tax: number;
    /** Transaction total (subtotal - discount - credit + tax) */
    total: number;
    /** Stripe transaction */
    tx?: any;
};
export declare class Payments extends PathEventEmitter {
    readonly opts: PaymentOptions;
    private readonly api;
    discounts: Discounts;
    /** Stripe object */
    stripe?: any;
    /** Public stripe token */
    token?: string;
    constructor(api: Api | string, opts?: PaymentOptions);
    /**
     * Initialize stripe API
     * @return {Promise<any>} Returns stripe API
     * @private
     */
    private init;
    /**
     * Create a stripe client secret to complete transaction
     * @param {string} id Transaction ID
     * @return {Promise<string>} Client secret
     * @private
     */
    private createSecret;
    /**
     * Create/Update a transaction
     * @param {Optional<Transaction, "subtotal" | "total">} transaction Transaction information
     * @return {Promise<string>} Completed translation information
     */
    checkout(transaction: Partial<Transaction> & {
        recipient: string;
        discount: string;
    }): Promise<Transaction>;
    /**
     * Get translation history
     * @param {string} username Limit history to user
     * @return {Promise<Transaction[]>} List of translations
     */
    history(username?: string): Promise<Transaction[]>;
    /**
     * Send recipient transaction receipt or invoice
     * @param {string} id Translation ID
     * @return {Promise<void>} Returns once complete
     */
    notify(id: string): Promise<void>;
    /**
     * Retrieve a list of available products
     * @param {string | number} id Limit to specific product
     * @return {Promise<any>} List of products or single product if ID is used
     */
    products<T = any>(id?: string): Promise<T[]>;
    /**
     * Process payment programmatically
     * @param {string} id Transaction ID
     * @param {Card} card Credit card information
     * @return {Promise<any>} Stripe confirmation
     */
    payment(id: string, card: Card): Promise<any>;
    /**
     * Process payment using Stripe form
     * @param {string} id Transaction ID
     * @param {string} element DOM element to inject form into
     * @return {Promise<() => Promise<any>>} Callback to submit form
     */
    paymentForm(id: string, element: string): Promise<() => Promise<any>>;
    /**
     * Complete payment via Momentum's payment page
     * @param {string} id Transaction ID
     * @param {string} host Host origin attempting to login
     * @return {Promise<string>} Translation ID on success
     */
    paymentRedirect(id: string, host?: string): Promise<string>;
    /**
     * Refund a transaction
     * @param {string} id Transaction number to refund
     * @return {PromiseProgress<any>}
     */
    refund(id: string): import('@ztimson/utils').PromiseProgress<any>;
}
//# sourceMappingURL=payments.d.ts.map