-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisbursement.php
52 lines (44 loc) · 1.4 KB
/
Disbursement.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace Braintree;
class Disbursement extends Base
{
private $_merchantAccount;
protected function _initialize($disbursementAttribs)
{
$this->_attributes = $disbursementAttribs;
$this->merchantAccountDetails = $disbursementAttribs['merchantAccount'];
if (isset($disbursementAttribs['merchantAccount'])) {
$this->_set('merchantAccount',
MerchantAccount::factory($disbursementAttribs['merchantAccount'])
);
}
}
public function transactions()
{
$collection = Transaction::search([
TransactionSearch::ids()->in($this->transactionIds),
]);
return $collection;
}
public static function factory($attributes)
{
$instance = new self();
$instance->_initialize($attributes);
return $instance;
}
public function __toString()
{
$display = [
'id', 'merchantAccountDetails', 'exceptionMessage', 'amount',
'disbursementDate', 'followUpAction', 'retry', 'success',
'transactionIds'
];
$displayAttributes = [];
foreach ($display AS $attrib) {
$displayAttributes[$attrib] = $this->$attrib;
}
return __CLASS__ . '[' .
Util::attributesToString($displayAttributes) .']';
}
}
class_alias('Braintree\Disbursement', 'Braintree_Disbursement');