Skip to content

Instantly share code, notes, and snippets.

@lsmolic
Last active December 28, 2015 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsmolic/7489199 to your computer and use it in GitHub Desktop.
Save lsmolic/7489199 to your computer and use it in GitHub Desktop.
awsmsce:Hey everyone, quick question (hopefully) regarding URIs. wondering where there is a different uri for the same card when you refer to it from active_card and what the tokenizer returns
[2:48pm]jacobolus:hi awsmsce
[2:48pm]jacobolus:awsmsce: can you elaborate a bit?
[2:49pm]jacobolus:what's the "tokenizer"?
[2:49pm]awsmsce:when you tokenize a code, the api returns a URI for a card.. without a customer associated:
[2:49pm]jacobolus:yes
[2:50pm]awsmsce:however this differs from the URI that is returned when looking up a customer's active card
[2:50pm]awsmsce:but shouldn't the URI always be the same?
[2:50pm]awsmsce:the ID doesn't change
[2:50pm]jacobolus:if you tokenize a new card, then that card's URI is going to differ from a customer's existing card...?
[2:50pm]jacobolus:I still don't understand the question
[2:51pm]awsmsce:sorry, after the card is added to a customer
[2:51pm]awsmsce:so its the same card
[2:51pm]awsmsce:just before and after being added to a customer
[2:51pm]jacobolus:awsmsce: you can explicitly set which card should be the default
[2:51pm]awsmsce:yes
[2:51pm]jacobolus:it's the 'source_uri' attribute on the customer
[2:51pm]awsmsce:this is more that you can refer to the same care in two different ways
[2:51pm]awsmsce:card*
[2:52pm]awsmsce:"/v1/customers/CU67tPZb2bNrZMDpOv8oiHk/cards/CC3eVXW6r7sD6oydGLfB4ges"
[2:52pm]awsmsce:"/v1/marketplaces/TEST-MP1rrbBtLU7fpmOPmuQaZdNg/cards/CC3eVXW6r7sD6oydGLfB4ges"
[2:52pm]awsmsce:same card
[2:52pm]awsmsce:but two different URIs
[2:52pm]jacobolus:ah, okay. yes, that's fine
[2:53pm]jacobolus:awsmsce: you can use either of those URIs interchangeably
[2:53pm]awsmsce:ah, then this is just a ruby implementation issue
[2:53pm]jacobolus:no, that's part of the API
[2:53pm]jacobolus:awsmsce: if you're trying to compare them to decide if they refer to the same card, you should use the card's 'id'
[2:54pm]awsmsce:it is recommended to store these portions of the api to cut down on calls to balanced? or is that unsafe?
[2:54pm]jacobolus:sure, you can store anything you get back from the API
[2:54pm]awsmsce:i didn't know if that was against recommended practices
[2:55pm]jacobolus:we won't ever tell you credit card numbers, etc.
[2:55pm]awsmsce:sure
[2:55pm]jacobolus:storing URIs for various resources is totally fine
[2:56pm]awsmsce:the error I was receiving was because one of the ruby endpoints was expecting a customer uri and not the marketplace uri
[2:56pm]awsmsce:that was why this all came about
[2:56pm]jacobolus:awsmsce: both of your examples are card URIs
[2:57pm]jacobolus:or you mean you were doing some kind of validation about what you thought a card URI should look like?
[2:58pm]awsmsce:i will have to track down the call I was making. at least one of the ruby gem methods to retrieve a card based on the URI would only accept one format
[2:58pm]awsmsce:not both
[2:58pm]awsmsce:so, i was trying to determine if there was a preferred uri to use
[3:14pm]jacobolus:awsmsce: either URI is fine
[3:22pm]awsmsce:thanks jacobolus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment