/**
  * Generates a Loyalty Class
  *
  * @param String $issuerId Wallet Object merchant account id.
  * @param String $classId Wallet Class that this wallet object references.
  * @return Object $wobClass Loyaltyclass resource.
  */
 public static function generateLoyaltyClass($issuerId, $classId)
 {
     // Used to select which templates to use for rendering in this section.
     $renderSpecs = array(array('templateFamily' => '1.loyalty_list', 'viewName' => 'g_list'), array('templateFamily' => '1.loyalty_expanded', 'viewName' => 'g_expanded'));
     // Define text module data.
     $textModulesData = array(array('header' => 'Rewards details', 'body' => 'Welcome to Baconrista rewards.  Enjoy your rewards for being a loyal customer. ' . '10 points for every dollar spent.  Redeem your points for free coffee, bacon and more!'));
     // Define links module data.
     $linksModuleData = new Google_Service_Walletobjects_LinksModuleData();
     $uris = array(array('uri' => 'http://maps.google.com/?q=google', 'kind' => 'walletobjecs#uri', 'description' => 'Nearby Locations'), array('uri' => 'tel:6505555555', 'kind' => 'walletobjecs#uri', 'description' => 'Call Customer Service'));
     $linksModuleData->setUris($uris);
     // Define info module data.
     $infoModuleData = new Google_Service_Walletobjects_InfoModuleData();
     $infoModuleData->setHexBackgroundColor('#442905');
     $infoModuleData->setHexFontColor('#F8EDC1');
     $uriModuleImageInstance = new Google_Service_Walletobjects_Uri();
     $uriModuleImageInstance->setUri('http://farm4.staticflickr.com/3738/12440799783_3dc3c20606_b.jpg');
     $uriModuleImageInstance->setDescription('Coffee beans');
     $imageModuleImageInstance = new Google_Service_Walletobjects_Image();
     $imageModuleImageInstance->setSourceUri($uriModuleImageInstance);
     $imagesModuleData = new Google_Service_Walletobjects_ImageModuleData();
     $imagesModuleData->setMainImage($imageModuleImageInstance);
     $imagesModuleDataArr = array($imagesModuleData);
     // Messages to be displayed to all users of Wallet Objects.
     $messages = array(array('actionUri' => array('kind' => 'walletobjects#uri', 'uri' => 'http://baconrista.com'), 'header' => 'Welcome to Banconrista Rewards!', 'body' => 'Featuring our new bacon donuts.', 'image' => array('kind' => 'walletobjects#image', 'sourceUri' => array('kind' => 'walletobjects#uri', 'uri' => 'http://farm8.staticflickr.com/7302/' . '11177240353_115daa5729_o.jpg')), 'kind' => 'walletobjects#walletObjectMessage'));
     $locations = array(array('kind' => 'walletobjects#latLongPoint', 'latitude' => 37.424015499999996, 'longitude' => -122.09259560000001), array('kind' => 'walletobjects#latLongPoint', 'latitude' => 37.424354, 'longitude' => -122.09508869999999), array('kind' => 'walletobjects#latLongPoint', 'latitude' => 37.7901435, 'longitude' => -122.39026709999997), array('kind' => 'walletobjects#latLongPoint', 'latitude' => 40.7406578, 'longitude' => -74.00208940000002));
     // Source uri of program logo.
     $uriInstance = new Google_Service_Walletobjects_Uri();
     $imageInstance = new Google_Service_Walletobjects_Image();
     $uriInstance->setUri('http://farm8.staticflickr.com/7340/11177041185_a61a7f2139_o.jpg');
     $imageInstance->setSourceUri($uriInstance);
     // Create wallet class.
     $wobClass = new Google_Service_Walletobjects_LoyaltyClass();
     $wobClass->setId($issuerId . '.' . $classId);
     $wobClass->setIssuerName('Baconrista');
     $wobClass->setProgramName('Baconrista Rewards');
     $wobClass->setProgramLogo($imageInstance);
     $wobClass->setRewardsTierLabel('Tier');
     $wobClass->setRewardsTier('Gold');
     $wobClass->setAccountNameLabel('Member Name');
     $wobClass->setAccountIdLabel('Member Id');
     $wobClass->setRenderSpecs($renderSpecs);
     $wobClass->setInfoModuleData($infoModuleData);
     $wobClass->setLinksModuleData($linksModuleData);
     $wobClass->setTextModulesData($textModulesData);
     $wobClass->setImageModulesData($imagesModuleDataArr);
     $wobClass->setMessages($messages);
     $wobClass->setReviewStatus('underReview');
     $wobClass->setAllowMultipleUsersPerObject(true);
     $wobClass->setLocations($locations);
     return $wobClass;
 }
