-
Notifications
You must be signed in to change notification settings - Fork 5
/
pagamento.service.ts
executable file
·43 lines (28 loc) · 1.29 KB
/
pagamento.service.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import {Http, Response,
Headers, RequestOptions} from '@angular/http'
import { Injectable } from '@angular/core';
import { Dados } from './dados.class';
/* CLASSE SERVIÇO: RESPONSÁVEL POR ESTABELECER COMUNICAÇÃO COM O SERVIDOR */
@Injectable()
export class PagamentoService {
constructor(private http: Http) {}
public startSession (){
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
return this.http.get('http://www.suaApi.com.br/getIdSession', options)
.map(res => res.json());
}
public store (dados:Dados){
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
let body = JSON.stringify({ dados });
return this.http.post('http://www.suaApi.com.br/store', body, options)
.map(res => res.json());
}
public cancel (){
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
return this.http.get('http://www.suaApi.com.br/cancel', options)
.map(res => res.json());
}
}