/** * {@inheritdoc} */ public function getCouponsForPassholder($uitpas_number, $consumer_key_counter = NULL, $max = NULL, $start = NULL) { $data = array(); $path = 'uitpas/passholder/' . $uitpas_number . '/coupons'; if ($consumer_key_counter) { $data['balieConsumerKey'] = $consumer_key_counter; } if ($max) { $data['max'] = $max; } if ($start) { $data['start'] = $start; } $result = $this->oauth_client->authenticatedGetAsXML($path, $data); try { $xml = new CultureFeed_SimpleXMLElement($result); } catch (Exception $e) { throw new CultureFeed_ParseException($result); } $coupons = array(); $objects = $xml->xpath('/ticketSaleCoupons/ticketSaleCoupon'); $total = count($objects); foreach ($objects as $object) { $coupons[] = CultureFeed_Uitpas_Event_TicketSale_Coupon::createFromXML($object); } return new CultureFeed_ResultSet($total, $coupons); }
public static function createFromXML(CultureFeed_SimpleXMLElement $object) { //dpm( print_r( $object , true ) ); $ticket_sale = new CultureFeed_Uitpas_Event_TicketSale(); $ticket_sale->id = $object->xpath_int('id'); $ticket_sale->nodeId = $object->xpath_str('nodeId'); $ticket_sale->nodeTitle = $object->xpath_str('nodeTitle'); $ticket_sale->creationDate = $object->xpath_time('creationDate'); $ticket_sale->createdVia = $object->xpath_str('createdVia'); $ticket_sale->price = $object->xpath_float('price'); $ticket_sale->tariff = $object->xpath_float('tariff'); $ticket_sale->firstName = $object->xpath_str('firstName'); $ticket_sale->lastName = $object->xpath_str('lastName'); $ticket_sale->userId = $object->xpath_str('userId'); $ticket_sale->userHomeCity = $object->xpath_str('userHomeCity'); $ticket_sale->dateOfBirth = $object->xpath_str('dateOfBirth'); $ticket_sale->uitpasNumber = $object->xpath_str('uitpasNumber'); $ticket_sale->status = $object->xpath_str('status'); $xmlTicketSaleCoupon = $object->xpath('ticketSaleCoupon', false); if ($xmlTicketSaleCoupon instanceof SimpleXMLElement) { $ticket_sale->ticketSaleCoupon = CultureFeed_Uitpas_Event_TicketSale_Coupon::createFromXML($xmlTicketSaleCoupon); } return $ticket_sale; }