refactor(helcim): normalize listHelcimCustomerCards return shape
This commit is contained in:
parent
5f93d4c2e3
commit
0a41b30db7
6 changed files with 58 additions and 33 deletions
|
|
@ -45,10 +45,7 @@ export default defineEventHandler(async (event) => {
|
|||
const { cardToken } = body
|
||||
|
||||
// Step 3: verify the submitted token is attached to this member's customer
|
||||
const cardsResponse = await listHelcimCustomerCards(member.helcimCustomerId)
|
||||
const cards = Array.isArray(cardsResponse)
|
||||
? cardsResponse
|
||||
: (cardsResponse?.cards || cardsResponse?.data || [])
|
||||
const cards = await listHelcimCustomerCards(member.helcimCustomerId)
|
||||
|
||||
const matchingCard = cards.find((c) => c?.cardToken === cardToken)
|
||||
if (!matchingCard) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue