import { Injectable } from "@angular/core"; import { Api } from "./api"; import { Observable } from "rxjs"; import { HttpClient } from "@angular/common/http"; import { Account, PaymentRequest, Checkout, Cities, Feature, IRslt, Invoice, ISixRslt, Media, MerchantDTO, Product, ProductDataDTO, ShopDTO, SocialInfo, States, UPSRateDTO, UPSRateResultDTO, User, UserManagement, UPSShipmentResultDTO, NewInvoiceWithPayment, CreateInvoiceDTO, SquarePaymentRslt } from "../../public-api"; import { InvoiceDataDTO } from "../../tff-models/src/models/dtos/invoice.data.dto"; import { CardProcessDTO } from "../../tff-models/src/models/dtos/card.process.dto"; @Injectable({ providedIn: 'root' }) export class SharedService { states: string = 'https://countriesnow.space/api/v0.1/countries/states'; cities = 'https://countriesnow.space/api/v0.1/countries/state/cities' get route() { return this.api.base + 'shared' } constructor(public api: Api, private http: HttpClient) { } getAllUsers() { return this.api.get(this.route + '/users') } getStates(country: string): Observable { return this.http.post(this.states, { country: country }) } getCities(country: string, state: string): Observable { return this.http.post(this.cities, { country: country, state: state }) } getPendingUserData() { return this.api.get(this.route + '/admin/users') } affiliate() { return this.api.get>(this.route + '/affiliate') } productData() { return this.api.get(this.route + '/product/data') } marketplace(id: string) { return this.api.get(this.route + '/marketplace/' + id) } legaldocs(id: string) { return this.api.get(this.route + '/legal/' + id) } merchantAll() { return this.api.get(this.route + '/merchant/all') } shopInvoices() { return this.api.get(this.route + '/invoice/shop') } merchInvoices(id:string) { return this.api.get(this.route + '/invoice/merchant/' + id) } merchant(id: string) { return this.api.get(this.route + '/merchant/' + id) } thcaStates() { return this.api.get(this.route + '/address/thca') } invoiceNewBankAccount(dto: NewInvoiceWithPayment) { return this.api.post(this.route + '/invoice/new', dto) } getRateData(dto: UPSRateDTO): Observable> { return this.api.post(this.route + '/invoice/shipping/rate', dto) } getShippingData(dto: UPSRateDTO): Observable> { return this.api.post(this.route + '/invoice/shipping/create', dto) } createInvoice(dto: Invoice): Observable> { return this.api.post(this.route + '/invoice/create', dto) } squarePayment(dto: PaymentRequest): Observable> { return this.api.post(this.route + '/payment/square', dto) } }