115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/helpers/controller_helpers.rb', line 115
def init_charge(params, access_token=nil)
wepay_gateway = WepayRails::Payments::Gateway.new(access_token)
response = wepay_gateway.perform_charge(params)
params.merge!({
:access_token => wepay_gateway.access_token,
:preapproval_id => response[:preapproval_id],
:checkout_id => response[:checkout_id],
:security_token => response[:security_token],
})
params.delete_if {|k,v| !WepayCheckoutRecord.attribute_names.include? k.to_s}
WepayCheckoutRecord.create(params)
end
|