tomasmcguinness / dotnet-passbook

A .Net Library for generating Apple Passbook (Wallet) files for iOS. Please get involved by creating pull requests and opening issues!
MIT License
319 stars 117 forks source link

Passbook.Generator.Exceptions.RequiredFieldValueMissingException: 'Missing value for field [key: 'key']. Every field must have a value specified in the template or the individual pass.' #193

Open NikunjMoltech opened 4 months ago

NikunjMoltech commented 4 months ago

I am having this issue from few days it was not occurring during implementation (before 4 weeks), Please someone give me proper guidance to resolve it, Thanks You.

does anyone have list of all rquired fields for the all pass types!

cardInfo is the objecy which have string values its not null in any case. configuration file values are also not null. I have added this fields in my request.


  var request = new PassGeneratorRequest
  {
      Style = PassStyle.Generic,
      AppleWWDRCACertificate = appleCert,
      PassbookCertificate = passCert,
      TeamIdentifier = _configuration["AppleWalletTeamIdentifier"],
      Description = "ABC Membership Card",
      OrganizationName = "ABC",
      GroupingIdentifier = objectId.ToString(),
      SerialNumber = passId,
      PassTypeIdentifier = _configuration["AppleWalletPassTypeIdentifier"],
      WebServiceUrl = "",
      AuthenticationToken = "",
      LogoText = "",
      Images =
      {
          { PassbookImage.Icon,icon},
          { PassbookImage.Icon2X,icon},
          { PassbookImage.Icon3X,icon},
          { PassbookImage.Logo,logoRectangle},
          { PassbookImage.Logo2X,logoRectangle},
          { PassbookImage.Logo3X,logoRectangle},
          //{ PassbookImage.Background,logoRound},
          //{ PassbookImage.Background2X,logoRound},
          //{ PassbookImage.Background3X,logoRound},
          //{ PassbookImage.Footer,footer},
          //{ PassbookImage.Footer2X,footer},
          //{ PassbookImage.Footer3X,footer},
          //{ PassbookImage.Thumbnail,thumbnail},
          //{ PassbookImage.Thumbnail2X,thumbnail},
          //{ PassbookImage.Thumbnail3X,thumbnail},
      }
  };

  request.BackgroundColor = _configuration["AppleWalletCardBackground"];
  request.LabelColor = "rgb(0,0,0)";
  request.ForegroundColor = "rgb(225,225,225)";

  request.AddHeaderField(new StandardField("", "", ""));
  request.AddPrimaryField(new StandardField()
  {
      Key = "memberName",
      Label = "MEMBER NAME",
      Value = cardInfo.MemberName
  });

  request.AddSecondaryField(new StandardField()
  {
      Key = "member_since",
      Label = "MEMBER SINCE",
      Value = cardInfo.MemberSince
  });

  request.AddAuxiliaryField(new StandardField()
  {
      Key = "email_address",
      Label = "EMAIL ADDRESS",
      Value = cardInfo.Email
  });

  request.AddSecondaryField(new StandardField()
  {
      Key = "expiry_date",
      Label = "EXPIRY DATE",
      Value = cardInfo.ExpiryDate,
      TextAlignment = FieldTextAlignment.PKTextAlignmentLeft
  });

  request.AddAuxiliaryField(new StandardField()
  {
      Key = "membership_tier",
      Label = "MEMBERSHIP TIER",
      Value = cardInfo.MembershipTier,
      TextAlignment = FieldTextAlignment.PKTextAlignmentLeft
  });

  request.AddBarcode(BarcodeType.PKBarcodeFormatPDF417, cardInfo.QRCodeValue, "iso-8859-1");