Esempio n. 2
0
 /**
  * Create an example Offer Class
  *
  * @param String $issuerId Wallet Object merchant account id.
  * @param String $classId Wallet Class that this wallet object references.
  * @return Object $wobClass Offerclass resource.
  */
 public static function generateOfferClass($issuerId, $classId)
 {
     // Used to select which templates to use for rendering in this section.
     $renderSpecs = array(array('templateFamily' => '1.offer_list', 'viewName' => 'g_list'), array('templateFamily' => '1.offer_expanded', 'viewName' => 'g_expanded'));
     // A list of locations at which the Wallet Class can be used.
     $locations = array(array('kind' => 'walletobjects#latLongPoint', 'latitude' => 37.424015499999996, 'longitude' => -122.09259560000001), array('kind' => 'walletobjects#latLongPoint', 'latitude' => 37.424354, 'longitude' => -122.09508869999999), array('kind' => 'walletobjects#latLongPoint', 'latitude' => 37.7901435, 'longitude' => -122.39026709999997), array('kind' => 'walletobjects#latLongPoint', 'latitude' => 40.7406578, 'longitude' => -74.00208940000002));
     // Source uri of title image.
     $uriTitleImageInstance = new Google_Service_Walletobjects_Uri();
     $imageTitleImageInstance = new Google_Service_Walletobjects_Image();
     $uriTitleImageInstance->setUri('http://farm4.staticflickr.com/3723/11177041115_6e6a3b6f49_o.jpg');
     $imageTitleImageInstance->setSourceUri($uriTitleImageInstance);
     // Define text module data.
     $textModulesData = array(array('header' => 'Details', 'body' => '20% off one cup of coffee at all Baconrista Coffee locations. ' . 'Only one can be used per visit.'), array('header' => 'About Baconrista', 'body' => 'Since 2013, Baconrista Coffee has been committed to making high ' . 'quality bacon coffee. Visit us in our stores or online at www.baconrista.com'));
     // Define links module data.
     $linksModuleData = new Google_Service_Walletobjects_LinksModuleData();
     $uris = array(array('uri' => 'http://maps.google.com/?q=google', 'kind' => 'walletobjecs#uri', 'description' => 'Nearby Locations'), array('uri' => 'tel:6505555555', 'kind' => 'walletobjecs#uri', 'description' => 'Call Customer Service'));
     $linksModuleData->setUris($uris);
     $uriModuleImageInstance = new Google_Service_Walletobjects_Uri();
     $uriModuleImageInstance->setUri('http://farm8.staticflickr.com/7401/11177116434_d8e600bba6_o.jpg');
     $uriModuleImageInstance->setDescription('Coffee beans');
     $imageModuleImageInstance = new Google_Service_Walletobjects_Image();
     $imageModuleImageInstance->setSourceUri($uriModuleImageInstance);
     $imagesModuleData = new Google_Service_Walletobjects_ImageModuleData();
     $imagesModuleData->setMainImage($imageModuleImageInstance);
     $imagesModuleDataArr = array($imagesModuleData);
     // Create wallet class.
     $wobClass = new Google_Service_Walletobjects_OfferClass();
     $wobClass->setId($issuerId . '.' . $classId);
     $wobClass->setIssuerName('Baconrista Coffee');
     $wobClass->setTitle('20% off on one bacon fat latte');
     $wobClass->setProvider('Baconrista Deals');
     $wobClass->setTitleImage($imageTitleImageInstance);
     $wobClass->setRenderSpecs($renderSpecs);
     $wobClass->setLinksModuleData($linksModuleData);
     $wobClass->setTextModulesData($textModulesData);
     $wobClass->setImageModulesData($imagesModuleDataArr);
     $wobClass->setRedemptionChannel('both');
     $wobClass->setReviewStatus('underReview');
     $wobClass->setLocations($locations);
     $wobClass->setAllowMultipleUsersPerObject(true);
     return $wobClass;
 }