@@ -575,35 +575,50 @@ As of 1/16/25, perk data exported from CiviCRM needs to be massaged into valid
...
@@ -575,35 +575,50 @@ As of 1/16/25, perk data exported from CiviCRM needs to be massaged into valid
JSON data before it can be used to update the `perks.json` datafile which `donate-neo`
JSON data before it can be used to update the `perks.json` datafile which `donate-neo`
pulls from. For reference, here are the changes which must be made to the export file
pulls from. For reference, here are the changes which must be made to the export file
before it can be used to update the `donate-neo` repo:
before it can be used to update the `donate-neo` repo:
1. The data object exported from CiviCRM is a square-braces array, and is not named;
1. The data object exported from CiviCRM is a square-braces array, and is not named;
to conform to JSON standards it must be wrapped in an object's curly braces and
to conform to JSON standards it must be wrapped in an object's curly braces and
must be named "perks". Other extraneous text prepending the array must be removed.
must be named "perks". Other extraneous text prepending the array must be removed.
a. For example, `(5) [{"foo": "bar"}]` must become `{"perks": [{"foo": "bar"}]}`
a. For example, `(5) [{"foo": "bar"}]` must become `{"perks": [{"foo": "bar"}]}`
2. Product `id` fields must be expressed as strings, but are exported from CiviCRM as
2. Product `id` fields must be expressed as strings, but are exported from CiviCRM as
integers. (See [tpo/web/donate-neo/commit/b23e7fdd](https://gitlab.torproject.org/tpo/web/donate-neo/-/commit/b23e7fdd59a66658f50ede630ed924b0006a6439).) Wrap all such IDs in quotes.
integers. (See [tpo/web/donate-neo/commit/b23e7fdd](https://gitlab.torproject.org/tpo/web/donate-neo/-/commit/b23e7fdd59a66658f50ede630ed924b0006a6439).) Wrap all such IDs in quotes.
a. For example, `"id": 1` must become `"id": "1"`.
a. For example, `"id": 1` must become `"id": "1"`.
3. Each "perks" array item contains a child item `product_id.options`. If the perk
does not have options (such as the sticker pack), CiviCRM will export this field as
3. Each "perks" array item contains a child item
`null`. However, CiviCRM expects `donate-neo` to pass an option SKU along with a perk's
`product_id.options`. If the perk does not have options (such as
ID when selected - keeping this field `null` will keep selected perks from being
the sticker pack), CiviCRM will export this field as
recorded in the CRM. (See [tpo/web/donate-neo/commit/65144a42](https://gitlab.torproject.org/tpo/web/donate-neo/-/commit/65144a429e4f132ad64f1479eb8c8c94935897bd).) Therefore, we add
`null`. However, CiviCRM expects `donate-neo` to pass an option SKU
a mock option SKU in place of `null` in such cases.
along with a perk's ID when selected - keeping this field `null`
will keep selected perks from being recorded in the CRM. (See
[tpo/web/donate-neo/commit/65144a42](https://gitlab.torproject.org/tpo/web/donate-neo/-/commit/65144a429e4f132ad64f1479eb8c8c94935897bd).) Therefore, we add a mock
option SKU in place of `null` in such cases.
a. For example, `"product_id.options": null` must become
a. For example, `"product_id.options": null` must become