dongya3627 2017-06-22 15:21
浏览 85
已采纳

电子钱包通行证更新 - 无法读取通行证,因为它无效

I have implemented passbooks and updating. I'm using the eo/passbook-bundle and have created below JSON when packaging the passbook without errors, but when, in the update process, the server calls the webServiceURL/version/passes/passTypeIdentifier/serialNumber api, and the device downloads exactly the same JSON (but not packaged, just this json), it fails.

I've read in a comment on Received invalid pass data while updating Apple Wallet Pass that it may have something to do with correct headers, but there's no description whatsoever in the docs on any specific headers to return in the response (see https://developer.apple.com/library/content/documentation/PassKit/Reference/PassKit_WebService/WebService.html)

I'm using symfony to return the response with the encoded json like this:

$json = PassFactory::serialize($storecard);
return new Response($json, 200, ['Content-Type' => 'application/json']);

I've also tried it without the Content-Type header.

In the log I can see: Get pass task (pass type pass.com.spinpos.latest.customercard, serial number 5, if-modified-since (null); with web service url https://my.domain.com/api/loy/wallet/) encountered error: Received invalid pass data (The pass cannot be read because it isn’t valid.)

The JSON response is this:

{
   "storeCard":{
      "headerFields":[
         {
            "key":"prepaid",
            "value":"0,00",
            "label":"PREPAID"
         }
      ],
      "secondaryFields":[
         {
            "key":"username",
            "value":"Some Name",
            "label":"GEBRUIKERSNAAM"
         },
         {
            "key":"lastvisit",
            "value":"niet bekend",
            "label":"LAATSTE BEZOEK"
         }
      ],
      "auxiliaryFields":[
         {
            "key":"qrcode",
            "value":"2690310109104",
            "label":"QR CODE"
         },
         {
            "key":"points",
            "value":20,
            "label":"LOYALTY PUNTEN"
         }
      ],
      "backFields":[
         {
            "key":"website",
            "value":"http://www.somesite.com",
            "label":"WEBSITE"
         },
         {
            "key":"phone_number",
            "value":"05311223344",
            "label":"TELEFOONNUMMER"
         },
         {
            "key":"terms_of_service",
            "value":"Dit zijn test algemene voorwaarden!",
            "label":"ALGEMENE VOORWAARDEN"
         }
      ]
   },
   "serialNumber":"5",
   "description":"Your Customer card",
   "formatVersion":1,
   "locations":[
      {
         "latitude":51.62,
         "longitude":5.55,
         "relevantText":"Some Loc 2"
      },
      {
         "latitude":51.7737967,
         "longitude":5.5513203,
         "relevantText":"Some loc 1"
      },
      {
         "latitude":52.2648569,
         "longitude":6.8018085,
         "relevantText":"Testdfdr"
      }
   ],
   "barcode":{
      "format":"PKBarcodeFormatQR",
      "message":"2690310109104",
      "messageEncoding":"iso-8859-1"
   },
   "barcodes":[
      {
         "format":"PKBarcodeFormatQR",
         "message":"2690310109104",
         "messageEncoding":"iso-8859-1"
      }
   ],
   "backgroundColor":"rgb(255,108,108)",
   "foregroundColor":"rgb(46,14,170)",
   "labelColor":"rgb(110,255,75)",
   "authenticationToken":"048cfd30e4baf1c3250f0c8c7500f998aee2da49",
   "webServiceURL":"https://my.domain.com/api/loy/wallet/"
}

Anyone any idea what's wrong with the JSON or the headers?

  • 写回答

1条回答 默认 最新

  • 「已注销」 2017-06-22 15:40
    关注

    You need to send an entire new, signed .pkpass bundle with a header application/vnd.apple.pkpass

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?