From c7433ad07e0323e51bb4170680864862774be0eb Mon Sep 17 00:00:00 2001 From: Andy Pieters Date: Tue, 13 Sep 2016 13:48:52 +0200 Subject: [PATCH] Added transferType and transferValue --- .gitignore | 6 +++--- samples/transaction/start.php | 9 ++++++++- src/Api/Transaction/Start.php | 24 ++++++++++++++++++++++++ src/Transaction.php | 8 ++++++++ 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9899abcc..3b9ba49e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ nbproject/* -index.php -vendor/* composer.lock -.idea/* \ No newline at end of file +samples/config.php +.idea/ +vendor/ diff --git a/samples/transaction/start.php b/samples/transaction/start.php index 738b92ae..bc7d143b 100644 --- a/samples/transaction/start.php +++ b/samples/transaction/start.php @@ -22,7 +22,7 @@ try { $result = \Paynl\Transaction::start(array( // required - 'amount' => 10, + 'amount' => 0.1, 'returnUrl' => dirname(Paynl\Helper::getBaseUrl()) . '/return.php', // optional @@ -80,6 +80,13 @@ 'city' => 'ITest', 'country' => 'NL', ), + + // Only use this if you are told to +// 'transferType' => 'merchant', +// 'transferValue' => 'M-0123-4567', // the merchantCode +// +// 'transferType' => 'transaction', +// 'transferValue' => '12345678X260bc5', // The transactionId )); // Save this transactionid and link it to your order diff --git a/src/Api/Transaction/Start.php b/src/Api/Transaction/Start.php index cc5ceeba..4cadff2e 100644 --- a/src/Api/Transaction/Start.php +++ b/src/Api/Transaction/Start.php @@ -105,6 +105,14 @@ class Start extends Transaction * @var string additional data transferData */ private $_transferData; + /** + * @var string + */ + private $_transferType; + /** + * @var string + */ + private $_transferValue; /** * @var string the ipaddress of the enduser, used for fraud detecion */ @@ -189,6 +197,15 @@ public function setTransferData($transferData) $this->_transferData = $transferData; } + public function setTransferType($transferType){ + $this->_transferType = $transferType; + } + + public function setTransferValue($transferValue){ + $this->_transferValue = $transferValue; + } + + /** * Add a product to an order * Attention! This is purely an adminstrative option, the amount of the order is not modified. @@ -449,6 +466,13 @@ protected function getData() $data['statsData']['transferData'] = $this->_transferData; } + if(!empty($this->_transferType)){ + $data['transferType'] = $this->_transferType; + } + if(!empty($this->_transferValue)){ + $data['transferValue'] = $this->_transferValue; + } + $this->data = array_merge($data, $this->data); return parent::getData(); diff --git a/src/Transaction.php b/src/Transaction.php index b6acf919..5ef74b35 100644 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -176,6 +176,14 @@ public static function start($options = array()) $api->setEnduser($enduser); } + if(isset($options['transferType'])){ + $api->setTransferType($options['transferType']); + } + + if(isset($options['transferValue'])){ + $api->setTransferValue($options['transferValue']); + } + $result = $api->doRequest(); return new Result\Start($result);