Skip to content

Commit

Permalink
Merge branch 'master' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasverraes committed Oct 13, 2011
2 parents 5c93d29 + 3cc2c10 commit 9535c60
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1.dev
1.0.2
2 changes: 1 addition & 1 deletion lib/Ogone/ParameterFilter/GeneralParameterFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function filter(array $parameters)
{
$parameters = array_change_key_case($parameters, CASE_UPPER);
array_walk($parameters, 'trim');
$parameters = array_filter($parameters, function($value){ return !is_null($value);});
$parameters = array_filter($parameters, function($value){ return (bool) strlen($value);});

return $parameters;
}
Expand Down
24 changes: 12 additions & 12 deletions lib/Ogone/PaymentResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
class PaymentResponse
{
/** @var string */
const SHASIGN_FIELD = 'shasign';
const SHASIGN_FIELD = 'SHASIGN';

/**
* Available Ogone parameters
* @var array
*/
private $ogoneFields = array('aavaddress', 'aavcheck', 'aavzip', 'acceptance', 'alias', 'amount', 'bin', 'brand', 'cardno', 'cccty', 'cn',
'complus', 'creation_status', 'currency', 'cvccheck', 'dcc_commpercentage', 'dcc_convamount', 'dcc_convccy', 'dcc_exchrate', 'dcc_exchratesource',
'dcc_exchratets', 'dcc_indicator', 'dcc_marginpercentage', 'dcc_validhours', 'digestcardno', 'eci', 'ed', 'enccardno', 'ip', 'ipcty',
'nbremailusage','nbripusage', 'nbripusage_alltx', 'nbrusage', 'ncerror', 'orderid', 'payid', 'pm', 'sco_category', 'scoring', 'status',
'subscription_id', 'trxdate','vc');
private $ogoneFields = array('AAVADDRESS', 'AAVCHECK', 'AAVZIP', 'ACCEPTANCE', 'ALIAS', 'AMOUNT', 'BIN', 'BRAND', 'CARDNO', 'CCCTY', 'CN',
'COMPLUS', 'CREATION_STATUS', 'CURRENCY', 'CVCCHECK', 'DCC_COMMPERCENTAGE', 'DCC_CONVAMOUNT', 'DCC_CONVCCY', 'DCC_EXCHRATE', 'DCC_EXCHRATESOURCE',
'DCC_EXCHRATETS', 'DCC_INDICATOR', 'DCC_MARGINPERCENTAGE', 'DCC_VALIDHOURS', 'DIGESTCARDNO', 'ECI', 'ED', 'ENCCARDNO', 'IP', 'IPCTY',
'NBREMAILUSAGE','NBRIPUSAGE', 'NBRIPUSAGE_ALLTX', 'NBRUSAGE', 'NCERROR', 'ORDERID', 'PAYID', 'PM', 'SCO_CATEGORY', 'SCORING', 'STATUS',
'SUBSCRIPTION_ID', 'TRXDATE','VC');

/**
* @var array
Expand All @@ -46,7 +46,7 @@ class PaymentResponse
public function __construct(array $httpRequest)
{
// use lowercase internally
$httpRequest = array_change_key_case($httpRequest, CASE_LOWER);
$httpRequest = array_change_key_case($httpRequest, CASE_UPPER);

// set sha sign
$this->shaSign = $this->extractShaSign($httpRequest);
Expand Down Expand Up @@ -98,8 +98,8 @@ public function getParam($key)
return $this->{'get'.$key}();
}

// always use lowercase internally
$key = strtolower($key);
// always use uppercase
$key = strtoupper($key);

if(!array_key_exists($key, $this->parameters)) {
throw new InvalidArgumentException('Parameter ' . $key . ' does not exist.');
Expand All @@ -110,17 +110,17 @@ public function getParam($key)

public function getAmount()
{
return $this->parameters['amount'] = (int) ($this->parameters['amount'] * 100);
return $this->parameters['AMOUNT'] = (int) ($this->parameters['AMOUNT'] * 100);
}

public function isSuccessful()
{
// @todo use constants
return in_array($this->getParam('status'), array(5, 9));
return in_array($this->getParam('STATUS'), array(5, 9));
}

public function toArray()
{
return $this->parameters + array('shasign' => $this->shaSign);
return $this->parameters + array('SHASIGN' => $this->shaSign);
}
}

0 comments on commit 9535c60

Please sign in to comment.