3 blocker phases
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user