import { Injectable } from '@angular/core'; import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http'; import { Observable, throwError } from 'rxjs'; import { environment } from '../../environments/environment'; @Injectable({ providedIn: 'root' }) export class PaymentsService { constructor(private httpClient: HttpClient) { } sendNewPaymentDefaultsGetRequest() { return this.httpClient.get(`${environment.apiUrl}/api/v1/vendor_payments/newPaymentDefaults`) } invoicePaymentsDefaultGetRequest() { return this.httpClient.get(`${environment.apiUrl}/api/v1/invoices/newInvoicePaymentDefaults`) } createInvoicePayment(newPaymentFormData) { const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }; return this.httpClient.post(`${environment.apiUrl}/api/v1/customers/customer_payment`,newPaymentFormData,httpOptions) } createVendorPayment(newVendorPaymentFormData) { const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }; return this.httpClient.post(`${environment.apiUrl}/api/v1/vendor_payments`,newVendorPaymentFormData,httpOptions) // .subscribe( // (res) => console.log(res), // (err) => console.log(err) // ); } }