Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
bistaastha committed Feb 6, 2024
1 parent 049e8ff commit 64d3927
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/app/core/models/card-details-amount-response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface CardDetailsAmountResponse {
current_amount: number;
}
4 changes: 0 additions & 4 deletions src/app/core/models/card-details-response.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@ export interface CardDetailsResponse {
cvv: string;
expiry_date: Date;
}

export interface CardDetailsAmountResponse {
current_amount: number;
}
11 changes: 6 additions & 5 deletions src/app/core/services/virtual-cards.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Injectable } from '@angular/core';
import { SpenderPlatformV1ApiService } from './spender-platform-v1-api.service';
import { Observable, map } from 'rxjs';
import { VirtualCardsRequest } from '../models/virtual-cards-request.model';
import { CardDetailsAmountResponse, CardDetailsResponse } from '../models/card-details-response.model';
import { CardDetailsResponse } from '../models/card-details-response.model';
import { CardDetailsAmountResponse } from '../models/card-details-amount-response';

@Injectable({
providedIn: 'root',
Expand All @@ -13,20 +14,20 @@ export class VirtualCardsService {
getCardDetailsById(virtualCardRequestPayload: VirtualCardsRequest): Observable<CardDetailsResponse> {
return this.spenderPlatformV1ApiService
.post<{
data: CardDetailsResponse
data: CardDetailsResponse;
}>('/virtual_cards/show_card_details', {
data: virtualCardRequestPayload,
})
.pipe(map((response) => response.data));
}

getCurrentAmountById(virtualCardRequestPayload: VirtualCardsRequest): Observable<number> {
getCurrentAmountById(virtualCardRequestPayload: VirtualCardsRequest): Observable<CardDetailsAmountResponse> {
return this.spenderPlatformV1ApiService
.post<{
data: CardDetailsAmountResponse
data: CardDetailsAmountResponse;
}>('/virtual_cards/get_current_amount', {
data: virtualCardRequestPayload,
})
.pipe(map((response) => response.data.current_amount));
.pipe(map((response) => response.data));
}
}

0 comments on commit 64d3927

Please sign in to comment.