
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { PixOrder } from '../models/pix-order.model';
import { environment } from 'src/environments/environment';

@Injectable({
  providedIn: 'root'
})
export class PixReceiveService {

  constructor(
    private readonly http: HttpClient
  ) {}

  create(pixOrder: PixOrder) {
    const URL_PIX = environment.URL_PIX + 'payment/pix/santander/create';
    console.log(JSON.stringify(pixOrder));
    return this.http.post<any>(URL_PIX, pixOrder);
  }

  find(orderId: number) {
    const URL_PIX = environment.URL_PIX + `payment/pix/santander/find/${orderId}`;
    console.log(JSON.stringify(orderId));
    return this.http.get<any>(URL_PIX);
  }

}
