/** * Pure mapping/validation helpers for PayPal capture & refund resource statuses. * * Kept free of any container/IO dependencies so the money-flow decisions (what * counts as a settled capture, when a refund must be rejected, how a PayPal * status maps onto a Medusa payment status) can be unit-tested in isolation. */ /** Map a PayPal capture status onto a Medusa payment status. */ export declare function mapPayPalCaptureStatus(status?: string): "captured" | "pending" | "error" | "canceled" | null; /** * Effective status of a PayPal capture resource. * * The orders-capture response nests the capture under * `purchase_units[].payments.captures[]` — the order's own top-level status can * read COMPLETED while the capture is still PENDING — whereas the * authorizations-capture response is the capture object directly. Prefer the * nested capture status, falling back to the top level. */ export declare function extractCaptureStatus(resource: any): string; /** * True only when a capture resource is COMPLETED. A 2xx HTTP response does NOT * imply this: PayPal returns 201 for PENDING (pending review / eCheck), * DECLINED, and FAILED captures too. */ export declare function isCaptureCompleted(resource: any): boolean; /** * Refund statuses that mean the refund did NOT go through and must never be * recorded as a successful refund. PENDING is intentionally excluded: PayPal * processes refunds asynchronously and a pending refund settles later. */ export declare function isRefundFailureStatus(status?: string): boolean; /** * Capture statuses that count toward the funds PayPal has already taken (or * reserved) for an order. PENDING is included: a pending capture still holds * the amount against the authorization, so a further capture must not exceed * what is left. Refunded captures still count — a refund returns money to the * buyer, it does not free the authorization for re-capture. DECLINED / FAILED * captures took nothing. */ export declare const HELD_CAPTURE_STATUSES: readonly ["COMPLETED", "PENDING", "PARTIALLY_REFUNDED", "REFUNDED"]; /** Capture statuses whose funds actually settled (PENDING excluded). */ export declare const SETTLED_CAPTURE_STATUSES: readonly ["COMPLETED", "PARTIALLY_REFUNDED", "REFUNDED"]; export declare function isCountedCaptureStatus(status?: string): boolean; /** * Sum of `amount.value` over the captures whose status is in `statuses`. * Captures without a readable amount are ignored. */ export declare function sumCaptureAmounts(captures: unknown, statuses: readonly string[]): number; /** Funds PayPal holds for the order — settled plus still-pending captures. */ export declare function sumCountedCaptureAmounts(captures: unknown): number; /** Funds that demonstrably settled (COMPLETED, possibly refunded since). */ export declare function sumSettledCaptureAmounts(captures: unknown): number; //# sourceMappingURL=status-utils.d.ts.map