Skip to content

Commit a83e70e

Browse files
committed
Adicionado campos para enviar ExternalAuthentication
1 parent d897547 commit a83e70e

File tree

2 files changed

+222
-0
lines changed

2 files changed

+222
-0
lines changed
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?php
2+
3+
namespace Cielo\API30\Ecommerce;
4+
5+
/**
6+
* Class ExternalAuthentication
7+
*
8+
* @package Cielo\API30\Ecommerce
9+
*/
10+
class ExternalAuthentication implements \JsonSerializable, CieloSerializable
11+
{
12+
13+
private $cavv;
14+
private $xid;
15+
private $eci;
16+
private $version;
17+
private $referenceId;
18+
19+
/** @var \stdClass $links */
20+
private $links;
21+
22+
/**
23+
* @param string $json
24+
*
25+
* @return ExternalAuthentication
26+
*/
27+
public static function fromJson($json)
28+
{
29+
$object = \json_decode($json);
30+
$auth = new ExternalAuthentication();
31+
$auth->populate($object);
32+
33+
return $auth;
34+
}
35+
36+
/**
37+
* @inheritdoc
38+
*/
39+
public function populate(\stdClass $data)
40+
{
41+
$this->cavv = isset($data->Cavv) ? $data->Cavv : null;
42+
$this->xid = isset($data->Xid) ? $data->Xid : null;
43+
$this->eci = isset($data->Eci) ? $data->Eci : null;
44+
$this->version = isset($data->Version) ? $data->Version : null;
45+
$this->referenceId = isset($data->ReferenceId) ? $data->ReferenceId : null;
46+
$this->links = isset($data->Links) ? $data->Links : new \stdClass();
47+
}
48+
49+
/**
50+
* @return array
51+
*/
52+
public function jsonSerialize()
53+
{
54+
return get_object_vars($this);
55+
}
56+
57+
/**
58+
* @return mixed
59+
*/
60+
public function getCavv()
61+
{
62+
return $this->cavv;
63+
}
64+
65+
/**
66+
* @param $cavv
67+
*
68+
* @return $this
69+
*/
70+
public function setCavv($cavv)
71+
{
72+
$this->cavv = $cavv;
73+
74+
return $this;
75+
}
76+
77+
/**
78+
* @return mixed
79+
*/
80+
public function getXid()
81+
{
82+
return $this->xid;
83+
}
84+
85+
/**
86+
* @param $xid
87+
*
88+
* @return $this
89+
*/
90+
public function setXid($xid)
91+
{
92+
$this->xid = $xid;
93+
94+
return $this;
95+
}
96+
97+
/**
98+
* @return mixed
99+
*/
100+
public function getEci()
101+
{
102+
return $this->eci;
103+
}
104+
105+
/**
106+
* @param $eci
107+
*
108+
* @return $this
109+
*/
110+
public function setEci($eci)
111+
{
112+
$this->eci = $eci;
113+
114+
return $this;
115+
}
116+
117+
/**
118+
* @return mixed
119+
*/
120+
public function getVersion()
121+
{
122+
return $this->version;
123+
}
124+
125+
/**
126+
* @param $version
127+
*
128+
* @return $this
129+
*/
130+
public function setVersion($version)
131+
{
132+
$this->version = $version;
133+
134+
return $this;
135+
}
136+
137+
/**
138+
* @return mixed
139+
*/
140+
public function getReferenceId()
141+
{
142+
return $this->referenceId;
143+
}
144+
145+
/**
146+
* @param $referenceId
147+
*
148+
* @return $this
149+
*/
150+
public function setReferenceId($referenceId)
151+
{
152+
$this->referenceId = $referenceId;
153+
154+
return $this;
155+
}
156+
157+
/**
158+
* @return \stdClass
159+
*/
160+
public function getLinks()
161+
{
162+
return $this->links;
163+
}
164+
165+
/**
166+
* @param \stdClass $links
167+
*/
168+
public function setLinks($links)
169+
{
170+
$this->links = $links;
171+
}
172+
}

src/Cielo/API30/Ecommerce/Payment.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class Payment implements \JsonSerializable
4242

4343
private $debitCard;
4444

45+
private $externalAuthentication;
46+
4547
private $authenticationUrl;
4648

4749
private $tid;
@@ -161,6 +163,11 @@ public function populate(\stdClass $data)
161163
$this->debitCard->populate($data->DebitCard);
162164
}
163165

166+
if (isset($data->ExternalAuthentication)) {
167+
$this->externalAuthentication = new ExternalAuthentication();
168+
$this->externalAuthentication->populate($data->ExternalAuthentication);
169+
}
170+
164171
$this->expirationDate = isset($data->ExpirationDate) ? $data->ExpirationDate : null;
165172
$this->url = isset($data->Url) ? $data->Url : null;
166173
$this->boletoNumber = isset($data->BoletoNumber) ? $data->BoletoNumber : null;
@@ -251,6 +258,29 @@ public function debitCard($securityCode, $brand)
251258
return $card;
252259
}
253260

261+
/**
262+
* @param type $cavv
263+
* @param type $xid
264+
* @param type $eci
265+
* @param type $version
266+
* @param type $referenceId
267+
*
268+
* @return ExternalAuthentication
269+
*/
270+
public function externalAuthentication($cavv, $xid, $eci, $version, $referenceId)
271+
{
272+
$auth = new ExternalAuthentication();
273+
$auth->setCavv($cavv);
274+
$auth->setXid($xid);
275+
$auth->setEci($eci);
276+
$auth->setVersion($version);
277+
$auth->setReferenceId($referenceId);
278+
279+
$this->setExternalAuthentication($auth);
280+
281+
return $auth;
282+
}
283+
254284
/**
255285
* @param bool $authorizeNow
256286
*
@@ -445,6 +475,26 @@ public function setDebitCard($debitCard)
445475
return $this;
446476
}
447477

478+
/**
479+
* @return mixed
480+
*/
481+
public function getExternalAuthentication()
482+
{
483+
return $this->externalAuthentication;
484+
}
485+
486+
/**
487+
* @param $externalAuthentication
488+
*
489+
* @return $this
490+
*/
491+
public function setExternalAuthentication($externalAuthentication)
492+
{
493+
$this->externalAuthentication = $externalAuthentication;
494+
495+
return $this;
496+
}
497+
448498
/**
449499
* @return mixed
450500
*/

0 commit comments

Comments
 (0)