feat(checkout): define CreatePurchasePayload interface and update createPurchase method to use it
This commit is contained in:
@@ -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)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user