-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.php
200 lines (185 loc) · 3.99 KB
/
index.php
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
/**
* @author Webjump Core Team <[email protected]>
* @copyright 2016 Webjump (http://www.webjump.com.br)
* @license http://www.webjump.com.br Copyright
*
* @link http://www.webjump.com.br
*
*/
require_once("vendor/autoload.php");
use Webjump\Braspag\Examples\DataRequest\Boleto;
use Webjump\Braspag\Examples\DataRequest\CreditCard;
use Webjump\Braspag\Examples\DataRequest\Actions;
use Webjump\Braspag\Examples\DataRequest\Debit;
use Webjump\Braspag\Pagador\Transaction\BraspagFacade;
$facade = new BraspagFacade();
function getData($response)
{
if (! is_object($response)) {
return '';
}
$result = [];
foreach (get_class_methods($response) as $method) {
if ($method === '__construct') {
continue;
}
$result[$method] = $response->$method();
}
return $result;
}
//##
//## Boleto
//##
//echo '<h1>Boleto</h1>';
//$data = new Boleto();
//$response = $facade->sendBoleto($data);
//
//if (is_object($response)) {
// echo "<a target='_blank' href='{$response->getPaymentUrl()}'>Gerar Boleto</a>";
// echo '<pre>';
// print_r($response);
// echo '</pre>';
//} else {
// echo '<pre>';
// print_r($response);
// echo '</pre>';
//
//}
//
//echo '<hr />';
##
## Cartão de Credito
##
echo '<h1>Cartão de Crédito</h1>';
$data = new CreditCard();
$response = $facade->sendCreditCard($data);
$paymentId = $response->getPaymentPaymentId();
$result = getData($response);
echo '<pre>';
print_r($result);
echo '</pre>';
echo '<hr />';
//
//
//##
//## Captura Cartão de Credito
//##
//echo '<h1>Captura Cartão de Crédito</h1>';
//$data = new Actions($paymentId);
//$response = $facade->captureCreditCard($data);
//$result = getData($response);
//echo '<pre>';
//print_r($result);
//echo '</pre>';
//
//echo '<hr />';
//
//
//
//##
//## Cartão de Débito
//##
//echo '<h1>Cartão de Débito</h1>';
//$data = new Debit();
//$response = $facade->sendDebit($data);
//$result = getData($response);
//echo '<pre>';
//print_r($result);
//echo '</pre>';;
//
//echo '<hr />';
//
//
//
//
//##
//## Consulta Cartao de Credito Autorizado
//##
//echo '<h1>Consulta Cartao de Credito Autorizado</h1>';
//$data = new Actions('b2ab14aa-4c47-46af-a880-a3b5314c0a8b');
//$response = $facade->checkPaymentStatus($data, 'creditCard');
//$result = getData($response);
//echo '<pre>';
//print_r($result);
//echo '</pre>';
//
//echo '<hr />';
//
//
//
//
//##
//## Consulta Cartao de Credito Capturado
//##
//echo '<h1>Consulta Cartao de Credito Capturado</h1>';
//$data = new Actions('df0bcef0-65d9-4bb2-abbd-48a3af6052e7');
//$response = $facade->checkPaymentStatus($data, 'creditCard');
//$result = getData($response);
//echo '<pre>';
//print_r($result);
//echo '</pre>';
//
//echo '<hr />';
//
//
//
//
//##
//## Consulta Cartao de Credito Capturado
//##
//echo '<h1>Consulta Boleto</h1>';
//$data = new Actions('662e9450-0fc7-464f-aeed-5a81643e717a');
//$response = $facade->checkPaymentStatus($data, 'boleto');
//$result = getData($response);
//echo '<pre>';
//print_r($result);
//echo '</pre>';
//
//echo '<hr />';
//
//
//##
//## Consulta Cartao de Credito Capturado
//##
//echo '<h1>Consulta Cartão de Debito</h1>';
//$data = new Actions('0cf3ae14-05bc-4fab-8161-5093aef67246');
//$response = $facade->checkPaymentStatus($data, 'debitCard');
//$result = getData($response);
//echo '<pre>';
//print_r($result);
//echo '</pre>';
//
//echo '<hr />';
//
//
//
//
//##
//## Cancelar Cartão de Credito Capturado
//##
//echo '<h1>Cancelar Cartão de Credito Capturado</h1>';
//$data = new Actions($paymentId);
//$response = $facade->voidPayment($data);
//$result = getData($response);
//echo '<pre>';
//print_r($result);
//echo '</pre>';
//
//echo '<hr />';
//
//
//
//
//##
//## Consulta Cartao de Credito Capturado
//##
//echo '<h1>Consulta Cartao de Credito Cancelado</h1>';
//$data = new Actions($paymentId);
//$response = $facade->checkPaymentStatus($data, 'creditCard');
//$result = getData($response);
//echo '<pre>';
//print_r($result);
//echo '</pre>';
//
//echo '<hr />';