/** * Shared PayPal payment-session helpers. * * `create-order` and `capture-order` must agree on (a) which payment session * belongs to a cart and (b) how the PayPal order id is stored/read on it — * otherwise the capture's fail-closed binding (the order id stored by * create-order must equal the one being captured) can never be satisfied. * Keeping the logic here, resolved through the Payment module service * (`Modules.PAYMENT`), guarantees both routes use the same, correct path. */ export type PayPalCartSession = { session_id: string; session_data: Record; session_status: string; }; /** * Resolve the cart's active PayPal payment session (wallet or card). When a * cart has more than one PayPal session, the most recently created one wins — * both create-order and capture-order rely on this same selection so they * always read and write the same session. */ export declare function findPayPalSessionForCart(cartId: string, scope: any): Promise; /** * Read the PayPal order id stored on a session's `data`. Accepts both the * canonical `data.paypal.order_id` and the legacy top-level `data.order_id`. * Returns null when none is present. */ export declare function getStoredPayPalOrderId(sessionData?: Record | null): string | null; /** * Shallow-merge `extraData` into a payment session's `data`, preserving the * session's amount/currency. Callers that update the nested `paypal` object are * responsible for spreading its existing keys (see `getStoredPayPalOrderId`). * * The write is retried a few times before giving up: when this runs right after * a successful PayPal capture, a transient DB blip that loses the write means * the money is captured but Medusa never records it. A bounded retry closes the * common transient-failure window; if every attempt fails the error is * re-thrown (with a CRITICAL log for capture/order data) so the caller can react * — the webhook and paypal-complete's live re-derivation remain the backstop. */ export declare function updatePayPalSessionData(sessionId: string, extraData: Record, scope: any): Promise; //# sourceMappingURL=payment-session.d.ts.map