Skip to content

Conversation

markzegarelli
Copy link
Contributor

@markzegarelli markzegarelli commented Oct 23, 2020

  • Removes a bit about advanced controls from Privacy FAQ
  • Adds several missing objects from Stripe cloud source doc. Need to add definitions.
    • order_shipping_methods
    • products
    • skus
    • subscription_items

Merge timing

  • ASAP once approved?

Related issues (optional)

DOC-48

@netlify
Copy link

netlify bot commented Oct 23, 2020

Deploy preview for segment-docs-preview ready!

Built with commit e53db9d

https://deploy-preview-1184--segment-docs-preview.netlify.app

@markzegarelli
Copy link
Contributor Author

@markzegarelli markzegarelli marked this pull request as ready for review October 23, 2020 22:40
Copy link
Contributor

@maggieyu-segment maggieyu-segment left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transform() method is a bit tricky. Some properties are added outside of map[string]interface{}. Added an example to order_shipping_methods in an inline comment.

@@ -391,58 +442,3 @@ Below are tables outlining the properties included in the collections listed abo
| `reversed` | Whether the transfer has been fully reversed. If the transfer is only partially reversed, this attribute will still be false |
| `source_transaction` | ID of the charge or payment that was used to fund the transfer. If null, the transfer was funded from the available balance |

## V2 Changelog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if the change log is being moved to somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maggieyu-segment Removed the changelog for now, as it had not been updated in over a year. I think before we re-add it, we need a strategy to make sure it stays up-to-date.

| `amount` | |
| `currency` | |
| `description` | |

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transform() in stripe source is not very straightforward. Other than the properties in map[string]interface{}, some properties are added using tr.Flatten(). For example, for order_shipping_methods, there is this line of code:

tr.Flatten(tr.GetMap(method, "delivery_estimate"), "delivery_estimate_", properties)

tr.Flatten() flattens the properties in delivery_estimate. For example, from the Stripe API doc, there is delivery_estimate.date, and this property will be named delivery_estimate_date in the object.

I also noticed that these flattened properties are not captured in some other collections, e.g. accounts. Looks like we may need a wider scope of auditing for the existing doc. (Just pointing this out - feel free to keep the scope of this PR/ ticket to what you intended in the beginning.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info. I should be able to expand the scope here and push this out today.

Copy link
Contributor Author

@markzegarelli markzegarelli Oct 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maggieyu-segment Also, do we flatten to n levels deep? For example, in charges, we flatten the shipping object. So for things in shipping_address, does that flatten to shipping_address_city etc.?

Stripe docs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't a limitation on the number of levels we flatten to. Flatten() will continue to flatten the child value until the value is no longer a map[string]interface{}. Yes, the charges example you have is correct.


| Property Name | Description |
| ------------------------- | ------------------------------------------------------------ |
| `order_id` | |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the descriptions be added in a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to add these. Would you recommend using the Stripe API docs to adapt these definitions?

For example, here, I can guess what order_id is used for, but I want to be as accurate as possible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we could use the Stripe API docs for the definitions. They should match for most cases (I can't think of a property that drifts far away from the original property from Stripe. I would say, the ones that have special handling (i.e. not a straightforward prop = obj["id"] or tr.Flatten()) in transform() may require more attention.)

@markzegarelli
Copy link
Contributor Author

Hi @maggieyu-segment, I think we should be good to go here. Can you have a look and hopefully sign off when you have a moment? For the record, rather than list all the flattened properties, in some cases, I describe what has been flattened, provide an example, and link to the relevant section of Stripe's docs. Otherwise, these tables would be massive in spots.

Preview here

@markzegarelli
Copy link
Contributor Author

Thanks @maggieyu-segment. I really appreciate you having a look at this. I'm going to merge as-is, and we can pick up additional updates in another PR.

@markzegarelli markzegarelli merged commit 9fa852e into master Nov 2, 2020
@markzegarelli markzegarelli deleted the DOC-48_priv-and-stripe-updates branch November 2, 2020 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants