refactor(helcim): normalize listHelcimCustomerCards return shape
This commit is contained in:
parent
27e73e969a
commit
134aef6ab0
6 changed files with 58 additions and 33 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue