feat(checkout): define CreatePurchasePayload interface and update createPurchase method to use it

This commit is contained in:
2026-07-06 14:22:12 -03:00
parent 69fee4e20a
commit 09fa876da3
2 changed files with 20 additions and 10 deletions

View File

@@ -3,7 +3,14 @@ import { HttpClient } from '@angular/common/http';
import { firstValueFrom } from 'rxjs';
import { environment } from '../../../environments/environment';
import { BankAccount } from './tenant.interface';
export interface CreatePurchasePayload {
cart_id: number;
dni: string;
telefono: string;
nombre_apellido: string;
email: string;
}
@Injectable({
providedIn: 'root'
@@ -11,7 +18,7 @@ import { BankAccount } from './tenant.interface';
export class CheckoutService {
private readonly http = inject(HttpClient);
async createPurchase(tenantCode: string, payload: any): Promise<{ id: number }> {
async createPurchase(tenantCode: string, payload: CreatePurchasePayload): Promise<{ id: number }> {
const response = await firstValueFrom(
this.http.post<{ data: { id: number } }>(`${environment.url}tenants/${tenantCode}/compras`, payload)
);