Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
knowmalaria
stripe-ruby-mock
Commits
64c27f8f
Commit
64c27f8f
authored
Apr 10, 2016
by
Alexander Mamonchik
Browse files
Merge pull request #319 from MelianLabs/capture_with_application_fee
allow for updating an application fee upon charge capture
parents
64b3e94c
c826f4de
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/stripe_mock/request_handlers/charges.rb
View file @
64c27f8f
...
...
@@ -78,6 +78,10 @@ module StripeMock
add_refund_to_charge
(
refund
,
charge
)
end
if
params
[
:application_fee
]
charge
[
:application_fee
]
=
params
[
:application_fee
]
end
charge
[
:captured
]
=
true
charge
end
...
...
spec/shared_stripe_examples/charge_examples.rb
View file @
64c27f8f
...
...
@@ -199,7 +199,12 @@ shared_examples 'Charge API' do
charge
.
amount
=
777
charge
.
source
=
{
any:
"source"
}
expect
{
charge
.
save
}.
to
raise_error
(
Stripe
::
InvalidRequestError
,
/Received unknown parameters: currency, amount, source/i
)
expect
{
charge
.
save
}.
to
raise_error
(
Stripe
::
InvalidRequestError
)
do
|
error
|
expect
(
error
.
message
).
to
match
(
/Received unknown parameters/
)
expect
(
error
.
message
).
to
match
(
/currency/
)
expect
(
error
.
message
).
to
match
(
/amount/
)
expect
(
error
.
message
).
to
match
(
/source/
)
end
end
...
...
@@ -335,9 +340,10 @@ shared_examples 'Charge API' do
capture:
false
})
returned_charge
=
charge
.
capture
({
amount:
677
})
returned_charge
=
charge
.
capture
({
amount:
677
,
application_fee:
123
})
expect
(
charge
.
captured
).
to
eq
(
true
)
expect
(
returned_charge
.
amount_refunded
).
to
eq
(
100
)
expect
(
returned_charge
.
application_fee
).
to
eq
(
123
)
expect
(
returned_charge
.
id
).
to
eq
(
charge
.
id
)
expect
(
returned_charge
.
captured
).
to
eq
(
true
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment