Skip to content

Commit

Permalink
docs: Add code example to get customer cards
Browse files Browse the repository at this point in the history
  • Loading branch information
peoray committed Jan 30, 2024
1 parent e286884 commit 0b91d6e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 14 additions & 0 deletions examples/cards/get-customer-cards.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Bloc } from '../../dist'

const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key')

const getCustomerCards = async () => {
try {
const cards = await bloc.getCustomerCards('customer-id')
console.log(cards)
} catch (error) {
console.error(error)
}
}

getCustomerCards()
6 changes: 4 additions & 2 deletions src/services/cards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ export class Cards extends HTTPCore {
* @param {string} customerID - The ID of the customer to retrieve cards for.
* @returns {Promise<ICardResponse>} A promise that resolves to the list of cards associated with the customer.
*/
public async getCustomerCards(customerID: string): Promise<ICardResponse> {
return this.get<ICardResponse>(`/cards/customer/${customerID}`)
public async getCustomerCards(
customerID: string
): Promise<IGetCardsResponse> {
return this.get<IGetCardsResponse>(`/cards/customer/${customerID}`)
}

/**
Expand Down

0 comments on commit 0b91d6e

Please sign in to comment.