是否在Ruby中使用自适应付款成功设置了displayOptions.headerImageUrl
中的标题图片?我正试图弄清楚我的头撞墙。
根据我的理解,我有一个动作set_pay_chained
获取付费密钥并调用付费功能,但需要创建一个完全不同的功能,只需告诉PayPal图像网址。它是否正确?有没有人在Ruby / Rails中有一个如何做到这一点的例子?
目前我的代码基本上是这样的。
def set_pay_chained
@host=request.host.to_s
@port=request.port.to_s
@cancelURL= params[:returnurl_paypal]
#@returnURL="http://#{@host}:#{@port}/websamples/ap/setpaychained/pay_details"
@returnURL= params[:returnurl_paypal]
@@ep["SERVICE"]="/AdaptivePayments/Pay"
@caller = PayPalSDKCallers::Caller.new(false)
req={
"requestEnvelope.errorLanguage" => "en_US",
"clientDetails.ipAddress"=>@@clientDetails["ipAddress"],
"clientDetails.deviceId" =>@@clientDetails["deviceId"],
"clientDetails.applicationId" => @@clientDetails["applicationId"],
"feesPayer"=> "PRIMARYRECEIVER",
"receiverList.receiver[0].email"=>params[:receiveremail_0],
"receiverList.receiver[1].email"=> params[:receiveremail_1],
"receiverList.receiver[0].amount"=>params[:amount_0],
"receiverList.receiver[1].amount"=>params[:amount_1],
"receiverList.receiver[0].primary[0]"=> "true",
"receiverList.receiver[1].primary[1]"=> "false",
"currencyCode"=> "USD",
"actionType"=>"PAY",
"returnUrl" => @returnURL,
"cancelUrl"=>"#{@cancelURL}&paykey=#{@paykey}",
}
@transaction = @caller.call(req)
if (@transaction.success?)
session[:setpaychained_response]=@transaction.response
@response = session[:setpaychained_response]
@paykey = @response["payKey"][0]
@paymentExecStatus=@response["paymentExecStatus"]
if (@paymentExecStatus.to_s=="COMPLETED")
redirect_to :controller => 'setpaychained',:action => 'pay_details'
else
redirect_to "https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=#{@paykey}"
end
else
session[:paypal_error]=@transaction.response
redirect_to :controller => 'calls', :action => 'error'
end
rescue Errno::ENOENT => exception
flash[:error] = exception
redirect_to :controller => 'calls', :action => 'exception'
end
==更新== 在Paypal的开发者表格中,我收到了各种建议。我已经把讨论移到这里,看看我是否可以采用更“铁路”的方式处理这个问题。到目前为止,SweatCoder提供了我认为最接近我正在寻找的解决方案。不幸的是,代码是用PHP编写的(我只有非常非常基本的理解)所以我现在正试图将这段代码(https://www.x.com/message/211714#211714)翻译成ruby。我的理解是我需要进行两次单独的调用。我无法判断我是否应该同时拨打这些电话,如果没有,应该首先拨打电话。