Skip to content

Commit 8635c79

Browse files
authored
Merge pull request #22 from lcsLucas/master
feat: adiciona novas propriedades na Order e Transaction para consulta e redirect url
2 parents 4c395dd + 5a5bb09 commit 8635c79

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed

src/Ipag/Classes/Order.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ final class Order extends BaseResource implements Emptiable, ObjectSerializable
2525
*/
2626
private $callbackUrl;
2727

28+
/**
29+
* @var string
30+
*/
31+
private $redirectUrl;
32+
2833
/**
2934
* @var float
3035
*/
@@ -124,6 +129,14 @@ public function getCallbackUrl()
124129
return $this->callbackUrl;
125130
}
126131

132+
/**
133+
* @return string
134+
*/
135+
public function getRedirectUrl()
136+
{
137+
return $this->redirectUrl;
138+
}
139+
127140
/**
128141
* @return float
129142
*/
@@ -170,6 +183,16 @@ public function setCallbackUrl($callbackUrl)
170183
return $this;
171184
}
172185

186+
/**
187+
* @param string $redirectUrl
188+
*/
189+
public function setRedirectUrl($redirectUrl)
190+
{
191+
$this->redirectUrl = substr((string) $redirectUrl, 0, 255);
192+
193+
return $this;
194+
}
195+
173196
/**
174197
* @param float $amount
175198
*/
@@ -420,6 +443,7 @@ public function serialize()
420443
'pedido' => urlencode((string) $this->getOrderId()),
421444
'operacao' => urlencode((string) $this->getOperation()),
422445
'url_retorno' => urlencode((string) $this->getCallbackUrl()),
446+
'url_redirect' => urlencode((string) $this->getRedirectUrl()),
423447
'valor' => urlencode((string) $this->getAmount()),
424448
'parcelas' => urlencode((string) $this->getInstallments()),
425449
'vencto' => urlencode((string) $this->getExpiry()),

src/Ipag/Classes/Serializer/Serializer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function serialize()
3434
$response = [
3535
'identificacao' => urlencode((string) $this->transaction->getIpag()->getAuthentication()->getIdentification()),
3636
'transId' => urlencode((string) $this->transaction->getTid()),
37+
'numPedido' => urlencode((string) $this->transaction->getNumPedido()),
3738
'retorno_tipo' => urlencode('xml'),
3839
];
3940

src/Ipag/Classes/Services/TransactionResponseService.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ private function transaction(stdClass $response)
5454
$transaction->urlAuthentication = $this->getObjectUtil()->getProperty($response, 'url_autenticacao');
5555
$transaction->digitableLine = $this->getObjectUtil()->getProperty($response, 'linha_digitavel');
5656
$transaction->urlCallback = $this->getObjectUtil()->getProperty($response, 'url_retorno');
57+
$transaction->urlRedirect = $this->getObjectUtil()->getProperty($response, 'url_redirect');
5758
$transaction->createAt = $this->getObjectUtil()->getProperty($response, 'criado_em');
5859
$transaction->payment = $this->payment($response);
5960
$transaction->order = $this->order($response);

src/Ipag/Classes/Transaction.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ final class Transaction extends IpagResource
2121
*/
2222
private $tid;
2323

24+
/**
25+
* @var string
26+
*/
27+
private $numPedido;
28+
2429
public function __construct(Ipag $ipag)
2530
{
2631
parent::__construct($ipag);
@@ -45,6 +50,24 @@ public function setTid($tid)
4550
return $this;
4651
}
4752

53+
/**
54+
* @return string
55+
*/
56+
public function getNumPedido()
57+
{
58+
return $this->numPedido;
59+
}
60+
61+
/**
62+
* @param string $numPedido
63+
*/
64+
public function setNumPedido($numPedido)
65+
{
66+
$this->numPedido = $numPedido;
67+
68+
return $this;
69+
}
70+
4871
/**
4972
* @return Order
5073
*/

0 commit comments

Comments
 (0)