我是Spree,ActiveMerchant和付款流程的新手......
那就是说,我正在尝试将OffsitePayment集成到spree中,我创建了一个自定义网关,将它添加到spree.rb配置文件上的spree的支付方法,并在管理界面上进行设置,使其显示为买方选项,purchase
方法被调用。但是在购买方法中实际要做什么呢?我想(并且期望)集成助手有一些我需要填写的属性(as I see in the docs for it),但是一旦填充,我该如何“提交”付款?我甚至不知道我是否应该寻找与狂欢有关的东西或OffsitePayments,或者与ActiveMerchant有关......有点迷失。
class Spree::Gateway::PagSeguro < Spree::Gateway
def provider_class
OffsitePayments::Integrations::PagSeguro
end
def provider
provider_class::Helper
end
def auto_capture?
true
end
def purchase(amount, paym_source, gateway_options={})
# What to do here?
ActiveMerchant::Billing::Response.new(true, 'success', {}, {})
end
end
答案 0 :(得分:0)
您的购买方法需要执行网关所需的任何操作,然后根据状态返回相应的ActiveMerchant::Billing::Response
,以便Spree知道如何处理它。