how to set transit type of Boarding Pass ?
Numerah opened this issue · comments
i Tried like hell to find how to set transit for boarding pass . i am almost done with my complete pass generation of any type i.e. Coupon ,Generic,Store Card,Boarding Pass, Event Ticket. almost set every property of every coupon. i saw this code in Boarding pass type
protected $transitType;
/**
- @var string
*/
const TYPE_AIR = 'PKTransitTypeAir';
/**
- @var string
*/
const TYPE_BOAT = 'PKTransitTypeBoat';
/**
- @var string
*/
const TYPE_BUS = 'PKTransitTypeBus';
/**
- @var string
*/
const TYPE_GENERIC = 'PKTransitTypeGeneric';
/**
- @var string
*/
const TYPE_TRAIN = 'PKTransitTypeTrain';
/**
- Class constructor
* - @param string $serialNumber
- @param string $description
- @param string $transitType
*/
public function __construct($serialNumber, $description, $transitType = self::TYPE_GENERIC)
{
// Required for boarding passes; otherwise not allowed
$this->transitType = $transitType;
// Call parent
parent::__construct($serialNumber, $description);
}
public function toArray()
{
$array = parent::toArray();
$array['transitType'] = $this->transitType;
return $array;
}
and i tried to set the pass configurations like every other
$pass = new BoardingPass("12345", "Template Name",'PKTransitTypeAir');
i also tried this
$pass = new BoardingPass("12345",'PKTransitTypeAir', "Template Name");
but no transit appear in my generated pass.
Hi there, sorry for the delay. It was one of those long weeks.. :)
Apparently it was a bug in BoardingPass
serialization. 79171b1 fixes the issue. It also fixes unit test.
Let me know if it gives any other problems.