Confusion over SingleUse pipeline, please help.

3 views
Skip to first unread message

Jesse

unread,
Aug 5, 2009, 8:02:23 PM8/5/09
to Remit
Using the earlier gist (http://gist.github.com/46941) I'm facing some
confusion. I'm not sure where or when the
'recipient_token_for_this_transaction' is generated. The manual says
that @caller, @recipient, and @sender are not all allowed in the same
request, only one or two of them.

Here's the error after submitting payment in the sandbox.

"No action responded to show. Actions: create and new"
for url..
http://localhost:3000/payments/create?expiry=01%2F2015&tokenID=J3FFDA9XJVG25UB1R2C61HYFZNJYULQA6K8VPVSNVH6M7QR2RXSRTQ7WSCVNTBIS&status=SC&callerReference=sender-payment-1249516901&awsSignature=iUpzXB6M26kU4amdm5Q1C/O0cM0=

class PaymentsController < ApplicationController
##
# Generate and redirect the client to the single use payment
pipeline, using
# the recipient token collected earlier.
#
def new
redirect_to remit.get_single_use_pipeline({
:caller_reference => "sender-payment-#{Time.now.to_i}",
:recipient_token => recipient_token_for_this_transaction,
:payment_reason => "Blitz Writing and Voting Privileges",
:transaction_amount => '3.00',
:return_url => 'http://localhost:3000/payments/create'
}).url
end

##
# Check, validate, and store the sender token to capture the
payment, or
# charge the transaction immediately. Think of the sender token as
being
# similar to a credit card authorization.
#
def create
if response.valid? && response.successful?
# store the sender token to use it later, or just use
immediately to
# charge the transaction as follows:
request = returning Remit::Pay::Request.new do |r|
r.recipient_token_id = recipient.token_id
r.sender_token_id = sender.token_id
# r.caller_token_id = caller.token_id
r.transaction_amount = Remit::RequestTypes::Amount.new(
:currency_code => 'USD', :amount
=> 3.00)
#r.charge_fee_to = Remit::ChargeFeeTo::RECIPIENT
r.caller_reference = "my-first-transaction-#{Time.now.to_i}"
r.meta_data = "Blitz Writing and Voting Privileges"
#r.marketplace_variable_fee = '10'
end

payment_response = remit.pay(request)

if payment_response.successful?
# Blitz
flash.now[:notice] = "Success!"
redirect_to blitzes_path
else
flash.now[:notice] = "Unsuccessful."
redirect_to blitzes_path
end
end
end

private

def remit
@sandbox ||= !Rails.env.production?
@remit ||= Remit::API.new(FPS_ACCESS_KEY, FPS_SECRET_KEY,
@sandbox)
end
end

Jesse

unread,
Aug 6, 2009, 7:45:57 AM8/6/09
to Remit
I seem to have resolved an error my commenting out
map.resources :payments. Though I'm confused whether that negates the
RESTful purpose (?)

If it helps, here is the process I need to implement: Buyer makes
SingleUse payment to my company (no 3rd party).


On Aug 5, 7:02 pm, Jesse <teff...@gmail.com> wrote:
> Using the earlier gist (http://gist.github.com/46941) I'm facing some
> confusion.  I'm not sure where or when the
> 'recipient_token_for_this_transaction' is generated.  The manual says
> that @caller, @recipient, and @sender are not all allowed in the same
> request, only one or two of them.
>
> Here's the error after submitting payment in the sandbox.
>
> "No action responded to show. Actions: create and new"
> for url..http://localhost:3000/payments/create?expiry=01%2F2015&tokenID=J3FFDA...
Reply all
Reply to author
Forward
0 new messages