-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CORE-258] Refactor CSE SDK implementation for 3dsv2
- Loading branch information
1 parent
b90e1cf
commit 482dbb4
Showing
6 changed files
with
223 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
namespace Paynl\Api\Creditcard; | ||
|
||
use Paynl\Api\Api; | ||
|
||
/** | ||
* Encrypted transaction | ||
* | ||
* @author Michael Roterman <[email protected]> | ||
*/ | ||
abstract class AbstractCseRequest extends Api | ||
{ | ||
private $orderId; | ||
private $payload; | ||
private $threeDSTransactionId; | ||
|
||
/** | ||
* @var int the version of the api | ||
*/ | ||
protected $version = 2; | ||
|
||
/** | ||
* @var bool Is the ApiToken required for this API | ||
*/ | ||
protected $apiTokenRequired = true; | ||
|
||
public function getData() | ||
{ | ||
return array_merge(parent::getData(), array( | ||
'orderId' => $this->getOrderId(), | ||
'threeDSTransactionId' => $this->getThreeDSTransactionId(), | ||
'payload' => $this->getPayload() | ||
)); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getOrderId() | ||
{ | ||
return $this->orderId; | ||
} | ||
|
||
/** | ||
* @param string $orderId | ||
*/ | ||
public function setOrderId($orderId) | ||
{ | ||
$this->orderId = $orderId; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getPayload() | ||
{ | ||
return $this->payload; | ||
} | ||
|
||
/** | ||
* @param string $payload | ||
*/ | ||
public function setPayload($payload) | ||
{ | ||
$this->payload = $payload; | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getThreeDSTransactionId() | ||
{ | ||
return $this->threeDSTransactionId; | ||
} | ||
|
||
/** | ||
* @param string|null $threeDSTransactionId | ||
*/ | ||
public function setThreeDSTransactionId($threeDSTransactionId) | ||
{ | ||
$this->threeDSTransactionId = $threeDSTransactionId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Paynl\Api\Creditcard; | ||
|
||
use Paynl\Api\Api; | ||
|
||
/** | ||
* Encrypted transaction | ||
* | ||
* @author Michael Roterman <[email protected]> | ||
*/ | ||
class CseAuthenticate extends AbstractCseRequest | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function doRequest($endpoint = null, $version = null) | ||
{ | ||
return parent::doRequest('creditcard/cseAuthenticate'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Paynl\Api\Creditcard; | ||
|
||
use Paynl\Api\Api; | ||
|
||
/** | ||
* Encrypted transaction | ||
* | ||
* @author Michael Roterman <[email protected]> | ||
*/ | ||
class CseAuthorize extends AbstractCseRequest | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function doRequest($endpoint = null, $version = null) | ||
{ | ||
return parent::doRequest('creditcard/cseAuthorize'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,61 +9,49 @@ | |
* | ||
* @author Michael Roterman <[email protected]> | ||
*/ | ||
class EncryptedTransaction extends Api | ||
class CseTdsStatus extends Api | ||
{ | ||
private $transactionId; | ||
private $payload; | ||
|
||
/** | ||
* @var int the version of the api | ||
*/ | ||
protected $version = 2; | ||
|
||
public function getData() | ||
{ | ||
return array_merge(parent::getData(), array( | ||
'transactionId' => $this->transactionId, | ||
'payload' => $this->payload | ||
)); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
* @var string | ||
*/ | ||
public function getTransactionId() | ||
{ | ||
return $this->transactionId; | ||
} | ||
|
||
private $transactionId; | ||
|
||
/** | ||
* @param mixed $transactionId | ||
* @inheritdoc | ||
*/ | ||
public function setTransactionId($transactionId) | ||
public function doRequest($endpoint = null, $version = null) | ||
{ | ||
$this->transactionId = $transactionId; | ||
return parent::doRequest('creditcard/cseTdsStatus'); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
* {@inheritDoc} | ||
*/ | ||
public function getPayload() | ||
public function getData() | ||
{ | ||
return $this->payload; | ||
return array_merge(parent::getData(), array( | ||
'transactionId' => $this->transactionId | ||
)); | ||
} | ||
|
||
/** | ||
* @param mixed $payload | ||
* @return string | ||
*/ | ||
public function setPayload($payload) | ||
public function getTransactionId() | ||
{ | ||
$this->payload = $payload; | ||
return $this->transactionId; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
* @param string $transactionId | ||
*/ | ||
public function doRequest($endpoint = null, $version = null) | ||
public function setTransactionId($transactionId) | ||
{ | ||
return parent::doRequest('creditcard/captureWithEncryptedData'); | ||
$this->transactionId = $transactionId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters