Skip to content

Commit

Permalink
Added transferType and transferValue
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Pieters committed Sep 13, 2016
1 parent e976a2c commit c7433ad
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nbproject/*
index.php
vendor/*
composer.lock
.idea/*
samples/config.php
.idea/
vendor/
9 changes: 8 additions & 1 deletion samples/transaction/start.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
try {
$result = \Paynl\Transaction::start(array(
// required
'amount' => 10,
'amount' => 0.1,
'returnUrl' => dirname(Paynl\Helper::getBaseUrl()) . '/return.php',

// optional
Expand Down Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions src/Api/Transaction/Start.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 8 additions & 0 deletions src/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c7433ad

Please sign in to comment.