Add get an individual payment

This commit is contained in:
Deon George 2023-05-13 21:58:49 +10:00
parent 2f75c7dd1f
commit dd82509008

View File

@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Intuit\Exceptions\{ConnectionIssueException,InvalidQueryResultException}; use Intuit\Exceptions\{ConnectionIssueException,InvalidQueryResultException};
use Intuit\Models\{ProviderToken}; use Intuit\Models\{ProviderToken,Payment};
use Intuit\Response\{Customer,Invoice,ListList}; use Intuit\Response\{Customer,Invoice,ListList};
final class API final class API
@ -289,6 +289,26 @@ final class API
return new ListList($this->execute('query',$parameters),$key); return new ListList($this->execute('query',$parameters),$key);
} }
/**
* Get a specific payment record
*
* @param int $id
* @param array $parameters
* @return Payment
* @throws \Exception
*/
public function getPayment(int $id,array $parameters=[]): Payment
{
Log::debug(sprintf('%s:Get a specific payment [%d]',static::LOGKEY,$id));
$x = $this->execute('payment/'.$id,$parameters);
if (! $x->Payment)
throw new InvalidQueryResultException(sprintf('%s:Query response malformed',self::LOGKEY));
return new Payment((array)$x->Payment);
}
/** /**
* Get a list of our payments * Get a list of our payments
* *