I am working on implementing a get request within a component that retrieves a response:
getPaymentIntents(): Observable<Payment>{
const url: string = 'https://store.com//payments';
return this.http.get<Payment>(url);
}
The response data structure for the "Payment" type is as follows:
[
{
"id": "pi_3K4B432423dqM1gTYncsL",
"amount": 2000,
"amount_capturable": 0,
"amount_received": 0,
"application": null,
"canceled_at": null,
"cancellation_reason": null,
"created": 1638911287,
"currency": "usd",
"customer": "cus_KjDBkdsaHIT6AN"
},
{
"id": "pi_3K4BW7EE9YQoA1qM1gTYncsL",
"amount": 1000,
"amount_capturable": 0,
"amount_received": 0,
"application": null,
"canceled_at": null,
"cancellation_reason": null,
"created": 1638913687,
"currency": "usd",
"customer": "cus_KjDBkxEVHIT6AN"
}
]
I aim to display this data in a Material Table. I only need to showcase a subset of the information and plan to incorporate another response's data into the table in the future.
The desired interface for passing data to the table as a dataSource should match the following format:
export interface OrderToProcess{
Id: string,
Amount: number,
Currency: string
}
I have been experimenting with methods like `filter()`, `map()`, `Object.entries()` to transform one type into another but haven't achieved the desired outcome yet. Any guidance or assistance would be greatly appreciated!