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

时间:2017-06-22 15:21:13

标签: php passbook wallet

我已经实施了存折和更新。我在使用eo/passbook-bundle并且在没有错误打包存折时创建了以下JSON,但是在更新过程中,服务器调用webServiceURL/version/passes/passTypeIdentifier/serialNumber api时,设备下载完全相同JSON(但没有打包,只是这个json),它失败了。

我已在Received invalid pass data while updating Apple Wallet Pass的评论中读到它可能与正确的标题有关,但在回复的任何特定标题的文档中都没有任何描述(见https://developer.apple.com/library/content/documentation/PassKit/Reference/PassKit_WebService/WebService.html

我使用symfony以编码的json返回响应,如下所示:

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

我还尝试过没有Content-Type标题。

在日志中我可以看到: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.)

JSON响应如下:

{
   "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/"
}

任何人都知道JSON或标题有什么问题吗?

1 个答案:

答案 0 :(得分:1)

您需要发送一个包含标题application/vnd.apple.pkpass

的全新签名.pkpass包