3 blocker phases

This commit is contained in:
hamid
2026-08-02 23:12:44 +03:30
parent 90e0cdcc34
commit 66a60ce874
38 changed files with 536 additions and 234 deletions
+20 -4
View File
@@ -1,10 +1,26 @@
import { USE_REFUNDS_MOCK } from '../constants';
import { USE_ADMIN_REFUNDS_MOCK, USE_CUSTOMER_REFUNDS_MOCK } from '../constants';
import type { RefundsApi } from '../types';
import { refundsClientApi } from './clientApi';
import { refundsMockApi } from './mockApi';
const customer = USE_CUSTOMER_REFUNDS_MOCK ? refundsMockApi : refundsClientApi;
const admin = USE_ADMIN_REFUNDS_MOCK ? refundsMockApi : refundsClientApi;
/**
* The selected `RefundsApi` implementation — the single seam the hooks import. Selection is by config
* (`USE_REFUNDS_MOCK`), never by scattered `if (mock)` checks.
* The selected `RefundsApi` implementation — the single seam the hooks import. The customer surface and
* the admin console are two independently-selected halves (`USE_CUSTOMER_REFUNDS_MOCK` /
* `USE_ADMIN_REFUNDS_MOCK`), composed into one object here rather than scattered `if (mock)` checks —
* see the constants for why the admin group must never be split across real and mock.
*/
export const refundsApi: RefundsApi = USE_REFUNDS_MOCK ? refundsMockApi : refundsClientApi;
export const refundsApi: RefundsApi = {
resolveCancellationPolicy: customer.resolveCancellationPolicy,
cancelBooking: customer.cancelBooking,
getRefundByBooking: customer.getRefundByBooking,
getRefund: customer.getRefund,
getMyRefunds: customer.getMyRefunds,
getRefundPreview: admin.getRefundPreview,
initiateRefund: admin.initiateRefund,
approveRefund: admin.approveRefund,
rejectRefund: admin.rejectRefund,
};