我目前正在开发一个Rails应用程序接受使用Chargify定期结算使用官方Chargify宝石响应。我已经安装了their gem并设法连接到Chargify的宝石。但是,有些订阅会通过,有些则不会。如何处理来自Rails的3
我的问题是我该如何处理,甚至处理响应,一旦创业板与服务器进行通信?
我没有看到任何的开发日志,让我一个成功的数据传输或失败的一个迹象。宝石文档也没有提到这方面的任何事情。
感谢您寻找。
UPDATE
我跟在我结账控制器玩弄代码:
高清结账 @customer = Customer.new(PARAMS [:客户])
Chargify::Customer.create(
:first_name => "Charlie",
:last_name => "Bull",
:email => "[email protected]",
:organization => "Chargify"
)
Chargify::Subscription.create(
:product_handle => 'recurring',
:customer_attriburtes => {
:first_name => @customer.shipping_first_name,
:last_name => @customer.shipping_last_name,
:email => @customer.email
},
:payment_profile_attributes => {
:first_name => @customer.shipping_first_name,
:last_name => @customer.shipping_last_name,
:full_number => "1",
:expiration_month => 1,
:expiration_year => 2012,
:billing_address => @customer.shipping_street_address,
:billing_city => @customer.shipping_city,
:billing_state => @customer.shipping_state,
:billing_zip => @customer.shipping_zip_code,
:billing_country => @customer.shipping_country
}
)
#if @subscription.save
# logger.info "saved description"
# redirect_to process_path
#else
# redirect_to :back, :alert =>"There was an error."
#end
结束
客户创建正在经历,但订阅没有。我只是寻找服务器的回调,以便我可以根据它是否成功并找出订阅未通过的原因。
它看起来像代码检查几个请求的响应代码,如果它得到意外的响应,它会引发一个UnexpectedResponseError。你能给我们一些示例代码吗? –
把我的控制器代码。感谢您的回应。 – jklina