diff --git a/src/app/core/services/checkout.service.ts b/src/app/core/services/checkout.service.ts index b2a26b8..609014a 100644 --- a/src/app/core/services/checkout.service.ts +++ b/src/app/core/services/checkout.service.ts @@ -24,7 +24,7 @@ export interface PurchaseSummaryResponse extends PurchaseStatusResponse { export interface PurchaseDetailAttributeResponse { name: string; - value: string | null; + value: string | number | boolean | null; } export interface PurchaseDetailItemResponse { @@ -32,16 +32,15 @@ export interface PurchaseDetailItemResponse { quantity: number; unit_price: string; line_total: string; - product: { - id: number; + source_catalog_item_id: number | null; + source_variant_id: number | null; + item_details: { nombre: string; + descripcion: string | null; slug: string; imagen: string | null; - } | null; - variant: { - id: number; attributes: PurchaseDetailAttributeResponse[]; - } | null; + }; } export interface PurchaseDetailResponse extends PurchaseStatusResponse { @@ -52,10 +51,11 @@ export interface PurchaseDetailResponse extends PurchaseStatusResponse { created_at: string | null; payment_method: string | null; dni: string | null; + transfer_payer_dni: string | null; telefono: string | null; nombre_apellido: string | null; email: string | null; - items_source: 'purchase' | 'cart' | null; + items_source: 'purchase'; items: PurchaseDetailItemResponse[]; subtotal: string; total: string; diff --git a/src/app/features/store/pages/account-page/pages/purchase-detail-page/purchase-detail-page.ts b/src/app/features/store/pages/account-page/pages/purchase-detail-page/purchase-detail-page.ts index 34dfb89..91197a3 100644 --- a/src/app/features/store/pages/account-page/pages/purchase-detail-page/purchase-detail-page.ts +++ b/src/app/features/store/pages/account-page/pages/purchase-detail-page/purchase-detail-page.ts @@ -79,12 +79,12 @@ export class PurchaseDetailPage implements OnInit { private mapItems(purchase: PurchaseDetailResponse): PurchaseItemViewModel[] { return purchase.items.map((item) => ({ id: item.id, - title: item.product?.nombre ?? 'Producto sin nombre', - imageUrl: item.product?.imagen ?? null, + title: item.item_details.nombre || 'Producto sin nombre', + imageUrl: item.item_details.imagen, quantity: item.quantity, - attributes: (item.variant?.attributes ?? []).map((attribute) => ({ + attributes: item.item_details.attributes.map((attribute) => ({ label: attribute.name, - value: attribute.value, + value: attribute.value === null ? null : String(attribute.value), })), price: item.line_total, originalPrice: null,