Skip to content

Commit b790cab

Browse files
zoldiatomaj
authored andcommitted
Added support for unRegisterCard comfortpay endpoint
1 parent e167073 commit b790cab

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

src/ComfortPay/Gateway.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ public function checkCard(array $parameters = array())
126126
return $this->createRequest(\Omnipay\ComfortPay\Message\CheckCardRequest::class, $parameters);
127127
}
128128

129+
public function unRegisterCard(array $parameters = array())
130+
{
131+
return $this->createRequest(\Omnipay\ComfortPay\Message\UnRegisterCardRequest::class, $parameters);
132+
}
133+
129134
public function listOfExpirePerId(array $parameters = array())
130135
{
131136
return $this->createRequest(\Omnipay\ComfortPay\Message\ListOfExpirePerIdRequest::class, $parameters);
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace Omnipay\ComfortPay\Message;
4+
5+
class UnRegisterCardRequest extends AbstractSoapRequest
6+
{
7+
public function getCardId()
8+
{
9+
return $this->getParameter('cardId');
10+
}
11+
12+
public function setCardId($value)
13+
{
14+
return $this->setParameter('cardId', $value);
15+
}
16+
17+
public function getData()
18+
{
19+
$this->validate('cardId');
20+
21+
$data = parent::getData();
22+
$data['cardId'] = $this->getCardId();
23+
return $data;
24+
}
25+
26+
public function sendData($data)
27+
{
28+
if ($this->getTestmode()) {
29+
if ((int) $data['cardId'] % 2 === 0) {
30+
return $this->response = new UnRegisterCardResponse($this, 0);
31+
}
32+
return $this->response = new UnRegisterCardResponse($this, 5);
33+
}
34+
35+
$request = new \stdClass();
36+
$request->idOfCard = $data['cardId'];
37+
38+
$client = $this->getSoapClient();
39+
$response = $client->unRegisterCard($request);
40+
41+
return $this->response = new UnRegisterCardResponse($this, $response);
42+
}
43+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Omnipay\ComfortPay\Message;
4+
5+
use Omnipay\Common\Message\AbstractResponse;
6+
use Omnipay\Common\Message\ResponseInterface;
7+
8+
class UnRegisterCardResponse extends AbstractResponse implements ResponseInterface
9+
{
10+
public function isSuccessful()
11+
{
12+
return (bool) $this->data;
13+
}
14+
}

0 commit comments

Comments
 (0)