-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from Adyen/terminalApiCloud
Terminal API (Cloud) support
- Loading branch information
Showing
11 changed files
with
366 additions
and
5 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
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
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
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,41 @@ | ||
<?php | ||
|
||
namespace Adyen\Service; | ||
|
||
class PosPayment extends \Adyen\Service | ||
{ | ||
|
||
protected $_runTenderSync; | ||
protected $_runTenderAsync; | ||
protected $_txType; | ||
|
||
public function __construct(\Adyen\Client $client) | ||
{ | ||
parent::__construct($client); | ||
|
||
$this->_runTenderSync = new \Adyen\Service\ResourceModel\Payment\TerminalCloudAPI($this, false); | ||
$this->_runTenderAsync = new \Adyen\Service\ResourceModel\Payment\TerminalCloudAPI($this, true); | ||
$this->_supportsXAPIKey = true; | ||
} | ||
|
||
public function runTenderSync($params) | ||
{ | ||
$result = $this->_runTenderSync->request($params); | ||
return $result; | ||
} | ||
|
||
public function runTenderAsync($params) | ||
{ | ||
$result = $this->_runTenderAsync->request($params); | ||
return $result; | ||
} | ||
|
||
public function getServiceId($request) | ||
{ | ||
if (isset($request['SaleToPOIRequest']['MessageHeader']['ServiceID'])) { | ||
return $request['SaleToPOIRequest']['MessageHeader']['ServiceID']; | ||
} | ||
return null; | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/Adyen/Service/ResourceModel/Payment/TerminalCloudAPI.php
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,31 @@ | ||
<?php | ||
|
||
namespace Adyen\Service\ResourceModel\Payment; | ||
|
||
class TerminalCloudAPI extends \Adyen\Service\AbstractResource | ||
{ | ||
|
||
protected $_requiredFields = array( | ||
'SaleToPOIRequest.MessageHeader.POIID', | ||
'SaleToPOIRequest.MessageHeader.ServiceID', | ||
//TODO fix: actually works with only first two levels | ||
'SaleToPOIRequest.PaymentRequest.SaleData.SaleTransactionID.TransactionID', //reference | ||
'SaleToPOIRequest.PaymentRequest.PaymentTransaction.AmountsReq.Currency', | ||
'SaleToPOIRequest.PaymentRequest.PaymentTransaction.AmountsReq.RequestedAmount', | ||
//PaymentData is optional, if not provided it will perform an authorisation(no refunds) | ||
'SaleToPOIRequest.PaymentRequest.PaymentData.PaymentType', | ||
); | ||
|
||
protected $_endpoint; | ||
|
||
public function __construct($service, $asynchronous) | ||
{ | ||
if ($asynchronous) { | ||
$this->_endpoint = $service->getClient()->getConfig()->get('endpointTerminalCloud') . '/async'; | ||
} else { | ||
$this->_endpoint = $service->getClient()->getConfig()->get('endpointTerminalCloud') . '/sync'; | ||
} | ||
parent::__construct($service, $this->_endpoint, $this->_requiredFields); | ||
} | ||
|
||
} |
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,12 @@ | ||
<?php | ||
|
||
|
||
namespace Adyen; | ||
|
||
|
||
class TransactionType | ||
{ | ||
const NORMAL = 'Normal'; | ||
const REFUND = 'Refund'; | ||
|
||
} |
Oops, something went wrong.