1: | <?php |
2: | namespace Hyperwallet\Model; |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | class WebhookNotification extends BaseModel { |
14: | |
15: | |
16: | |
17: | |
18: | |
19: | |
20: | private $object; |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | |
28: | |
29: | private static $READ_ONLY_FIELDS = array('token', 'type', 'createdOn'); |
30: | |
31: | public static function FILTERS_ARRAY() { |
32: | return array('programToken', 'type', 'createdBefore', 'createdAfter', 'sortBy', 'limit'); |
33: | } |
34: | |
35: | |
36: | |
37: | |
38: | |
39: | |
40: | public function __construct(array $properties = array()) { |
41: | parent::__construct(self::$READ_ONLY_FIELDS, $properties); |
42: | |
43: | $this->object = null; |
44: | if (isset($properties['type'])) { |
45: | if (strpos($properties['type'], 'USERS.BANK_ACCOUNTS') === 0) { |
46: | $this->object = new BankAccount($properties['object']); |
47: | } else if (strpos($properties['type'], 'USERS.PREPAID_CARDS') === 0) { |
48: | $this->object = new PrepaidCard($properties['object']); |
49: | } else if (strpos($properties['type'], 'USERS.PAYPAL_ACCOUNTS') === 0) { |
50: | $this->object = new PayPalAccount($properties['object']); |
51: | } else if (strpos($properties['type'], 'USERS.VENMO_ACCOUNTS') === 0) { |
52: | $this->object = new VenmoAccount($properties['object']); |
53: | } else if (strpos($properties['type'], 'USERS.BANK_CARDS') === 0) { |
54: | $this->object = new BankCard($properties['object']); |
55: | } else if (strpos($properties['type'], 'USERS.BUSINESS_STAKEHOLDERS') === 0) { |
56: | $this->object = new BusinessStakeholder($properties['object']); |
57: | } else if (strpos($properties['type'], 'USERS.PAPER_CHECKS') === 0) { |
58: | $this->object = new PaperCheck($properties['object']); |
59: | } else if (strpos($properties['type'], 'USERS') === 0) { |
60: | $this->object = new User($properties['object']); |
61: | } else if (strpos($properties['type'], 'PAYMENTS') === 0) { |
62: | $this->object = new Payment($properties['object']); |
63: | } else if (strpos($properties['type'], 'TRANSFERS.REFUND') === 0) { |
64: | $this->object = new TransferRefund($properties['object']); |
65: | } else if (strpos($properties['type'], 'TRANSFERS') === 0) { |
66: | $this->object = new Transfer($properties['object']); |
67: | } |
68: | } |
69: | } |
70: | |
71: | |
72: | |
73: | |
74: | |
75: | |
76: | public function getToken() { |
77: | return $this->token; |
78: | } |
79: | |
80: | |
81: | |
82: | |
83: | |
84: | |
85: | public function getType() { |
86: | return $this->type; |
87: | } |
88: | |
89: | |
90: | |
91: | |
92: | |
93: | |
94: | public function getCreatedOn() { |
95: | return $this->createdOn ? new \DateTime($this->createdOn) : null; |
96: | } |
97: | |
98: | |
99: | |
100: | |
101: | |
102: | |
103: | public function getObject() { |
104: | return $this->object; |
105: | } |
106: | |
107: | } |
108: | |