@@ -47,6 +47,8 @@ import {
4747 ICardLockRequest ,
4848 ICardUnlockRequest
4949} from '@/card/types'
50+ import { BlockReasonCode } from '@wallet/shared/src'
51+
5052export class GateHubClient {
5153 private clientIds = SANDBOX_CLIENT_IDS
5254 private mainUrl = 'sandbox.gatehub.net'
@@ -403,40 +405,6 @@ export class GateHubClient {
403405 return this . request < IGetTransactionsResponse > ( 'GET' , url )
404406 }
405407
406- async lockCard (
407- cardId : string ,
408- reasonCode : LockReasonCode ,
409- requestBody : ICardLockRequest
410- ) : Promise < ICardResponse > {
411- let url = `${ this . apiUrl } /v1/cards/${ cardId } /lock`
412- url += `?reasonCode=${ encodeURIComponent ( reasonCode ) } `
413-
414- return this . request < ICardResponse > (
415- 'PUT' ,
416- url ,
417- JSON . stringify ( requestBody ) ,
418- {
419- cardAppId : this . env . GATEHUB_CARD_APP_ID
420- }
421- )
422- }
423-
424- async unlockCard (
425- cardId : string ,
426- requestBody : ICardUnlockRequest
427- ) : Promise < ICardResponse > {
428- const url = `${ this . apiUrl } /v1/cards/${ cardId } /unlock`
429-
430- return this . request < ICardResponse > (
431- 'PUT' ,
432- url ,
433- JSON . stringify ( requestBody ) ,
434- {
435- cardAppId : this . env . GATEHUB_CARD_APP_ID
436- }
437- )
438- }
439-
440408 async getPin (
441409 requestBody : ICardDetailsRequest
442410 ) : Promise < ICardDetailsResponse > {
@@ -501,6 +469,51 @@ export class GateHubClient {
501469 )
502470 }
503471
472+ async lockCard (
473+ cardId : string ,
474+ reasonCode : LockReasonCode ,
475+ requestBody : ICardLockRequest
476+ ) : Promise < ICardResponse > {
477+ let url = `${ this . apiUrl } /v1/cards/${ cardId } /lock`
478+ url += `?reasonCode=${ encodeURIComponent ( reasonCode ) } `
479+
480+ return this . request < ICardResponse > (
481+ 'PUT' ,
482+ url ,
483+ JSON . stringify ( requestBody ) ,
484+ {
485+ cardAppId : this . env . GATEHUB_CARD_APP_ID
486+ }
487+ )
488+ }
489+
490+ async unlockCard (
491+ cardId : string ,
492+ requestBody : ICardUnlockRequest
493+ ) : Promise < ICardResponse > {
494+ const url = `${ this . apiUrl } /v1/cards/${ cardId } /unlock`
495+
496+ return this . request < ICardResponse > (
497+ 'PUT' ,
498+ url ,
499+ JSON . stringify ( requestBody ) ,
500+ {
501+ cardAppId : this . env . GATEHUB_CARD_APP_ID
502+ }
503+ )
504+ }
505+
506+ async permanentlyBlockCard (
507+ cardId : string ,
508+ reasonCode : BlockReasonCode
509+ ) : Promise < ICardResponse > {
510+ let url = `${ this . apiUrl } /v1/cards/${ cardId } /block`
511+
512+ url += `?reasonCode=${ encodeURIComponent ( reasonCode ) } `
513+
514+ return this . request < ICardResponse > ( 'PUT' , url )
515+ }
516+
504517 private async request < T > (
505518 method : HTTP_METHODS ,
506519 url : string ,
0 commit comments