Exemplo n.º 1
0
        private void WriteStoreCardKeys(JsonWriter writer, StoreCardGeneratorRequest storeCardRequest)
        {
            writer.WritePropertyName("storeCard");
            writer.WriteStartObject();

            writer.WritePropertyName("secondaryFields");
            writer.WriteStartArray();

            writer.WriteStartObject();
            writer.WritePropertyName("key");
            writer.WriteValue("balance");
            writer.WritePropertyName("label");
            writer.WriteValue("Balance");
            writer.WritePropertyName("value");
            writer.WriteValue(storeCardRequest.Balance);
            writer.WritePropertyName("labelColor");
            writer.WriteValue("#FFFFFF");
            writer.WriteEndObject();

            writer.WriteStartObject();
            writer.WritePropertyName("key");
            writer.WriteValue("nickname");
            writer.WritePropertyName("label");
            writer.WriteValue("Nickname");
            writer.WritePropertyName("value");
            writer.WriteValue(storeCardRequest.OwnersName);
            writer.WritePropertyName("labelColor");
            writer.WriteValue("#FFFFFF");
            writer.WriteEndObject();

            writer.WriteEndArray();
            writer.WriteEndObject();
        }
Exemplo n.º 2
0
        private void WriteStyleSpecificKeys(JsonWriter writer, PassGeneratorRequest request)
        {
            EventPassGeneratorRequest eventRequest = request as EventPassGeneratorRequest;

            if (eventRequest != null)
            {
                WriteEventRequestKeys(writer, eventRequest);
                return;
            }

            StoreCardGeneratorRequest storeCardRequest = request as StoreCardGeneratorRequest;

            if (storeCardRequest != null)
            {
                WriteStoreCardKeys(writer, storeCardRequest);
                return;
            }
        }
Exemplo n.º 3
0
        public ActionResult StoreCard()
        {
            PassGenerator generator = new PassGenerator();

            StoreCardGeneratorRequest request = new StoreCardGeneratorRequest();
            request.Identifier = "pass.tomsamcguinness.events";
            request.CertThumbprint = ConfigurationManager.AppSettings["PassBookCertificateThumbprint"];
            request.CertLocation = System.Security.Cryptography.X509Certificates.StoreLocation.CurrentUser;
            request.FormatVersion = 1;
            request.SerialNumber = "121212111";
            request.Description = "My first pass";
            request.OrganizationName = "Tomas McGuinness";
            request.TeamIdentifier = "Team America";
            request.LogoText = "My Pass";
            request.BackgroundColor = "#000000";
            request.ForegroundColor = "#FFFFFF";

            request.BackgroundFile = Server.MapPath(@"~/Icons/Starbucks/background.png");
            request.BackgroundRetinaFile = Server.MapPath(@"~/Icons/Starbucks/[email protected]");

            request.IconFile = Server.MapPath(@"~/Icons/Starbucks/icon.png");
            request.IconRetinaFile = Server.MapPath(@"~/Icons/Starbucks/[email protected]");

            request.LogoFile = Server.MapPath(@"~/Icons/Starbucks/logo.png");
            request.LogoRetinaFile = Server.MapPath(@"~/Icons/Starbucks/[email protected]");

            // Specific information
            //
            request.Balance = 100.12;
            request.OwnersName = "Tomas McGuinness";
            request.Title = "Starbucks";
            request.AddBarCode("01927847623423234234", BarcodeType.PKBarcodeFormatPDF417, "UTF-8", "01927847623423234234");

            request.AuthenticationToken = "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc";
            request.WebServiceUrl = "http://192.168.1.59:82/api/";

            Pass generatedPass = generator.Generate(request);
            return new FileContentResult(generatedPass.GetPackage(), "application/vnd.apple.pkpass");
        }
