@@ -22,6 +22,18 @@ class Balances implements \JsonSerializable
2222 */
2323 protected $ vouchers ;
2424
25+ /**
26+ * Available balance of the customer
27+ * @var object
28+ */
29+ protected $ availableBalance ;
30+
31+ /**
32+ * Customer action to be performed, such as redirecting to a URL
33+ * @var object
34+ */
35+ protected $ customerAction ;
36+
2537 /**
2638 * Balances constructor
2739 * @param ProcessOut\ProcessOut $client
@@ -69,6 +81,64 @@ public function setVouchers($value)
6981 return $ this ;
7082 }
7183
84+ /**
85+ * Get AvailableBalance
86+ * Available balance of the customer
87+ * @return object
88+ */
89+ public function getAvailableBalance ()
90+ {
91+ return $ this ->availableBalance ;
92+ }
93+
94+ /**
95+ * Set AvailableBalance
96+ * Available balance of the customer
97+ * @param object $value
98+ * @return $this
99+ */
100+ public function setAvailableBalance ($ value )
101+ {
102+ if (is_object ($ value ))
103+ $ this ->availableBalance = $ value ;
104+ else
105+ {
106+ $ obj = new Balance ($ this ->client );
107+ $ obj ->fillWithData ($ value );
108+ $ this ->availableBalance = $ obj ;
109+ }
110+ return $ this ;
111+ }
112+
113+ /**
114+ * Get CustomerAction
115+ * Customer action to be performed, such as redirecting to a URL
116+ * @return object
117+ */
118+ public function getCustomerAction ()
119+ {
120+ return $ this ->customerAction ;
121+ }
122+
123+ /**
124+ * Set CustomerAction
125+ * Customer action to be performed, such as redirecting to a URL
126+ * @param object $value
127+ * @return $this
128+ */
129+ public function setCustomerAction ($ value )
130+ {
131+ if (is_object ($ value ))
132+ $ this ->customerAction = $ value ;
133+ else
134+ {
135+ $ obj = new BalancesCustomerAction ($ this ->client );
136+ $ obj ->fillWithData ($ value );
137+ $ this ->customerAction = $ obj ;
138+ }
139+ return $ this ;
140+ }
141+
72142
73143 /**
74144 * Fills the current object with the new values pulled from the data
@@ -80,6 +150,12 @@ public function fillWithData($data)
80150 if (! empty ($ data ['vouchers ' ]))
81151 $ this ->setVouchers ($ data ['vouchers ' ]);
82152
153+ if (! empty ($ data ['available_balance ' ]))
154+ $ this ->setAvailableBalance ($ data ['available_balance ' ]);
155+
156+ if (! empty ($ data ['customer_action ' ]))
157+ $ this ->setCustomerAction ($ data ['customer_action ' ]);
158+
83159 return $ this ;
84160 }
85161
@@ -90,6 +166,8 @@ public function fillWithData($data)
90166 public function jsonSerialize () {
91167 return array (
92168 "vouchers " => $ this ->getVouchers (),
169+ "available_balance " => $ this ->getAvailableBalance (),
170+ "customer_action " => $ this ->getCustomerAction (),
93171 );
94172 }
95173
@@ -117,9 +195,11 @@ public function find($tokenId, $options = array())
117195
118196 // Handling for field balances
119197 $ body = $ response ->getBody ();
120- $ body = $ body ['balances ' ];
121- $ balances = new Balances ($ this ->client );
122- $ returnValues ['balances ' ] = $ balances ->fillWithData ($ body );
198+ if (isset ($ body ['balances ' ])) {
199+ $ body = $ body ['balances ' ];
200+ $ balances = new Balances ($ this ->client );
201+ $ returnValues ['balances ' ] = $ balances ->fillWithData ($ body );
202+ }
123203
124204
125205 return array_values ($ returnValues )[0 ];
0 commit comments