New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Even Out: Allow admin to remove store credit for partial store credit payment for order #8026

Merged
merged 1 commit into from May 30, 2017
Jump to file or symbol
Failed to load files and symbols.
+17 −5
Diff settings

Always

Just for now

@@ -153,7 +153,7 @@ def can_capture?(payment)
end
def can_void?(payment)
payment.pending?
payment.pending? || (payment.checkout? && !payment.order.completed?)
end
def can_credit?(payment)
@@ -663,11 +663,23 @@
end
end
context 'checkout payment' do
let(:payment_state) { 'checkout' }
context 'remove store credits' do
let(:payment_state) { :checkout }
it 'returns false' do
expect(subject).to be false
context 'when payment is in checkout and order is not completed' do
it { is_expected.to be true }
end
context 'when order is completed' do
before { payment.order.update_column(:completed_at, Time.current) }
it { is_expected.to be false }
end
context 'when payment is completed' do
before { payment.update_column(:state, :completed) }
it { is_expected.to be false }
end
end
ProTip! Use n and p to navigate between commits in a pull request.