Exemplo n.º 4
0
        public ActionResult StoreCard()
        {
            PassGenerator generator = new PassGenerator();

            StoreCardGeneratorRequest request = new StoreCardGeneratorRequest();
            request.Identifier = "pass.tomasmcguinness.com";
            request.CertThumbnail = ConfigurationManager.AppSettings["PassBookCertificateThumbnail"];
            request.FormatVersion = 1;
            request.SerialNumber = "121212";
            request.Description = "My first pass";
            request.OrganizationName = "Tomas McGuinness";
            request.TeamIdentifier = "Team America";
            request.LogoText = "My Pass";
            request.BackgroundColor = "#000000";
            request.ForegroundColor = "#FFFFFF";

            request.BackgroundFile = Server.MapPath(@"~/Icons/Starbucks/background.png");
            request.BackgroundRetinaFile = Server.MapPath(@"~/Icons/Starbucks/[email protected]");

            request.IconFile = Server.MapPath(@"~/Icons/Starbucks/icon.png");
            request.IconRetinaFile = Server.MapPath(@"~/Icons/Starbucks/[email protected]");

            request.LogoFile = Server.MapPath(@"~/Icons/Starbucks/logo.png");
            request.LogoRetinaFile = Server.MapPath(@"~/Icons/Starbucks/[email protected]");

            // Specific information
            //
            request.Balance = 100.12;
            request.OwnersName = "Tomas McGuinness";
            request.Title = "Starbucks";
            request.AddBarCode("01927847623423234234", BarcodeType.PKBarcodeFormatPDF417, "UTF-8", "01927847623423234234");

            Pass generatedPass = generator.Generate(request);

            return new FileContentResult(generatedPass.GetPackage(), "application/vnd.apple.pkpass");
        }
        //https://webServiceURL/version/passes/passTypeIdentifier/serialNumber
        public HttpResponseMessage GetPass(string version, string passTypeIdentifier, string serialNumber)
        {
            StoreCardGeneratorRequest request = new StoreCardGeneratorRequest();
            request.Identifier = "pass.tomsamcguinness.events";
            request.CertThumbprint = ConfigurationManager.AppSettings["PassBookCertificateThumbprint"];
            request.CertLocation = System.Security.Cryptography.X509Certificates.StoreLocation.CurrentUser;
            request.FormatVersion = 1;
            request.SerialNumber = "121212111";
            request.Description = "My first pass";
            request.OrganizationName = "Tomas McGuinness";
            request.TeamIdentifier = "Team America";
            request.LogoText = "My Pass";
            request.BackgroundColor = "#000000";
            request.ForegroundColor = "#FFFFFF";

            request.BackgroundFile = HttpContext.Current.Server.MapPath(@"~/Icons/Starbucks/background.png");
            request.BackgroundRetinaFile = HttpContext.Current.Server.MapPath(@"~/Icons/Starbucks/[email protected]");

            request.IconFile = HttpContext.Current.Server.MapPath(@"~/Icons/Starbucks/icon.png");
            request.IconRetinaFile = HttpContext.Current.Server.MapPath(@"~/Icons/Starbucks/[email protected]");

            request.LogoFile = HttpContext.Current.Server.MapPath(@"~/Icons/Starbucks/logo.png");
            request.LogoRetinaFile = HttpContext.Current.Server.MapPath(@"~/Icons/Starbucks/[email protected]");

            // Specific information
            //
            request.Balance = 121.12;
            request.OwnersName = "Tomas McGuinness";
            request.Title = "Starbucks";
            request.AddBarCode("01927847623423234234", BarcodeType.PKBarcodeFormatPDF417, "UTF-8", "01927847623423234234");

            request.AuthenticationToken = "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc";
            request.WebServiceUrl = "http://192.168.1.3:81/api/";

            PassGenerator generator = new PassGenerator();
            Pass generatedPass = generator.Generate(request);

            var response = new HttpResponseMessage(HttpStatusCode.OK);
            response.Content = new ObjectContent<Byte[]>(generatedPass.GetPackage(), new BinaryFormatter());
            return response;
        }
Exemplo n.º 6
0
        private void WriteStoreCardKeys(JsonWriter writer, StoreCardGeneratorRequest storeCardRequest)
        {
            writer.WritePropertyName("storeCard");
            writer.WriteStartObject();

            writer.WritePropertyName("secondaryFields");
            writer.WriteStartArray();

            writer.WriteStartObject();
            writer.WritePropertyName("key");
            writer.WriteValue("balance");
            writer.WritePropertyName("label");
            writer.WriteValue("Balance");
            writer.WritePropertyName("value");
            writer.WriteValue(storeCardRequest.Balance);
            writer.WritePropertyName("labelColor");
            writer.WriteValue("#FFFFFF");
            writer.WriteEndObject();

            writer.WriteStartObject();
            writer.WritePropertyName("key");
            writer.WriteValue("nickname");
            writer.WritePropertyName("label");
            writer.WriteValue("Nickname");
            writer.WritePropertyName("value");
            writer.WriteValue(storeCardRequest.OwnersName);
            writer.WritePropertyName("labelColor");
            writer.WriteValue("#FFFFFF");
            writer.WriteEndObject();

            writer.WriteEndArray();
            writer.WriteEndObject();
        }