126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# File 'lib/stripe_mock/request_handlers/charges.rb', line 126
def capture_charge(route, method_url, params, )
route =~ method_url
charge = assert_existence :charge, $1, charges[$1]
if params[:amount]
refund = Data.mock_refund(
:balance_transaction => new_balance_transaction('txn'),
:id => new_id('re'),
:amount => charge[:amount] - params[:amount]
)
add_refund_to_charge(refund, charge)
end
if params[:application_fee]
charge[:application_fee] = params[:application_fee]
end
charge[:captured] = true
charge
end
|