Skip to content

Commit

Permalink
Update getCardDetails request with URL
Browse files Browse the repository at this point in the history
  • Loading branch information
sanducb committed Sep 25, 2024
1 parent 1086ed4 commit c8c0868
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions packages/wallet/backend/src/gatehub/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,15 @@ export class GateHubClient {
throw new Error('Failed to obtain token for card data retrieval')
}

// TODO
// Will get this from the response
const cardDetailsUrl = ''
// TODO change this to direct call to card managing entity
// Will get this from the GateHub proxy for now
const cardDetailsUrl = `${this.apiUrl}/v1/proxy/client-device/card-data`
const cardDetailsResponse = await this.request<ICardDetailsResponse>(
'GET',
cardDetailsUrl
cardDetailsUrl,
undefined,
undefined,
token
)

return cardDetailsResponse
Expand All @@ -364,15 +367,17 @@ export class GateHubClient {
method: HTTP_METHODS,
url: string,
body?: string,
managedUserUuid?: string
managedUserUuid?: string,
token?: string
): Promise<T> {
const timestamp = Date.now().toString()
const headers = this.getRequestHeaders(
timestamp,
method,
url,
body ?? '',
managedUserUuid
managedUserUuid,
token
)

try {
Expand Down Expand Up @@ -407,15 +412,19 @@ export class GateHubClient {
method: HTTP_METHODS,
url: string,
body?: string,
managedUserUuid?: string
managedUserUuid?: string,
token?: string
) {
return {
'Content-Type': 'application/json',
'x-gatehub-app-id': this.env.GATEHUB_ACCESS_KEY,
'x-gatehub-timestamp': timestamp,
'x-gatehub-signature': this.getSignature(timestamp, method, url, body),
'x-gatehub-card-app-id': this.env.GATEHUB_CARD_APP_ID,
...(managedUserUuid && { 'x-gatehub-managed-user-uuid': managedUserUuid })
...(managedUserUuid && {
'x-gatehub-managed-user-uuid': managedUserUuid
}),
...(token && { Authorization: token })
}
}

Expand Down

0 comments on commit c8c0868

Please sign in to comment.