UNPKG

lightrail-client

Version:
134 lines (133 loc) 3.58 kB
import { BalanceRule } from "./BalanceRule"; export declare type TransactionParty = LightrailTransactionParty | StripeTransactionParty | InternalTransactionParty; export interface LightrailTransactionParty { rail: "lightrail"; contactId?: string; code?: string; valueId?: string; } export interface StripeTransactionParty { rail: "stripe"; source?: string; customer?: string; maxAmount?: number; priority?: number; } export interface InternalTransactionParty { rail: "internal"; internalId: string; balance: number; pretax?: boolean; beforeLightrail?: boolean; } export declare type TransactionStep = LightrailTransactionStep | StripeTransactionStep | InternalTransactionStep; export interface LightrailTransactionStep { rail: "lightrail"; valueId: string; contactId?: string; code?: string; balanceRule: BalanceRule | null; balanceBefore: number | null; balanceAfter: number | null; balanceChange: number | null; usesRemainingBefore: number | null; usesRemainingAfter: number | null; usesRemainingChange: number | null; } export interface StripeTransactionStep { rail: "stripe"; amount: number; chargeId?: string; charge?: any; } export interface InternalTransactionStep { rail: "internal"; internalId: string; balanceBefore: number; balanceAfter: number; balanceChange: number; } export interface LineTotal { subtotal: number; taxable: number; tax: number; discount: number; remainder: number; payable: number; } export interface LineItemBase { type?: "product" | "shipping" | "fee"; productId?: string; variantId?: string; unitPrice?: number; quantity?: number; taxRate?: number; marketplaceRate?: number; tags?: string[]; metadata?: object; lineTotal?: LineTotal; } export interface LineItem extends LineItemBase { lineTotal: LineTotal; } export interface TransactionTotals { subtotal?: number; tax?: number; discount?: number; discountLightrail?: number; forgiven?: number; paidLightrail?: number; paidStripe?: number; paidInternal?: number; payable?: number; remainder?: number; } export declare type TaxRoundingMode = "HALF_EVEN" | "HALF_UP"; export interface TaxRequestProperties { roundingMode: TaxRoundingMode; } export declare type TransactionType = "debit" | "credit" | "checkout" | "transfer" | "reverse" | "capture" | "void" | string; export interface Transaction { id: string; tax: TaxRequestProperties | null; transactionType: TransactionType; currency: string; createdDate: string; totals: TransactionTotals; lineItems: LineItem[]; steps: TransactionStep[]; paymentSources: TransactionParty[] | null; metadata: object | null; createdBy: string; pending?: boolean; pendingVoidDate?: string; simulated?: true; } export interface DebitSource { rail: "lightrail"; code?: string; contactId?: string; valueId?: string; } export interface TransferSource extends DebitSource { source?: string; customer?: string; maxAmount?: number; } export interface CheckoutSource { rail: "lightrail" | "stripe" | "internal"; code?: string; contactId?: string; valueId?: string; source?: string; customer?: string; maxAmount?: number; internalId?: string; balance?: number; beforeLightrail?: boolean; } export interface TransactionDestination { rail: "lightrail"; code?: string; valueId?: string; }