Skip to content
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

Vouchers part 2 #11003

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d9153f2
Introduce "zero priced order" concept with no required payment
Matt-Yorkley Jun 1, 2023
24b2ff3
Simplify voucher controller
Matt-Yorkley Jun 1, 2023
da11241
Move form definition down into each checkout step
Matt-Yorkley Jun 1, 2023
3501101
Move voucher section out of main checkout form
Matt-Yorkley Jun 1, 2023
7978aa8
Add separate voucher form
Matt-Yorkley Jun 1, 2023
0e93946
Move voucher processing out of checkout controller
Matt-Yorkley Jun 1, 2023
2b98d2e
Move voucher adjustment calculations out of checkout controller
Matt-Yorkley Jun 2, 2023
930d4b1
Don't apply tax calculations if there's no tax
Matt-Yorkley Jun 2, 2023
28a8aa7
Drop superfluous method
Matt-Yorkley Jun 2, 2023
2e5ae8a
Extract voucher tests to separate controller spec
Matt-Yorkley Jun 2, 2023
f23cda5
Introduce "zero priced orders" to checkout UI and order state flow
Matt-Yorkley Jun 2, 2023
0c3877e
Introduce "zero priced orders" in admin order payments UI and helper
Matt-Yorkley Jun 2, 2023
53e5ee5
Move loading of saved cards out of checkout concern
Matt-Yorkley Jun 2, 2023
f92ceb6
Remove @voucher_adjustment instance variable
Matt-Yorkley Jun 2, 2023
49499a9
Show/hide payment methods if voucher changes order total to zero
Matt-Yorkley Jun 2, 2023
264abcc
Clarify named vouchers in UI
Matt-Yorkley Jun 2, 2023
0bf0f38
Re-enable voucher test
Matt-Yorkley Jun 5, 2023
657a9a3
Improve feature toggling
Matt-Yorkley Jun 8, 2023
472cf6f
Fix rubocop complaint
Matt-Yorkley Jun 8, 2023
3d3370f
Update use of params
Matt-Yorkley Jun 8, 2023
821b579
Fix CSS/layout issues
Matt-Yorkley Jun 8, 2023
eced839
Fix flaky test
Matt-Yorkley Jun 8, 2023
1085557
Add nil safety in reports for zero priced orders with no payment method
Matt-Yorkley Jun 8, 2023
a211605
Use pre_discount_total when comparing to voucher amount
Matt-Yorkley Jun 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/split_checkout/_payment.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.medium-6#checkout-payment-methods
- if @order.distributor.vouchers.present?
- if feature?(:vouchers, spree_current_user) && @order.distributor.vouchers.present?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context, we though that wasn't necessary as unless you have access to Vouchers in backoffice (which is behind a feature toggle.), a user wouldn't be able to add a voucher to an enterprise, so the voucher section wouldn't show on the payment step.

%div.checkout-substep
= render partial: "split_checkout/voucher_section", locals: { order: @order, voucher_adjustment: @order.voucher_adjustments.first }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as my previous comment, I did it that way so the view "isn't the one doing the query".
Now that I think about it, the view would still be doing the query as I assume the query will happen when the view try to use @voucher_adjustment. 🤷


Expand Down
2 changes: 2 additions & 0 deletions spec/system/consumer/split_checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,8 @@
end

describe "vouchers" do
before { Flipper.enable :vouchers }

context "with no voucher available" do
before do
visit checkout_step_path(:payment)
Expand Down
2 changes: 2 additions & 0 deletions spec/system/consumer/split_checkout_tax_incl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
end

context "when using a voucher" do
before { Flipper.enable :vouchers }

let!(:voucher) do
create(:voucher, code: 'some_code', enterprise: distributor, amount: 10)
end
Expand Down
1 change: 1 addition & 0 deletions spec/system/consumer/split_checkout_tax_not_incl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
before do
# assures tax is charged in dependence of shipping address
Spree::Config.set(tax_using_ship_address: true)
Flipper.enable :vouchers
end

describe "a not-included tax" do
Expand Down