Skip to content

Commit

Permalink
Proper type comparison in pingback
Browse files Browse the repository at this point in the history
  • Loading branch information
Paymentwall Team committed Jan 17, 2014
2 parents 616c9ec + 7c370b1 commit 6067d61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 5 additions & 3 deletions lib/Paymentwall/Pingback.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public function validate($skipIpWhitelistCheck = false)
*/
public function isSignatureValid()
{
$signatureParamsToSign = array();

if (self::getApiType() == self::API_VC) {

$signatureParams = array('uid', 'currency', 'type', 'ref');
Expand Down Expand Up @@ -177,7 +179,7 @@ public function getType()

if (!empty($this->parameters['type'])) {
if (in_array($this->parameters['type'], $pingbackTypes)) {
return $this->parameters['type'];
return intval($this->parameters['type']);
}
}
}
Expand Down Expand Up @@ -288,7 +290,7 @@ public function getPingbackUniqueId()
*/
public function isDeliverable()
{
return ($this->getType() == self::PINGBACK_TYPE_REGULAR || $this->getType() == self::PINGBACK_TYPE_GOODWILL);
return ($this->getType() === self::PINGBACK_TYPE_REGULAR || $this->getType() === self::PINGBACK_TYPE_GOODWILL);
}

/**
Expand All @@ -298,7 +300,7 @@ public function isDeliverable()
*/
public function isCancelable()
{
return $this->getType() == self::PINGBACK_TYPE_NEGATIVE;
return $this->getType() === self::PINGBACK_TYPE_NEGATIVE;
}

/**
Expand Down
8 changes: 3 additions & 5 deletions lib/Paymentwall/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ public function __construct($productId, $amount = 0.0, $currencyCode = null, $na
$this->productType = $productType;
$this->periodLength = $periodLength;
$this->periodType = $periodType;
$this->reccuring = $recurring;
if ($productType == Paymentwall_Product::TYPE_SUBSCRIPTION && $recurring) {
$this->trialProduct = $trialProduct;
}
$this->recurring = $recurring;
$this->trialProduct = ($productType == Paymentwall_Product::TYPE_SUBSCRIPTION && $recurring) ? $trialProduct : null;
}

/**
Expand Down Expand Up @@ -103,7 +101,7 @@ public function getPeriodLength()
*/
public function isRecurring()
{
return $this->reccuring;
return $this->recurring;
}

/**
Expand Down

0 comments on commit 6067d61

Please sign in to comment.