tomasmcguinness / pkpassvalidator

Checks the validity of a PKPASS file by checking it's signature and contents match the Apple specification
MIT License
78 stars 21 forks source link

pkpasses support #19

Open lol768 opened 2 years ago

lol768 commented 2 years ago
singhdilip1007 commented 1 year ago

@lol768 @tomasmcguinness

my .pkpass is generating but here are 2 problem

  1. I am currently facing an issue like I have created a .pkpass file from the code and when I am trying to open that file in Apple device I am getting a "File not supported issue" but If I open the same pass in android (PassWallet or Passes) it works fine.

  2. I want to set 2 fields in a row and 3 rows with same & 1 row with 3 fields. Please help me

PassGenerator generator = new PassGenerator();
            PassGeneratorRequest request = new PassGeneratorRequest();

            request.PassTypeIdentifier = "xxxxxxxxxxxxxxxxxxxx";
            request.TeamIdentifier = "xxxxxxxxxxx";
            request.SerialNumber = Guid.NewGuid().ToString("N"); ;
            request.Description = "test desc";
            request.OrganizationName = "test org";
            request.LogoText = "logo text";
            request.BackgroundColor = "#19342f";
            request.LabelColor = "#19342f";
            request.ForegroundColor = "#FFFFFF";

            request.AppleWWDRCACertificate = new X509Certificate2(Server.MapPath("~/Certificate/fffff.cer"));
            request.PassbookCertificate = new X509Certificate2(Server.MapPath("~/Certificate/fffff.pfx"), "ffffff");

            request.Images.Add(PassbookImage.Icon, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/icon.png")));
            request.Images.Add(PassbookImage.Icon2X, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/icon@2x.png")));
            request.Images.Add(PassbookImage.Icon3X, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/icon@2x.png")));

            request.Images.Add(PassbookImage.Logo, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/logo.png")));
            request.Images.Add(PassbookImage.Logo2X, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/logo@2x.png")));
            request.Images.Add(PassbookImage.Logo3X, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/logo@2x.png")));

            request.Style = PassStyle.Generic;

            request.AddPrimaryField(new StandardField("org name", "1991 Mountain Boulevard Oakland, Ca", "Walmart Pharmacy","TestAttr",DataDetectorTypes.PKDataDetectorTypeAddress));

            request.AddSecondaryField(new StandardField("rfv", "ft", "234"));
            request.AddSecondaryField(new StandardField("rfc", "fg", "rdd"));
            request.AddSecondaryField(new StandardField("rfx", "fb", "wer54"));

            request.LogoText = "Prescription Discount card";

            byte[] generatedPass = generator.Generate(request);
            return File(generatedPass, "application/vnd.apple.pkpass", request.SerialNumber+".pkpass");
tomasmcguinness commented 1 year ago

Hi,

If the pass won't open, it's most likely failing validation. Ensure your pass type identifier and team identifier match.

Also ensure your certificates are valid.

As for the column/row issue, I don't think it's possible.

Tom

singhdilip1007 commented 1 year ago

@tomasmcguinness I've double checked and pass type identifier and team identifier match properly Once using your validate option, getting below

image (13)

Please help me where & what is the issue so that I can go ahead.