public function __construct($data) { $this->_data = $data; if (isset($data['card'])) { $this->_card = QuickBooks_Payments_CreditCard::fromArray($data['card']); } }
public function getCards($Context, $id) { $id = str_replace(array('{', '}', '-'), '', $id); $url = str_replace('<id>', $id, QuickBooks_Payments::URL_CARD); print "Trying to get gards for: " . $url . "\n"; $resp = $this->_http($Context, $url, null); print "Request: "; print_r($this->_last_request); print "Response: "; print_r($this->_last_response); // error_log($resp); $data = json_decode($resp, true); if ($this->_handleError($data)) { return false; } $list = array(); foreach ($data as $card) { // How do I stuff this into $creditcard = new QuickBooks_Payments_CreditCard(); $list[] = $creditcard->fromArray($card); } print_r($list); return $list; }