solidus_backend 1.0.7 → 1.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_backend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend.js +3 -0
- data/app/assets/javascripts/spree/backend/admin.js.erb +17 -24
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +3 -5
- data/app/assets/javascripts/spree/backend/flash.coffee +17 -0
- data/app/assets/javascripts/spree/backend/handlebars_extensions.coffee +9 -0
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
- data/app/assets/javascripts/spree/backend/option_value_picker.js +43 -0
- data/app/assets/javascripts/spree/backend/product_picker.js +10 -8
- data/app/assets/javascripts/spree/backend/promotions.js.coffee +101 -0
- data/app/assets/javascripts/spree/backend/routes.js +2 -1
- data/app/assets/javascripts/spree/backend/shipments.js.erb +1 -1
- data/app/assets/javascripts/spree/backend/stock_management/index_add_forms.coffee +1 -1
- data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
- data/app/assets/javascripts/spree/backend/stock_transfers/variant_form.coffee +1 -1
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
- data/app/assets/javascripts/spree/backend/taxons.js.coffee +6 -7
- data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/products/sortable.hbs +5 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_percent.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values.hbs +10 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values_select.hbs +1 -0
- data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +19 -0
- data/app/assets/javascripts/spree/backend/templates/stock_transfers/transfer_item.hbs.erb +52 -0
- data/app/assets/javascripts/spree/backend/templates/variants/autocomplete.hbs.erb +23 -0
- data/app/assets/javascripts/spree/backend/templates/variants/autocomplete_stock.hbs +51 -0
- data/app/assets/javascripts/spree/backend/templates/variants/line_items_autocomplete_stock.hbs +67 -0
- data/app/assets/javascripts/spree/backend/templates/variants/split.hbs +27 -0
- data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +6 -8
- data/app/assets/stylesheets/spree/backend/components/_messages.scss +6 -3
- data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +16 -0
- data/app/controllers/spree/admin/base_controller.rb +1 -1
- data/app/controllers/spree/admin/option_types_controller.rb +1 -3
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
- data/app/controllers/spree/admin/orders_controller.rb +6 -11
- data/app/controllers/spree/admin/product_properties_controller.rb +9 -0
- data/app/controllers/spree/admin/products_controller.rb +20 -5
- data/app/controllers/spree/admin/promotions_controller.rb +2 -1
- data/app/controllers/spree/admin/reimbursements_controller.rb +20 -0
- data/app/controllers/spree/admin/resource_controller.rb +1 -1
- data/app/controllers/spree/admin/return_authorizations_controller.rb +5 -0
- data/app/controllers/spree/admin/root_controller.rb +1 -1
- data/app/controllers/spree/admin/search_controller.rb +2 -4
- data/app/controllers/spree/admin/states_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_items_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_transfers_controller.rb +3 -14
- data/app/controllers/spree/admin/users_controller.rb +2 -3
- data/app/controllers/spree/admin/variant_property_rule_values_controller.rb +7 -0
- data/app/controllers/spree/admin/variants_controller.rb +1 -1
- data/app/controllers/spree/admin/zones_controller.rb +1 -1
- data/app/helpers/spree/admin/adjustments_helper.rb +4 -9
- data/app/helpers/spree/admin/base_helper.rb +7 -6
- data/app/helpers/spree/admin/navigation_helper.rb +8 -2
- data/app/helpers/spree/admin/orders_helper.rb +1 -1
- data/app/helpers/spree/admin/products_helper.rb +2 -4
- data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
- data/app/views/spree/admin/adjustments/_adjustment.html.erb +1 -1
- data/app/views/spree/admin/orders/_add_line_item.html.erb +0 -5
- data/app/views/spree/admin/orders/_add_product.html.erb +0 -3
- data/app/views/spree/admin/orders/_carton.html.erb +0 -1
- data/app/views/spree/admin/orders/_shipment.html.erb +0 -1
- data/app/views/spree/admin/orders/confirm/_shipment.html.erb +0 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/edit.html.erb +0 -1
- data/app/views/spree/admin/orders/index.html.erb +1 -2
- data/app/views/spree/admin/payment_methods/_form.html.erb +0 -4
- data/app/views/spree/admin/payment_methods/index.html.erb +0 -2
- data/app/views/spree/admin/payments/source_views/_gateway.html.erb +3 -0
- data/app/views/spree/admin/product_properties/index.html.erb +52 -2
- data/app/views/spree/admin/promotions/_actions.html.erb +14 -10
- data/app/views/spree/admin/promotions/_promotion_action.html.erb +5 -3
- data/app/views/spree/admin/promotions/_promotion_rule.html.erb +5 -3
- data/app/views/spree/admin/promotions/_rules.html.erb +18 -14
- data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +5 -28
- data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +5 -27
- data/app/views/spree/admin/promotions/edit.html.erb +6 -4
- data/app/views/spree/admin/promotions/index.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_option_value.html.erb +13 -0
- data/app/views/spree/admin/refund_reasons/index.html.erb +2 -2
- data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +2 -2
- data/app/views/spree/admin/search/users.rabl +1 -1
- data/app/views/spree/admin/shared/_order_summary.html.erb +6 -0
- data/app/views/spree/admin/shared/_tabs.html.erb +2 -2
- data/app/views/spree/admin/shared/_translations.html.erb +16 -46
- data/app/views/spree/admin/shared/named_types/_index.html.erb +2 -2
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +0 -2
- data/app/views/spree/admin/stock_movements/_form.html.erb +0 -2
- data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -3
- data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
- data/app/views/spree/admin/stock_transfers/show.html.erb +1 -1
- data/app/views/spree/admin/taxons/index.html.erb +0 -1
- data/app/views/spree/admin/users/_addresses_form.html.erb +4 -4
- data/app/views/spree/layouts/admin.html.erb +11 -9
- data/config/routes.rb +5 -0
- data/lib/spree/backend.rb +1 -2
- metadata +41 -139
- data/CHANGELOG.md +0 -1
- data/Gemfile +0 -6
- data/Rakefile +0 -15
- data/app/assets/javascripts/spree/backend/handlebar_extensions.js +0 -9
- data/app/assets/javascripts/spree/backend/promotions.js +0 -73
- data/app/assets/javascripts/spree/backend/stock_transfer.js.coffee +0 -196
- data/app/views/spree/admin/products/_autocomplete.js.erb +0 -14
- data/app/views/spree/admin/products/_sortable.html +0 -7
- data/app/views/spree/admin/stock_items/_stock_location_stock_item_template.html.erb +0 -21
- data/app/views/spree/admin/stock_transfers/_transfer_item_template.html.erb +0 -54
- data/app/views/spree/admin/variants/_autocomplete.js.erb +0 -25
- data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +0 -69
- data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +0 -53
- data/app/views/spree/admin/variants/_split.js.erb +0 -29
- data/script/rails +0 -9
- data/solidus_backend.gemspec +0 -30
- data/spec/controllers/spree/admin/base_controller_spec.rb +0 -24
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -77
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -234
- data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -80
- data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -472
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -49
- data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -175
- data/spec/controllers/spree/admin/products_controller_spec.rb +0 -45
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -75
- data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -134
- data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -166
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -226
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
- data/spec/controllers/spree/admin/root_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/search_controller_spec.rb +0 -104
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -50
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -331
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -309
- data/spec/controllers/spree/admin/users_controller_spec.rb +0 -236
- data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
- data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -54
- data/spec/features/admin/configuration/countries_spec.rb +0 -22
- data/spec/features/admin/configuration/general_settings_spec.rb +0 -45
- data/spec/features/admin/configuration/payment_methods_spec.rb +0 -125
- data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -64
- data/spec/features/admin/configuration/states_spec.rb +0 -64
- data/spec/features/admin/configuration/stock_locations_spec.rb +0 -50
- data/spec/features/admin/configuration/tax_categories_spec.rb +0 -56
- data/spec/features/admin/configuration/tax_rates_spec.rb +0 -30
- data/spec/features/admin/configuration/taxonomies_spec.rb +0 -52
- data/spec/features/admin/configuration/zones_spec.rb +0 -39
- data/spec/features/admin/homepage_spec.rb +0 -78
- data/spec/features/admin/locale_spec.rb +0 -30
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
- data/spec/features/admin/orders/adjustments_spec.rb +0 -126
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -48
- data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -48
- data/spec/features/admin/orders/customer_details_spec.rb +0 -163
- data/spec/features/admin/orders/line_items_spec.rb +0 -50
- data/spec/features/admin/orders/listing_spec.rb +0 -130
- data/spec/features/admin/orders/log_entries_spec.rb +0 -55
- data/spec/features/admin/orders/new_order_spec.rb +0 -197
- data/spec/features/admin/orders/order_details_spec.rb +0 -533
- data/spec/features/admin/orders/payments_spec.rb +0 -228
- data/spec/features/admin/orders/risk_analysis_spec.rb +0 -47
- data/spec/features/admin/orders/shipments_spec.rb +0 -65
- data/spec/features/admin/payments/store_credits_spec.rb +0 -21
- data/spec/features/admin/products/edit/images_spec.rb +0 -87
- data/spec/features/admin/products/edit/products_spec.rb +0 -66
- data/spec/features/admin/products/edit/taxons_spec.rb +0 -56
- data/spec/features/admin/products/edit/variants_spec.rb +0 -61
- data/spec/features/admin/products/option_types_spec.rb +0 -114
- data/spec/features/admin/products/products_spec.rb +0 -392
- data/spec/features/admin/products/properties_spec.rb +0 -139
- data/spec/features/admin/products/prototypes_spec.rb +0 -110
- data/spec/features/admin/products/stock_management_spec.rb +0 -82
- data/spec/features/admin/products/variant_spec.rb +0 -51
- data/spec/features/admin/promotion_adjustments_spec.rb +0 -220
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -69
- data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
- data/spec/features/admin/reports_spec.rb +0 -61
- data/spec/features/admin/stock_transfer_spec.rb +0 -86
- data/spec/features/admin/store_credits_spec.rb +0 -82
- data/spec/features/admin/taxons_spec.rb +0 -31
- data/spec/features/admin/users_spec.rb +0 -270
- data/spec/helpers/admin/base_helper_spec.rb +0 -24
- data/spec/helpers/admin/navigation_helper_spec.rb +0 -73
- data/spec/helpers/admin/reimbursements_helper_spec.rb +0 -34
- data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -95
- data/spec/helpers/promotion_rules_helper_spec.rb +0 -12
- data/spec/spec_helper.rb +0 -108
- data/spec/support/appear_before_matcher.rb +0 -8
- data/spec/support/ror_ringer.jpeg +0 -0
- data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
- data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
- data/vendor/assets/javascripts/handlebars.js +0 -2746
@@ -1,228 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Payments', :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
context "with a pre-existing payment" do
|
7
|
-
|
8
|
-
let!(:payment) do
|
9
|
-
create(:payment,
|
10
|
-
order: order,
|
11
|
-
amount: order.outstanding_balance,
|
12
|
-
payment_method: create(:credit_card_payment_method),
|
13
|
-
state: state
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
let(:order) { create(:completed_order_with_totals, number: 'R100', line_items_count: 5) }
|
18
|
-
let(:state) { 'checkout' }
|
19
|
-
|
20
|
-
before do
|
21
|
-
visit spree.admin_path
|
22
|
-
click_link 'Orders'
|
23
|
-
within_row(1) do
|
24
|
-
click_link order.number
|
25
|
-
end
|
26
|
-
click_link 'Payments'
|
27
|
-
end
|
28
|
-
|
29
|
-
def refresh_page
|
30
|
-
visit current_path
|
31
|
-
end
|
32
|
-
|
33
|
-
# Regression tests for #1453
|
34
|
-
context 'with a check payment' do
|
35
|
-
let(:order) { create(:completed_order_with_totals, number: 'R100') }
|
36
|
-
let!(:payment) do
|
37
|
-
create(:payment,
|
38
|
-
order: order,
|
39
|
-
amount: order.outstanding_balance,
|
40
|
-
payment_method: create(:check_payment_method) # Check
|
41
|
-
)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'capturing a check payment from a new order' do
|
45
|
-
click_icon(:capture)
|
46
|
-
expect(page).not_to have_content('Cannot perform requested operation')
|
47
|
-
expect(page).to have_content('Payment Updated')
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'voids a check payment from a new order' do
|
51
|
-
click_icon(:void)
|
52
|
-
expect(page).to have_content('Payment Updated')
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'should list all captures for a payment' do
|
57
|
-
capture_amount = order.outstanding_balance/2 * 100
|
58
|
-
payment.capture!(capture_amount)
|
59
|
-
|
60
|
-
visit spree.admin_order_payment_path(order, payment)
|
61
|
-
expect(page).to have_content 'Capture events'
|
62
|
-
# within '#capture_events' do
|
63
|
-
within_row(1) do
|
64
|
-
expect(page).to have_content(capture_amount / 100)
|
65
|
-
end
|
66
|
-
# end
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'lists and create payments for an order', js: true do
|
70
|
-
within_row(1) do
|
71
|
-
expect(column_text(3)).to eq('$150.00')
|
72
|
-
expect(column_text(4)).to eq('Credit Card')
|
73
|
-
expect(column_text(6)).to eq('CHECKOUT')
|
74
|
-
end
|
75
|
-
|
76
|
-
click_icon :void
|
77
|
-
expect(find('#payment_status').text).to eq('BALANCE DUE')
|
78
|
-
expect(page).to have_content('Payment Updated')
|
79
|
-
|
80
|
-
within_row(1) do
|
81
|
-
expect(column_text(3)).to eq('$150.00')
|
82
|
-
expect(column_text(4)).to eq('Credit Card')
|
83
|
-
expect(column_text(6)).to eq('VOID')
|
84
|
-
end
|
85
|
-
|
86
|
-
click_on 'New Payment'
|
87
|
-
expect(page).to have_content('New Payment')
|
88
|
-
click_button 'Update'
|
89
|
-
expect(page).to have_content('successfully created!')
|
90
|
-
|
91
|
-
click_icon(:capture)
|
92
|
-
expect(find('#payment_status').text).to eq('PAID')
|
93
|
-
|
94
|
-
expect(page).not_to have_selector('#new_payment_section')
|
95
|
-
end
|
96
|
-
|
97
|
-
# Regression test for #1269
|
98
|
-
it 'cannot create a payment for an order with no payment methods' do
|
99
|
-
Spree::PaymentMethod.delete_all
|
100
|
-
order.payments.delete_all
|
101
|
-
|
102
|
-
click_on 'New Payment'
|
103
|
-
expect(page).to have_content('You cannot create a payment for an order without any payment methods defined.')
|
104
|
-
expect(page).to have_content('Please define some payment methods first.')
|
105
|
-
end
|
106
|
-
|
107
|
-
context 'payment is pending', js: true do
|
108
|
-
let(:state) { 'pending' }
|
109
|
-
|
110
|
-
it 'allows the amount to be edited by clicking on the edit button then saving' do
|
111
|
-
within_row(1) do
|
112
|
-
click_icon(:edit)
|
113
|
-
fill_in('amount', with: '$1')
|
114
|
-
expect(page).to have_selector('td.amount span', text: '$1.00')
|
115
|
-
expect(payment.reload.amount).to eq(1.00)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
it 'allows the amount to be edited by clicking on the amount then saving' do
|
120
|
-
within_row(1) do
|
121
|
-
find('td.amount span').click
|
122
|
-
fill_in('amount', with: '$1.01')
|
123
|
-
expect(page).to have_selector('td.amount span', text: '$1.01')
|
124
|
-
expect(payment.reload.amount).to eq(1.01)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
it 'allows the amount change to be cancelled by clicking on the cancel button' do
|
129
|
-
within_row(1) do
|
130
|
-
click_icon(:edit)
|
131
|
-
|
132
|
-
# Can't use fill_in here, as under poltergeist that will unfocus (and
|
133
|
-
# thus submit) the field under poltergeist
|
134
|
-
find('td.amount input').click
|
135
|
-
page.execute_script("$('td.amount input').val('$1')")
|
136
|
-
|
137
|
-
click_icon(:cancel)
|
138
|
-
expect(page).to have_selector('td.amount span', text: '$150.00')
|
139
|
-
expect(payment.reload.amount).to eq(150.00)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'displays an error when the amount is invalid' do
|
144
|
-
within_row(1) do
|
145
|
-
click_icon(:edit)
|
146
|
-
fill_in('amount', with: 'invalid')
|
147
|
-
expect(find('td.amount input').value).to eq('invalid')
|
148
|
-
expect(payment.reload.amount).to eq(150.00)
|
149
|
-
end
|
150
|
-
expect(page).to have_selector('.flash.error', text: 'Invalid resource. Please fix errors and try again.')
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
context 'payment is completed', js: true do
|
155
|
-
let(:state) { 'completed' }
|
156
|
-
|
157
|
-
it 'does not allow the amount to be edited' do
|
158
|
-
within_row(1) do
|
159
|
-
expect(page).not_to have_selector('.fa-edit')
|
160
|
-
expect(page).not_to have_selector('td.amount span')
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
context "with no prior payments" do
|
167
|
-
let(:order) { create(:order_with_line_items, :line_items_count => 1) }
|
168
|
-
let!(:payment_method) { create(:credit_card_payment_method)}
|
169
|
-
|
170
|
-
# Regression tests for #4129
|
171
|
-
context "with a credit card payment method" do
|
172
|
-
before do
|
173
|
-
visit spree.admin_order_payments_path(order)
|
174
|
-
end
|
175
|
-
|
176
|
-
it "is able to create a new credit card payment with valid information", :js => true do
|
177
|
-
fill_in "Card Number", :with => "4111 1111 1111 1111"
|
178
|
-
fill_in "Name", :with => "Test User"
|
179
|
-
fill_in "Expiration", :with => "09 / #{Time.now.year + 1}"
|
180
|
-
fill_in "Card Code", :with => "007"
|
181
|
-
# Regression test for #4277
|
182
|
-
expect(page).to have_css('.ccType[value="visa"]', visible: false)
|
183
|
-
click_button "Continue"
|
184
|
-
expect(page).to have_content("Payment has been successfully created!")
|
185
|
-
end
|
186
|
-
|
187
|
-
it "is unable to create a new payment with invalid information" do
|
188
|
-
click_button "Continue"
|
189
|
-
expect(page).to have_content("Payment could not be created.")
|
190
|
-
expect(page).to have_content("Number can't be blank")
|
191
|
-
expect(page).to have_content("Name can't be blank")
|
192
|
-
expect(page).to have_content("Verification Value can't be blank")
|
193
|
-
expect(page).to have_content("Month is not a number")
|
194
|
-
expect(page).to have_content("Year is not a number")
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
context "user existing card" do
|
199
|
-
let!(:cc) do
|
200
|
-
create(:credit_card, user_id: order.user_id, payment_method: payment_method, gateway_customer_profile_id: "BGS-RFRE")
|
201
|
-
end
|
202
|
-
|
203
|
-
before { visit spree.admin_order_payments_path(order) }
|
204
|
-
|
205
|
-
it "is able to reuse customer payment source" do
|
206
|
-
expect(find("#card_#{cc.id}")).to be_checked
|
207
|
-
click_button "Continue"
|
208
|
-
expect(page).to have_content("Payment has been successfully created!")
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
context "with a check" do
|
213
|
-
let(:order) { create(:completed_order_with_totals, :line_items_count => 1) }
|
214
|
-
let!(:payment_method) { create(:check_payment_method) }
|
215
|
-
|
216
|
-
before do
|
217
|
-
visit spree.admin_order_payments_path(order.reload)
|
218
|
-
end
|
219
|
-
|
220
|
-
it "can successfully be created and captured" do
|
221
|
-
click_on 'Update'
|
222
|
-
expect(page).to have_content("Payment has been successfully created!")
|
223
|
-
click_icon(:capture)
|
224
|
-
expect(page).to have_content("Payment Updated")
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Order Risk Analysis', :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:order) do
|
7
|
-
create(:completed_order_with_pending_payment)
|
8
|
-
end
|
9
|
-
|
10
|
-
def visit_order
|
11
|
-
visit spree.admin_path
|
12
|
-
click_link 'Orders'
|
13
|
-
within_row(1) do
|
14
|
-
click_link order.number
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context "the order is considered risky" do
|
19
|
-
before do
|
20
|
-
allow_any_instance_of(Spree::Admin::BaseController).to receive_messages :try_spree_current_user => create(:user)
|
21
|
-
|
22
|
-
order.payments.first.update_column(:avs_response, 'N')
|
23
|
-
visit_order
|
24
|
-
end
|
25
|
-
|
26
|
-
it "displays 'Risk Analysis' box" do
|
27
|
-
expect(page).to have_content 'Risk Analysis'
|
28
|
-
end
|
29
|
-
|
30
|
-
it "can be approved" do
|
31
|
-
click_button('approve')
|
32
|
-
expect(page).to have_content 'Approver'
|
33
|
-
expect(page).to have_content 'Approved at'
|
34
|
-
expect(page).to have_content 'Status: complete'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context "the order is not considered risky" do
|
39
|
-
before do
|
40
|
-
visit_order
|
41
|
-
end
|
42
|
-
|
43
|
-
it "does not display 'Risk Analysis' box" do
|
44
|
-
expect(page).to_not have_content 'Risk Analysis'
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Shipments", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:order) { create(:order_ready_to_ship, :number => "R100", :state => "complete", :line_items_count => 5) }
|
7
|
-
|
8
|
-
# Regression test for #4025
|
9
|
-
context "a shipment without a shipping method" do
|
10
|
-
before do
|
11
|
-
order.shipments.each do |s|
|
12
|
-
# Deleting the shipping rates causes there to be no shipping methods
|
13
|
-
s.shipping_rates.delete_all
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it "can still be displayed" do
|
18
|
-
expect { visit spree.edit_admin_order_path(order) }.not_to raise_error
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "shipping an order", js: true do
|
23
|
-
before(:each) do
|
24
|
-
visit spree.admin_path
|
25
|
-
click_link "Orders"
|
26
|
-
within_row(1) do
|
27
|
-
click_link "R100"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it "can ship a completed order" do
|
32
|
-
find(".ship-shipment-button").click
|
33
|
-
wait_for_ajax
|
34
|
-
|
35
|
-
expect(page).to have_content("SHIPPED PACKAGE")
|
36
|
-
expect(order.reload.shipment_state).to eq("shipped")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context "moving variants between shipments", js: true do
|
41
|
-
let!(:order) { create(:completed_order_with_pending_payment, :number => "R100", :state => "complete", :line_items_count => 5) }
|
42
|
-
let!(:la) { create(:stock_location, name: "LA") }
|
43
|
-
before(:each) do
|
44
|
-
visit spree.admin_path
|
45
|
-
click_link "Orders"
|
46
|
-
within_row(1) do
|
47
|
-
click_link "R100"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
it "can move a variant to a new and to an existing shipment" do
|
52
|
-
expect(order.shipments.count).to eq(1)
|
53
|
-
|
54
|
-
within_row(1) { click_icon 'arrows-h' }
|
55
|
-
targetted_select2 'LA', from: '#s2id_item_stock_location'
|
56
|
-
click_icon :ok
|
57
|
-
expect(page).to have_css("#shipment_#{order.shipments.first.id}")
|
58
|
-
|
59
|
-
within_row(2) { click_icon 'arrows-h' }
|
60
|
-
targetted_select2 "LA(#{order.reload.shipments.last.number})", from: '#s2id_item_stock_location'
|
61
|
-
click_icon :ok
|
62
|
-
expect(page).to have_css("#shipment_#{order.reload.shipments.last.id}")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe 'Store credits', type: :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let(:order) { FactoryGirl.create(:completed_order_with_totals) }
|
7
|
-
let(:payment) do
|
8
|
-
FactoryGirl.create(
|
9
|
-
:store_credit_payment,
|
10
|
-
order: order,
|
11
|
-
amount: 20
|
12
|
-
)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "viewing a store credit payment" do
|
16
|
-
visit spree.admin_order_payment_path(order, payment)
|
17
|
-
|
18
|
-
expect(page).to have_content "Store Credit"
|
19
|
-
expect(page).to have_content "Amount: $20.00"
|
20
|
-
end
|
21
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Product Images", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let(:file_path) { Rails.root + "../../spec/support/ror_ringer.jpeg" }
|
7
|
-
|
8
|
-
before do
|
9
|
-
# Ensure attachment style keys are symbolized before running all tests
|
10
|
-
# Otherwise this would result in this error:
|
11
|
-
# undefined method `processors' for \"48x48>\
|
12
|
-
Spree::Image.attachment_definitions[:attachment][:styles].symbolize_keys!
|
13
|
-
end
|
14
|
-
|
15
|
-
context "uploading, editing, and deleting an image", :js => true do
|
16
|
-
it "should allow an admin to upload and edit an image for a product" do
|
17
|
-
Spree::Image.attachment_definitions[:attachment].delete :storage
|
18
|
-
|
19
|
-
create(:product)
|
20
|
-
|
21
|
-
visit spree.admin_path
|
22
|
-
click_link "Products"
|
23
|
-
click_icon(:edit)
|
24
|
-
click_link "Images"
|
25
|
-
click_link "new_image_link"
|
26
|
-
attach_file('image_attachment', file_path)
|
27
|
-
click_button "Update"
|
28
|
-
expect(page).to have_content("successfully created!")
|
29
|
-
|
30
|
-
click_icon(:edit)
|
31
|
-
fill_in "image_alt", :with => "ruby on rails t-shirt"
|
32
|
-
click_button "Update"
|
33
|
-
expect(page).to have_content("successfully updated!")
|
34
|
-
expect(page).to have_content("ruby on rails t-shirt")
|
35
|
-
|
36
|
-
accept_alert do
|
37
|
-
click_icon :trash
|
38
|
-
end
|
39
|
-
expect(page).not_to have_content("ruby on rails t-shirt")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# Regression test for #2228
|
44
|
-
it "should see variant images" do
|
45
|
-
variant = create(:variant)
|
46
|
-
variant.images.create!(:attachment => File.open(file_path))
|
47
|
-
visit spree.admin_product_images_path(variant.product)
|
48
|
-
|
49
|
-
expect(page).not_to have_content("No Images Found.")
|
50
|
-
within("table.index") do
|
51
|
-
expect(page).to have_content(variant.options_text)
|
52
|
-
|
53
|
-
#ensure no duplicate images are displayed
|
54
|
-
expect(page).to have_css("tbody tr", :count => 1)
|
55
|
-
|
56
|
-
#ensure variant header is displayed
|
57
|
-
within("thead") do
|
58
|
-
expect(page).to have_content("Variant")
|
59
|
-
end
|
60
|
-
|
61
|
-
#ensure variant header is displayed
|
62
|
-
within("tbody") do
|
63
|
-
expect(page).to have_content("Size: S")
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should not see variant column when product has no variants" do
|
69
|
-
product = create(:product)
|
70
|
-
product.images.create!(:attachment => File.open(file_path))
|
71
|
-
visit spree.admin_product_images_path(product)
|
72
|
-
|
73
|
-
expect(page).not_to have_content("No Images Found.")
|
74
|
-
within("table.index") do
|
75
|
-
#ensure no duplicate images are displayed
|
76
|
-
expect(page).to have_css("tbody tr", :count => 1)
|
77
|
-
|
78
|
-
#ensure variant header is not displayed
|
79
|
-
within("thead") do
|
80
|
-
expect(page).not_to have_content("Variant")
|
81
|
-
end
|
82
|
-
|
83
|
-
#ensure correct cell count
|
84
|
-
expect(page).to have_css("thead th", :count => 3)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|