-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for orders custom data on transactions CSV #500
Conversation
@@ -273,6 +274,7 @@ const csvMapping = { | |||
merchantId: (t) => get(t, 'merchantId'), | |||
orderMemo: (t) => get(t, 'order.memo'), | |||
orderProcessedDate: (t) => (t.order?.processedAt ? moment.utc(t.order.processedAt).format('YYYY-MM-DD') : ''), | |||
orderCustomData: (t) => get(t, 'order.customData'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't custom data an object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is an object. In my tests json2csv
properly stringified the value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so the CSV value will be a stringified JSON. Is this something that we are already doing elsewhere?
What is the use case, will that help people achieve what they want? Given than they may have to parse the JSON to extract the data?
Not blocking but just to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's from https://opencollective.slack.com/archives/C6JTTA4SK/p1696831552748589?thread_ts=1686331488.222289&cid=C6JTTA4SK, the data they're getting from this is a phone number collected via a custom field in the contribution flow.
The alternative would be to explode the customData
object and have one column per field:
- Input:
{ phone: '0123456789', age: 43 }
- Output:
Custom data -> phone | customData -> age |
---|---|
0123456789 | 43 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok let's keep it as stringified JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If needed, we could implement a separate parameter to achieve that behavior of splitting into columns in the future
No description provided.