MultiUse Tokens?

4 views
Skip to first unread message

Jon Crawford

unread,
Jul 6, 2008, 5:02:14 AM7/6/08
to Remit
Is there a major inconvenience standing in the way of including
MultiUse tokens in this gem. I've got FPS incorporated into my app,
but it's pretty messy. I was hoping to use this gem, but I don't see
that it supports MultiUse tokens.

I'm using MultiUse tokens to support an online marketplace. A shopper
checks out once and money is funneled to separate merchants based on
what the shopper bought. I believe Amazon is the only payment
platform that can support easily sending money to several parties in
one transaction so having this functionality in the gem would be
great!

!jon

Tyler Hunt

unread,
Jul 7, 2008, 10:24:51 AM7/7/08
to re...@googlegroups.com

I don't believe any effort has been put into supporting MultiUse
tokens, and it's been a little while since I've put any work into the
gem personally, so it would be hard for me to speak to the technical
feasibility of such a patch. I'm not sure how motivated you are to get
this working with Remit, but if you'd like to dig into the code base a
little I'd happily accept any patches you toss my way.

Let me know if I can be of any help on this, or if you have any other
ideas on how to make the interface easier to integrate into your
application,

Tyler Hunt

Jon Crawford

unread,
Jul 8, 2008, 4:24:05 AM7/8/08
to Remit
Hey Tyler-

Yeah I'm very interested in using Remit for my project. I've gotten
it implement using the MultiUse tokens. It was pretty easy after I
just added a new class with its own parameters. I'll share the patch
as well as a few other additions I've made if I can clean things up
enough.

I'm running into one hiccup that I was wondering if you could help me
navigate. It seems to be more of an issue with the interplay between
Remit and Relax particularly in the DiscardResults class. As you
probably know, after you GetResults from Amazon, you should send a
confirmation that you've received it in the form of a DiscardResults
action. DiscardResults takes an array of TransactionIds so you can
tell it with one request that you've received the Results. Well,
Remit::DiscardResults::Request has a :transaction_ids parameter. This
would seem to work except for the format that Amazon requires the
TransactionIds to me in. Here is the format they require:
"TransactionIds.
0=13BVRQK3L16PJ3I6NNP2DAGD684N452O5IH&TransactionIds.
1=13BVS5MP22T1HIHJ2PRRLT4O8N3EE9SN4U5&..."

Notice the "TransactionIds.n=" format. Currently if I try to pass
this format through the Request object, obviously it doesn't work and
ends up looking like this:
"&TransactionIds=TransactionIds.
0%3D13BVS5MP22T1HIHJ2PRRLT4O8N3EE9SN4U5%26TransactionIds.
1%3D13BVVR...". Notice how "TransactionIds" is added to the query and
my nice string is encoded and unusable.

How might I pass through kev/value pairs that aren't defined as
parameters? It's almost like the Request object needs to accept an
Array of TransactionIds and do all that cool "TransactionIds.n" magic
before the call is made. Please advise.

Note: I did observe that it works to pass a single TransactionID as
the parameter but for my application, I'd be making requests all day
long to discard all those results. I need to discard 25-100+ in one
call.

Any help is appreciated.

P.S. I'd really love to see this gem and other FPS stuff for Ruby/
Rails grow and get some more attention from the community. It's a
very cool platform with a lot of potential but it can be a little
daunting. I'm building a pretty big app on top of it so I'm sure I'll
have some lessons I can share when I'm done. But starting out,
examples/discussion/blog posts have been non-existent!
>  smime.p7s
> 5KDownload

Tyler Hunt

unread,
Jul 9, 2008, 11:26:40 AM7/9/08
to re...@googlegroups.com

You're right about it being an issue with Relax. There isn't really
support in Relax at the moment for this sort of request format. I
originally intended for Relax to be a generic library for building
interfaces to REST services, but since the primary application of it
so far has been Remit, most of its functionality is geared around the
most common FPS request formats.

Ideally there would be some thought put into expanding Relax to be a
little more flexible in the types of requests and responses that it
works with. In the short term an easier solution might be to create a
subclass of Relax::Request called something like RequestList or
RequestCollection that would produce the sort of output you're after,
possibly by simulating the functionality of an array (the proper way
to do this is probably to move the Request logic into a module that
can be included into a class that extends Ruby's Array).

I'd love to hear your thoughts on such a solution, and am willing to
help out with the implementation.

> P.S. I'd really love to see this gem and other FPS stuff for Ruby/
> Rails grow and get some more attention from the community. It's a
> very cool platform with a lot of potential but it can be a little
> daunting. I'm building a pretty big app on top of it so I'm sure I'll
> have some lessons I can share when I'm done. But starting out,
> examples/discussion/blog posts have been non-existent!

I understand what you mean. It was very difficult for me to get
started with this project, and to be honest, I haven't spent much time
at all actually using it yet, which is why things like this
TransactionId issue haven't been worked out yet.

I would love to see the platform take off, as well. Maybe after this
fix is in place the right thing to do would be to publish a new
release of Remit with some better documentation and a simple getting
started tutorial in the form of RDoc and then push those docs up to
RubyForge. That seems like a decent place to start to me.

Reply all
Reply to author
Forward
0 new messages