Skip to content

Commit

Permalink
renamed some variables in the instore confirmPayment Api
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Pieters committed Dec 23, 2015
1 parent 80e995e commit 9738c0f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
8 changes: 4 additions & 4 deletions samples/instore/confirmPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab');

$hash = $_GET['hash']; //The hash you get from instore/payment
$email = $_GET['email'];
$language = $_GET['language'];
$emailAddress = @$_GET['emailAddress'];
$languageId = @$_GET['languageId'];

$result = \Paynl\Instore::confirmPayment(array(
'hash' => $hash,
'email' => $email,
'language' => $language
'emailAddress' => $emailAddress,
'languageId' => $languageId
));

var_dump($result->getData());
24 changes: 12 additions & 12 deletions src/Api/Instore/ConfirmPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ConfirmPayment extends Instore
/**
* @var string The email address of the end-user
*/
protected $email;
protected $emailAddress;

/**
* @param string $hash
Expand All @@ -45,25 +45,25 @@ public function setHash($hash)
}

/**
* @param string $email
* @param string $emailAddress
*/
public function setEmail($email)
public function setEmailAddress($emailAddress)
{
$this->email = $email;
$this->emailAddress = $emailAddress;
}

/**
* @param int $language
* @param int $languageId
*/
public function setLanguage($language)
public function setLanguageId($languageId)
{
$this->language = (int)$language;
$this->languageId = (int)$languageId;
}

/**
* @var int The language of the email sent
*/
protected $language;
protected $languageId;

/**
* @return array The data
Expand All @@ -76,11 +76,11 @@ protected function getData()
}
$this->data['hash'] = $this->hash;

if (!empty($this->email)) {
$this->data['email'] = $this->email;
if (!empty($this->emailAddress)) {
$this->data['emailAddress'] = $this->emailAddress;
}
if (!empty($this->language)) {
$this->data['language'] = $this->language;
if (!empty($this->languageId)) {
$this->data['languageId'] = $this->languageId;
}

return parent::getData();
Expand Down
13 changes: 7 additions & 6 deletions src/Instore.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public static function payment($options)
* Confirm the payment, and send the receipt
*
* ['hash'] string the hash of the transaction
* ['email'] string the emailaddress to send the receipt to
* ['language'] int the languageId
* ['emailAddress'] string the emailaddress to send the receipt to
* ['languageId'] int the languageId
* 1. Dutch
* 2. Flemish
* 4. English
Expand All @@ -98,6 +98,7 @@ public static function payment($options)
* 9. Italian
*
* @param array $options (See above)
* @return Result\ConfirmPayment
*/
public static function confirmPayment($options)
{
Expand All @@ -106,11 +107,11 @@ public static function confirmPayment($options)
if (isset($options['hash'])) {
$api->setHash($options['hash']);
}
if (isset($options['email'])) {
$api->setEmail($options['email']);
if (isset($options['emailAddress'])) {
$api->setEmailAddress($options['emailAddress']);
}
if (isset($options['language'])) {
$api->setLanguage($options['language']);
if (isset($options['languageId'])) {
$api->setLanguageId($options['languageId']);
}

$result = $api->doRequest();
Expand Down

0 comments on commit 9738c0f

Please sign in to comment.