Skip to content

Commit

Permalink
Merge pull request #14 from ivodvb/status-methods
Browse files Browse the repository at this point in the history
Added some status determination methods
  • Loading branch information
andypieters committed Mar 3, 2016
2 parents 558086e + bd934fc commit 9fa6a79
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/Result/Transaction/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,40 @@ public function isCanceled()
return $this->data['paymentDetails']['state'] < 0;
}

/**
* @param bool|true $allowPartialRefunds
*
* @return bool
*/
public function isRefunded($allowPartialRefunds = true)
{
if ($this->data['paymentDetails']['state'] == 'REFUND') {
return true;
}

if ($allowPartialRefunds && $this->data['paymentDetails']['stateName'] == 'PARTIAL_REFUND') {
return true;
}

return false;
}

/**
* @return bool
*/
public function isPartiallyRefunded()
{
return $this->data['paymentDetails']['stateName'] == 'PARTIAL_REFUND';
}

/**
* @return bool
*/
public function isBeingVerified()
{
return $this->data['paymentDetails']['stateName'] == 'VERIFY';
}

/**
* @return float Paid amount in original currency
*/
Expand Down

0 comments on commit 9fa6a79

Please sign in to comment.