refactor(helcim): normalize listHelcimCustomerCards return shape

This commit is contained in:
Jennie Robinson Faber 2026-04-27 11:46:25 +01:00
parent 5f93d4c2e3
commit 0a41b30db7
6 changed files with 58 additions and 33 deletions

View file

@ -86,8 +86,10 @@ export const createHelcimCustomer = (payload) =>
export const updateHelcimCustomer = (id, payload) =>
helcimFetch(`/customers/${id}`, { method: 'PATCH', body: payload, errorMessage: 'Billing update failed' })
export const listHelcimCustomerCards = (id) =>
helcimFetch(`/customers/${id}/cards`, { errorMessage: 'Card lookup failed' })
export const listHelcimCustomerCards = async (id) => {
const raw = await helcimFetch(`/customers/${id}/cards`, { errorMessage: 'Card lookup failed' })
return Array.isArray(raw) ? raw : (raw?.cards || raw?.data || [])
}
/**
* Set a customer's default payment method by card token.