Beispiel #1
0
 /**
  * Pass
  */
 public function testPass()
 {
     $this->pass->setWebServiceURL('http://example.com')->setForegroundColor('rgb(0, 255, 0)')->setBackgroundColor('rgb(0, 255, 0)')->setLabelColor('rgb(0, 255, 0)')->setAuthenticationToken('123')->setType('generic')->setSuppressStripShine(false)->setAppLaunchURL('http://app.launch.url')->addAssociatedStoreIdentifier(123);
     $properties = array('webServiceURL', 'foregroundColor', 'backgroundColor', 'labelColor', 'authenticationToken', 'suppressStripShine', 'associatedStoreIdentifiers', 'appLaunchURL');
     $array = $this->pass->toArray();
     foreach ($properties as $property) {
         $this->assertTrue(isset($array[$property]));
     }
 }
 public function testPassAssociatedStoreIdentifiers()
 {
     $this->assertPasses($this->pass, PassValidator::ASSOCIATED_STORE_IDENTIFIER_INVALID);
     $this->pass->setAppLaunchURL('url');
     $this->assertFails($this->pass, PassValidator::ASSOCIATED_STORE_IDENTIFIER_REQUIRED);
     $this->pass->addAssociatedStoreIdentifier(123);
     $this->assertPasses($this->pass, PassValidator::ASSOCIATED_STORE_IDENTIFIER_INVALID);
     $this->pass->addAssociatedStoreIdentifier('not an integer');
     $this->assertFails($this->pass, PassValidator::ASSOCIATED_STORE_IDENTIFIER_INVALID);
 }
$obj4->addBarCode("GE001RWM8A");
$obj4->genericPass_addHeaderInfo("ID", "040");
$obj4->genericPass_addMemberInfo("Name", "John");
$obj4->genericPass_addInfo("Member Since", "2009");
$obj4->genericPass_addInfo("LEVEL", "SILVER");
$obj4->genericPass_addInfo("Expiry", "June 2014");
$obj4->addIcon("/var/www/images/generic/icon.png");
$obj4->addIconHD("/var/www/images/generic/icon@2x.png");
$obj4->addLogo("/var/www/images/generic/logo.png");
$obj4->addLogoHD("/var/www/images/generic/logo@2x.png");
$obj4->addThumbnail("/var/www/images/generic/thumbnail.png");
$obj4->addThumbnail_hd("/var/www/images/generic/thumbnail@2x.png");
$obj4->addBackScreenInfo("Copyrights", "All rights reserved Town Club");
if ($obj4->generatePass("/var/www/passbook/test/", "GenericPass")) {
    echo "<br> Your Pass has been generated. Now sign the pass by using following <a href='https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/Chapters/Introduction.html'>link</a>";
}
// Create Store Card pass
$obj5 = new ApplePass(STORE_CARD, "YOUR PASS IDENTIFIER", "YOUR TEAM IDENTIFIER", "ABC Organization", "Store card for ABC Organization", "ABC Corp.", "rgb(112, 45, 22)", "rgb(22, 200, 15)");
$obj5->addBarCode("G3E1R0092A");
$obj5->storePass_addHeaderInfo("No", "AS34");
$obj5->storePass_addBalance("Balance", 19.45, "USD");
$obj5->storePass_addInfo("Deal of the Day", "Oranges");
$obj5->addIcon("/var/www/images/store/icon.png");
$obj5->addIconHD("/var/www/images/store/icon@2x.png");
$obj5->addLogo("/var/www/images/store/logo.png");
$obj5->addStrip("/var/www/images/store/strip.png");
$obj5->addStrip_hd("/var/www/images/store/strip@2x.png");
$obj5->addBackScreenInfo("Copyrights", "All rights reserved ABC Organization");
if ($obj5->generatePass("/var/www/passbook/test/", "StoreCard")) {
    echo "<br> Your Pass has been generated. Now sign the pass by using following <a href='https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/Chapters/Introduction.html'>link</a>";
}
 public function testRequiredInformationInPassNotOverwrittenByFactory()
 {
     $passOrganizationName = 'organization name in pass';
     $passTeamIdentifier = 'team identifier in pass';
     $passPassTypeIdentifier = 'pass type identifier in pass';
     $pass = new Pass('serial number', 'description');
     $pass->setOrganizationName($passOrganizationName);
     $pass->setTeamIdentifier($passTeamIdentifier);
     $pass->setPassTypeIdentifier($passPassTypeIdentifier);
     $this->factory->setOutputPath('/tmp');
     $this->factory->setOverwrite(true);
     $this->factory->setSkipSignature(true);
     $this->factory->package($pass);
     self::assertEquals($passOrganizationName, $pass->getOrganizationName());
     self::assertEquals($passTeamIdentifier, $pass->getTeamIdentifier());
     self::assertEquals($passPassTypeIdentifier, $pass->getPassTypeIdentifier());
 }
Beispiel #5
0
 public function toArray()
 {
     $array = parent::toArray();
     $array[$this->getType()]['transitType'] = $this->transitType;
     return $array;
 }
 private function validateAssociatedStoreIdentifiers(Pass $pass)
 {
     //appLaunchURL
     $associatedStoreIdentifiers = $pass->getAssociatedStoreIdentifiers();
     if (null !== $pass->getAppLaunchURL() && count($associatedStoreIdentifiers) == 0) {
         $this->addError(self::ASSOCIATED_STORE_IDENTIFIER_REQUIRED);
     }
     foreach ($associatedStoreIdentifiers as $associatedStoreIdentifier) {
         if (!is_int($associatedStoreIdentifier)) {
             $this->addError(self::ASSOCIATED_STORE_IDENTIFIER_INVALID);
             return;
         }
     }
 }