Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 2x 7x 7x 7x | import { useGetMerchantById } from "@hooks/enterprise-api/account/useGetMerchants";
/**
* The acquirer's own default processor — `processorName` on the account
* (`default_processor_id` backend-side), which is what the Reconciliation Hub
* pre-selects (GB-21646). `/merchants/{id}/processors` is the global processor
* catalogue and carries no default, so it can't answer this.
*
* `isResolving` tracks only whether the account query is still in flight: the
* query is gated on ACQUIRER:READ and a disabled react-query stays `idle`
* (never `loading`), so a denied or failed read resolves to "no default"
* instead of stalling the hub.
*/
export const useAcquirerDefaultProcessor = () => {
const { data, isLoading } = useGetMerchantById();
// useGetMerchantById returns `any`; name the one field we read so the shape
// is stated rather than asserted. Empty string = acquirer has no default.
const account = data as { processorName?: string } | undefined;
return {
defaultProcessorName: account?.processorName || undefined,
isResolving: isLoading,
};
};
|