solidus_core 2.1.1 → 2.2.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_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Rakefile +0 -1
- data/app/assets/config/solidus_core_manifest.js +1 -0
- data/app/assets/javascripts/spree.js.erb +72 -0
- data/app/helpers/spree/store_helper.rb +5 -0
- data/app/jobs/spree/promotion_code_batch_job.rb +24 -0
- data/app/mailers/spree/promotion_code_batch_mailer.rb +13 -0
- data/app/models/concerns/spree/calculated_adjustments.rb +1 -1
- data/app/models/concerns/spree/ordered_property_value_list.rb +2 -2
- data/app/models/concerns/spree/user_address_book.rb +4 -4
- data/app/models/concerns/spree/user_methods.rb +7 -0
- data/app/models/concerns/spree/user_payment_source.rb +12 -5
- data/app/models/spree/address.rb +14 -3
- data/app/models/spree/adjustment.rb +13 -1
- data/app/models/spree/app_configuration.rb +0 -19
- data/app/models/spree/base.rb +2 -0
- data/app/models/spree/credit_card.rb +34 -43
- data/app/models/spree/gateway/bogus.rb +1 -1
- data/app/models/spree/gateway.rb +6 -4
- data/app/models/spree/inventory_unit.rb +3 -2
- data/app/models/spree/order/checkout.rb +187 -273
- data/app/models/spree/order.rb +137 -71
- data/app/models/spree/order_contents.rb +1 -1
- data/app/models/spree/order_inventory.rb +11 -11
- data/app/models/spree/order_promotion.rb +2 -0
- data/app/models/spree/order_update_attributes.rb +1 -8
- data/app/models/spree/order_updater.rb +67 -63
- data/app/models/spree/payment.rb +0 -1
- data/app/models/spree/payment_create.rb +27 -7
- data/app/models/spree/payment_method/store_credit.rb +3 -3
- data/app/models/spree/payment_method.rb +4 -1
- data/app/models/spree/payment_source.rb +45 -0
- data/app/models/spree/product/scopes.rb +24 -24
- data/app/models/spree/product.rb +4 -4
- data/app/models/spree/promotion.rb +2 -0
- data/app/models/spree/promotion_code/batch_builder.rb +63 -0
- data/app/models/spree/promotion_code.rb +1 -0
- data/app/models/spree/promotion_code_batch.rb +25 -0
- data/app/models/spree/promotion_handler/cart.rb +2 -2
- data/app/models/spree/promotion_handler/coupon.rb +1 -2
- data/app/models/spree/promotion_handler/free_shipping.rb +32 -21
- data/app/models/spree/promotion_handler/page.rb +1 -1
- data/app/models/spree/reimbursement.rb +1 -1
- data/app/models/spree/return_authorization.rb +0 -28
- data/app/models/spree/return_item.rb +1 -1
- data/app/models/spree/shipment.rb +4 -4
- data/app/models/spree/shipping_method.rb +2 -2
- data/app/models/spree/shipping_rate.rb +1 -1
- data/app/models/spree/stock/availability_validator.rb +16 -17
- data/app/models/spree/stock/coordinator.rb +3 -3
- data/app/models/spree/stock/package.rb +1 -1
- data/app/models/spree/stock/quantifier.rb +5 -4
- data/app/models/spree/stock_location.rb +2 -2
- data/app/models/spree/store.rb +2 -2
- data/app/models/spree/store_credit.rb +1 -1
- data/app/models/spree/tax/tax_helpers.rb +3 -3
- data/app/models/spree/tax_rate.rb +7 -1
- data/app/models/spree/taxonomy.rb +1 -1
- data/app/models/spree/variant/scopes.rb +5 -5
- data/app/models/spree/variant/vat_price_generator.rb +8 -5
- data/app/models/spree/variant.rb +1 -0
- data/app/models/spree/wallet/add_payment_sources_to_wallet.rb +19 -10
- data/app/models/spree/wallet/default_payment_builder.rb +6 -6
- data/app/models/spree/wallet.rb +71 -0
- data/app/models/spree/wallet_payment_source.rb +17 -0
- data/app/models/spree/zone.rb +1 -1
- data/app/views/spree/carton_mailer/shipped_email.text.erb +1 -1
- data/app/views/spree/promotion_code_batch_mailer/promotion_code_batch_errored.text.erb +2 -0
- data/app/views/spree/promotion_code_batch_mailer/promotion_code_batch_finished.text.erb +2 -0
- data/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb +0 -7
- data/app/views/spree/reimbursement_mailer/reimbursement_email.text.erb +0 -5
- data/app/views/spree/shared/_error_messages.html.erb +1 -1
- data/app/views/spree/shipment_mailer/shipped_email.html.erb +1 -1
- data/config/initializers/assets.rb +1 -1
- data/config/initializers/friendly_id.rb +1 -1
- data/config/locales/en.yml +50 -12
- data/db/default/spree/store_credit.rb +2 -1
- data/db/migrate/20130826062534_add_depth_to_spree_taxons.rb +4 -6
- data/db/migrate/20160420044191_create_spree_wallet_payment_sources.rb +23 -0
- data/db/migrate/20160420181916_migrate_credit_cards_to_wallet_payment_sources.rb +26 -0
- data/db/migrate/20161017102621_create_spree_promotion_code_batch.rb +36 -0
- data/db/migrate/20161129035810_add_index_to_spree_payments_number.rb +5 -0
- data/db/migrate/20170223235001_remove_spree_store_credits_column.rb +5 -0
- data/lib/generators/spree/dummy/templates/rails/application.rb +1 -1
- data/lib/generators/spree/dummy/templates/rails/test.rb +1 -1
- data/lib/generators/spree/install/install_generator.rb +6 -5
- data/lib/spree/core/controller_helpers/payment_parameters.rb +54 -0
- data/lib/spree/core/engine.rb +6 -9
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +0 -1
- data/lib/spree/money.rb +18 -0
- data/lib/spree/permission_sets/default_customer.rb +1 -1
- data/lib/spree/permitted_attributes.rb +1 -1
- data/lib/spree/testing_support/authorization_helpers.rb +1 -0
- data/lib/spree/testing_support/capybara_ext.rb +13 -0
- data/lib/spree/testing_support/factories/order_factory.rb +5 -1
- data/lib/spree/testing_support/factories/payment_factory.rb +1 -1
- data/lib/spree/testing_support/factories/shipment_factory.rb +0 -1
- data/solidus_core.gemspec +3 -3
- data/spec/jobs/promotion_code_batch_job_spec.rb +65 -0
- data/spec/lib/calculated_adjustments_spec.rb +105 -1
- data/spec/lib/spree/core/testing_support/factories/order_factory_spec.rb +4 -1
- data/spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb +8 -0
- data/spec/lib/spree/money_spec.rb +32 -0
- data/spec/lib/spree/permission_sets/default_customer_spec.rb +20 -0
- data/spec/mailers/promotion_code_batch_mailer_spec.rb +45 -0
- data/spec/models/spree/credit_card_spec.rb +86 -86
- data/spec/models/spree/gateway_spec.rb +3 -1
- data/spec/models/spree/inventory_unit_spec.rb +12 -4
- data/spec/models/spree/order/checkout_spec.rb +11 -32
- data/spec/models/spree/order/tax_spec.rb +2 -2
- data/spec/models/spree/order_contents_spec.rb +24 -1
- data/spec/models/spree/order_inventory_spec.rb +130 -83
- data/spec/models/spree/order_spec.rb +15 -117
- data/spec/models/spree/order_update_attributes_spec.rb +1 -44
- data/spec/models/spree/order_updater_spec.rb +10 -13
- data/spec/models/spree/payment_create_spec.rb +5 -1
- data/spec/models/spree/payment_method_spec.rb +16 -0
- data/spec/models/spree/payment_spec.rb +14 -8
- data/spec/models/spree/promotion_code/batch_builder_spec.rb +61 -0
- data/spec/models/spree/promotion_code_batch_spec.rb +58 -0
- data/spec/models/spree/promotion_code_spec.rb +4 -0
- data/spec/models/spree/promotion_spec.rb +3 -6
- data/spec/models/spree/return_authorization_spec.rb +0 -59
- data/spec/models/spree/shipment_spec.rb +4 -4
- data/spec/models/spree/stock/availability_validator_spec.rb +64 -9
- data/spec/models/spree/tax/item_adjuster_spec.rb +1 -2
- data/spec/models/spree/unit_cancel_spec.rb +0 -85
- data/spec/models/spree/user_spec.rb +3 -1
- data/spec/models/spree/variant/vat_price_generator_spec.rb +8 -2
- data/spec/models/spree/variant_spec.rb +16 -4
- data/spec/models/spree/wallet_payment_source_spec.rb +46 -0
- data/spec/models/spree/wallet_spec.rb +128 -0
- data/spec/support/concerns/payment_source.rb +64 -0
- metadata +51 -25
- data/app/assets/javascripts/spree.js.coffee.erb +0 -64
- data/app/models/spree/promotion_builder.rb +0 -55
- data/app/models/spree/promotion_code/code_builder.rb +0 -62
- data/config/initializers/premailer_assets.rb +0 -1
- data/lib/spree/core/unreturned_item_charger.rb +0 -106
- data/lib/tasks/exchanges.rake +0 -47
- data/spec/lib/spree/core/unreturned_item_charger_spec.rb +0 -126
- data/spec/lib/tasks/exchanges_spec.rb +0 -220
- data/spec/models/spree/promotion_builder_spec.rb +0 -120
- data/spec/models/spree/promotion_code/code_builder_spec.rb +0 -77
data/config/locales/en.yml
CHANGED
@@ -29,6 +29,8 @@ en:
|
|
29
29
|
code: Code
|
30
30
|
name: Name
|
31
31
|
state: State
|
32
|
+
spree/calculator/flat_rate:
|
33
|
+
preferred_amount: Amount
|
32
34
|
spree/calculator/tiered_flat_rate:
|
33
35
|
preferred_base_amount: Base Amount
|
34
36
|
preferred_tiers: Tiers
|
@@ -166,12 +168,12 @@ en:
|
|
166
168
|
code: Code
|
167
169
|
description: Description
|
168
170
|
event_name: Event Name
|
169
|
-
expires_at: Expiration
|
171
|
+
expires_at: Expiration date
|
170
172
|
name: Name
|
171
173
|
path: Path
|
172
174
|
per_code_usage_limit: Per Code Usage Limit
|
173
175
|
promotion_uses: Promotion Uses
|
174
|
-
starts_at:
|
176
|
+
starts_at: Start date
|
175
177
|
usage_limit: Overall Usage Limit
|
176
178
|
spree/promotion_category:
|
177
179
|
name: Name
|
@@ -468,6 +470,12 @@ en:
|
|
468
470
|
spree/promotion_category:
|
469
471
|
one: Promotion Category
|
470
472
|
other: Promotion Categories
|
473
|
+
spree/promotion_code_batch:
|
474
|
+
one: Promotion Code Batch
|
475
|
+
other: Promotion Code Batches
|
476
|
+
spree/promotion_code:
|
477
|
+
one: Promotion Code
|
478
|
+
other: Promotion Codes
|
471
479
|
spree/property:
|
472
480
|
one: Property Type
|
473
481
|
other: Property Types
|
@@ -517,6 +525,9 @@ en:
|
|
517
525
|
spree/stock_transfer:
|
518
526
|
one: Stock Transfer
|
519
527
|
other: Stock Transfers
|
528
|
+
spree/store:
|
529
|
+
one: Store
|
530
|
+
other: Stores
|
520
531
|
spree/store_credit:
|
521
532
|
one: Store Credit
|
522
533
|
other: Store Credits
|
@@ -621,6 +632,10 @@ en:
|
|
621
632
|
attributes:
|
622
633
|
user_id:
|
623
634
|
default_address_exists: "already has a default address"
|
635
|
+
spree/wallet_payment_source:
|
636
|
+
attributes:
|
637
|
+
payment_source:
|
638
|
+
has_to_be_payment_source_class: "has to be a Spree::PaymentSource"
|
624
639
|
|
625
640
|
devise:
|
626
641
|
confirmations:
|
@@ -642,7 +657,7 @@ en:
|
|
642
657
|
unlock_instructions:
|
643
658
|
subject: Unlock Instructions
|
644
659
|
oauth_callbacks:
|
645
|
-
failure: Could not authorize you from %{kind} because
|
660
|
+
failure: "Could not authorize you from %{kind} because %{reason}."
|
646
661
|
success: Successfully authorized from %{kind} account.
|
647
662
|
unlocks:
|
648
663
|
send_instructions: You will receive an email with instructions about how to unlock your account in a few minutes.
|
@@ -688,14 +703,13 @@ en:
|
|
688
703
|
list: List
|
689
704
|
listing: Listing
|
690
705
|
new: New
|
691
|
-
refund: Refund
|
692
706
|
receive: Receive
|
707
|
+
refund: Refund
|
693
708
|
remove: Remove
|
694
709
|
save: Save
|
695
|
-
ship:
|
696
|
-
update: Update
|
710
|
+
ship: Ship
|
697
711
|
split: Split
|
698
|
-
|
712
|
+
update: Update
|
699
713
|
activate: Activate
|
700
714
|
active: Active
|
701
715
|
add: Add
|
@@ -703,6 +717,7 @@ en:
|
|
703
717
|
add_action_of_type: Add action of type
|
704
718
|
add_country: Add Country
|
705
719
|
add_coupon_code: Add Coupon Code
|
720
|
+
add_line_item: Add Item
|
706
721
|
add_new_header: Add New Header
|
707
722
|
add_new_style: Add New Style
|
708
723
|
add_one: Add One
|
@@ -743,8 +758,8 @@ en:
|
|
743
758
|
adjustment_total: Adjustment Total
|
744
759
|
adjustments: Adjustments
|
745
760
|
admin:
|
746
|
-
|
747
|
-
|
761
|
+
stores:
|
762
|
+
form:
|
748
763
|
no_cart_tax_country: "No taxes on carts without address"
|
749
764
|
images:
|
750
765
|
index:
|
@@ -770,6 +785,17 @@ en:
|
|
770
785
|
form:
|
771
786
|
starts_at_placeholder: Immediately
|
772
787
|
expires_at_placeholder: Never
|
788
|
+
activation: Activation
|
789
|
+
general: General
|
790
|
+
activations_new:
|
791
|
+
auto: Apply to all orders
|
792
|
+
multiple_codes: Multiple promotion codes
|
793
|
+
path: URL Path
|
794
|
+
single_code: Single promotion code
|
795
|
+
activations_edit:
|
796
|
+
auto: All orders will attempt to use this promotion
|
797
|
+
single_code_html: "This promotion uses the promotion code: <code>%{code}</code>"
|
798
|
+
multiple_codes_html: "This promotion uses %{count} promotion codes"
|
773
799
|
store_credits:
|
774
800
|
add: "Add store credit"
|
775
801
|
amount_authorized: "Amount Authorized"
|
@@ -816,7 +842,6 @@ en:
|
|
816
842
|
checkout: Refunds and Returns
|
817
843
|
configuration: Configuration
|
818
844
|
display_order: Display Order
|
819
|
-
general: Store
|
820
845
|
option_types: Option Types
|
821
846
|
orders: Orders
|
822
847
|
overview: Overview
|
@@ -832,6 +857,7 @@ en:
|
|
832
857
|
stock: Stock
|
833
858
|
stock_items: Store Stock
|
834
859
|
stock_transfers: Stock Transfers
|
860
|
+
stores: Stores
|
835
861
|
taxes: Taxes
|
836
862
|
taxonomies: Taxonomies
|
837
863
|
taxons: Taxons
|
@@ -1168,7 +1194,6 @@ en:
|
|
1168
1194
|
exceptions:
|
1169
1195
|
count_on_hand_setter: Cannot set count_on_hand manually, as it is set automatically by the recalculate_count_on_hand callback. Please use `update_column(:count_on_hand, value)` instead.
|
1170
1196
|
exchange_for: Exchange for
|
1171
|
-
expedited_exchanges_warning: "Any specified exchanges will ship to the customer immediately upon saving. The customer will be charged the full amount of the item if they do not return the original item within %{days_window} days."
|
1172
1197
|
excl: excl.
|
1173
1198
|
expected: Expected
|
1174
1199
|
expected_items: Expected Items
|
@@ -1280,7 +1305,7 @@ en:
|
|
1280
1305
|
inventory: Inventory
|
1281
1306
|
inventory_adjustment: Inventory Adjustment
|
1282
1307
|
inventory_canceled: Inventory canceled
|
1283
|
-
inventory_error_flash_for_insufficient_quantity:
|
1308
|
+
inventory_error_flash_for_insufficient_quantity: "#{names} became unavailable."
|
1284
1309
|
inventory_not_available: Inventory not available for %{item}.
|
1285
1310
|
inventory_state: Inventory State
|
1286
1311
|
inventory_states:
|
@@ -1376,6 +1401,7 @@ en:
|
|
1376
1401
|
new_product: New Product
|
1377
1402
|
new_promotion: New Promotion
|
1378
1403
|
new_promotion_category: New Promotion Category
|
1404
|
+
new_promotion_code_batch: New Promotion Code Batch
|
1379
1405
|
new_property: New Property Type
|
1380
1406
|
new_refund: New Refund
|
1381
1407
|
new_refund_reason: New Refund Reason
|
@@ -1389,6 +1415,7 @@ en:
|
|
1389
1415
|
new_stock_movement: New Stock Movement
|
1390
1416
|
new_stock_transfer: New Stock Transfer
|
1391
1417
|
new_store_credit: New Store Credit
|
1418
|
+
new_store: New Store
|
1392
1419
|
new_tax_category: New Tax Category
|
1393
1420
|
new_tax_rate: New Tax Rate
|
1394
1421
|
new_taxon: New Taxon
|
@@ -1599,6 +1626,17 @@ en:
|
|
1599
1626
|
description: Makes all shipments for the order free
|
1600
1627
|
name: Free shipping
|
1601
1628
|
promotion_actions: Actions
|
1629
|
+
promotion_code_batch_mailer:
|
1630
|
+
promotion_code_batch_finished:
|
1631
|
+
subject: Promotion code batch finished
|
1632
|
+
message: "All %{number_of_codes} codes have been created for promotion: "
|
1633
|
+
promotion_code_batch_errored:
|
1634
|
+
subject: Promotion code batch errored
|
1635
|
+
message: "Promotion code batch errored (%{error}) for promotion: "
|
1636
|
+
promotion_code_batches:
|
1637
|
+
errored: "Errored: %{error}"
|
1638
|
+
finished: "All %{number_of_codes} codes have been created."
|
1639
|
+
processing: "Processing: %{number_of_codes_processed} / %{number_of_codes}"
|
1602
1640
|
promotion_form:
|
1603
1641
|
match_policies:
|
1604
1642
|
all: Match all of these rules
|
@@ -1,12 +1,10 @@
|
|
1
1
|
class AddDepthToSpreeTaxons < ActiveRecord::Migration[4.2]
|
2
2
|
def up
|
3
|
-
|
4
|
-
add_column :spree_taxons, :depth, :integer
|
3
|
+
add_column :spree_taxons, :depth, :integer
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
5
|
+
say_with_time 'Update depth on all taxons' do
|
6
|
+
Spree::Taxon.reset_column_information
|
7
|
+
Spree::Taxon.all.each(&:save)
|
10
8
|
end
|
11
9
|
end
|
12
10
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateSpreeWalletPaymentSources < ActiveRecord::Migration[4.2]
|
2
|
+
def change
|
3
|
+
create_table :spree_wallet_payment_sources do |t|
|
4
|
+
t.references(
|
5
|
+
:user,
|
6
|
+
foreign_key: { to_table: Spree.user_class.table_name },
|
7
|
+
index: true,
|
8
|
+
null: false,
|
9
|
+
)
|
10
|
+
t.references :payment_source, polymorphic: true, null: false
|
11
|
+
t.boolean :default, default: false, null: false
|
12
|
+
|
13
|
+
t.timestamps null: false
|
14
|
+
end
|
15
|
+
|
16
|
+
add_index(
|
17
|
+
:spree_wallet_payment_sources,
|
18
|
+
[:user_id, :payment_source_id, :payment_source_type],
|
19
|
+
unique: true,
|
20
|
+
name: 'index_spree_wallet_payment_sources_on_source_and_user',
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class MigrateCreditCardsToWalletPaymentSources < ActiveRecord::Migration[4.2]
|
2
|
+
class CreditCard < ActiveRecord::Base
|
3
|
+
self.table_name = 'spree_credit_cards'
|
4
|
+
end
|
5
|
+
class WalletPaymentSource < ActiveRecord::Base
|
6
|
+
self.table_name = 'spree_wallet_payment_sources'
|
7
|
+
end
|
8
|
+
|
9
|
+
def up
|
10
|
+
credit_cards = CreditCard.
|
11
|
+
where.not(gateway_customer_profile_id: nil).
|
12
|
+
where.not(user_id: nil)
|
13
|
+
|
14
|
+
credit_cards.find_each do |credit_card|
|
15
|
+
WalletPaymentSource.find_or_create_by!(
|
16
|
+
user_id: credit_card.user_id,
|
17
|
+
payment_source: credit_card
|
18
|
+
) do |wallet_source|
|
19
|
+
wallet_source.default = credit_card.default
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def down
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class CreateSpreePromotionCodeBatch < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :spree_promotion_code_batches do |t|
|
4
|
+
t.references :promotion, null: false, index: true
|
5
|
+
t.string :base_code, null: false
|
6
|
+
t.integer :number_of_codes, null: false
|
7
|
+
t.string :email
|
8
|
+
t.string :error
|
9
|
+
t.string :state, default: "pending"
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_foreign_key(
|
14
|
+
:spree_promotion_code_batches,
|
15
|
+
:spree_promotions,
|
16
|
+
column: :promotion_id
|
17
|
+
)
|
18
|
+
|
19
|
+
add_column(
|
20
|
+
:spree_promotion_codes,
|
21
|
+
:promotion_code_batch_id,
|
22
|
+
:integer
|
23
|
+
)
|
24
|
+
|
25
|
+
add_foreign_key(
|
26
|
+
:spree_promotion_codes,
|
27
|
+
:spree_promotion_code_batches,
|
28
|
+
column: :promotion_code_batch_id
|
29
|
+
)
|
30
|
+
|
31
|
+
add_index(
|
32
|
+
:spree_promotion_codes,
|
33
|
+
:promotion_code_batch_id
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
@@ -27,7 +27,7 @@ Dummy::Application.configure do
|
|
27
27
|
# The :test delivery method accumulates sent emails in the
|
28
28
|
# ActionMailer::Base.deliveries array.
|
29
29
|
config.action_mailer.delivery_method = :test
|
30
|
-
ActionMailer::Base.default :
|
30
|
+
ActionMailer::Base.default from: "spree@example.com"
|
31
31
|
|
32
32
|
# Raise on deprecation warnings
|
33
33
|
if ENV['SOLIDUS_RAISE_DEPRECATIONS'].present?
|
@@ -149,23 +149,24 @@ Spree::Auth::Engine.load_seed if defined?(Spree::Auth)
|
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
|
-
def
|
152
|
+
def install_routes
|
153
153
|
insert_into_file File.join('config', 'routes.rb'), after: "Rails.application.routes.draw do\n" do
|
154
|
-
|
154
|
+
<<-ROUTES
|
155
155
|
# This line mounts Spree's routes at the root of your application.
|
156
156
|
# This means, any requests to URLs such as /products, will go to Spree::ProductsController.
|
157
157
|
# If you would like to change where this engine is mounted, simply change the :at option to something different.
|
158
158
|
#
|
159
159
|
# We ask that you don't use the :as option here, as Spree relies on it being the default of "spree"
|
160
|
-
mount Spree::Core::Engine, :
|
161
|
-
|
160
|
+
mount Spree::Core::Engine, at: '/'
|
161
|
+
|
162
|
+
ROUTES
|
162
163
|
end
|
163
164
|
|
164
165
|
unless options[:quiet]
|
165
166
|
puts "*" * 50
|
166
167
|
puts "We added the following line to your application's config/routes.rb file:"
|
167
168
|
puts " "
|
168
|
-
puts " mount Spree::Core::Engine, :
|
169
|
+
puts " mount Spree::Core::Engine, at: '/'"
|
169
170
|
end
|
170
171
|
end
|
171
172
|
|
@@ -116,6 +116,60 @@ module Spree
|
|
116
116
|
params
|
117
117
|
end
|
118
118
|
|
119
|
+
# This method handles the awkwardness of how the html forms are currently
|
120
|
+
# set up for frontend.
|
121
|
+
#
|
122
|
+
# This method expects a params hash in the format of:
|
123
|
+
#
|
124
|
+
# {
|
125
|
+
# order: {
|
126
|
+
# wallet_payment_source_id: '123',
|
127
|
+
# ...other params...
|
128
|
+
# },
|
129
|
+
# cvc_confirm: '456', # optional
|
130
|
+
# ...other params...
|
131
|
+
# }
|
132
|
+
#
|
133
|
+
# And this method modifies the params into the format of:
|
134
|
+
#
|
135
|
+
# {
|
136
|
+
# order: {
|
137
|
+
# payments_attributes: [
|
138
|
+
# {
|
139
|
+
# source_attributes: {
|
140
|
+
# wallet_payment_source_id: '123',
|
141
|
+
# verification_value: '456',
|
142
|
+
# },
|
143
|
+
# },
|
144
|
+
# ]
|
145
|
+
# ...other params...
|
146
|
+
# },
|
147
|
+
# ...other params...
|
148
|
+
# }
|
149
|
+
#
|
150
|
+
def move_wallet_payment_source_id_into_payments_attributes(params)
|
151
|
+
return params if params[:order].blank?
|
152
|
+
|
153
|
+
wallet_payment_source_id = params[:order][:wallet_payment_source_id].presence
|
154
|
+
cvc_confirm = params[:cvc_confirm].presence
|
155
|
+
|
156
|
+
return params if wallet_payment_source_id.nil?
|
157
|
+
|
158
|
+
params[:order][:payments_attributes] = [
|
159
|
+
{
|
160
|
+
source_attributes: {
|
161
|
+
wallet_payment_source_id: wallet_payment_source_id,
|
162
|
+
verification_value: cvc_confirm
|
163
|
+
}
|
164
|
+
}
|
165
|
+
]
|
166
|
+
|
167
|
+
params[:order].delete(:wallet_payment_source_id)
|
168
|
+
params.delete(:cvc_confirm)
|
169
|
+
|
170
|
+
params
|
171
|
+
end
|
172
|
+
|
119
173
|
# This is a strange thing to do since an order can have multiple payments
|
120
174
|
# but we always assume that it only has a single payment and that its
|
121
175
|
# amount should be the current order total. Also, this is pretty much
|
data/lib/spree/core/engine.rb
CHANGED
@@ -4,10 +4,6 @@ module Spree
|
|
4
4
|
isolate_namespace Spree
|
5
5
|
engine_name 'spree'
|
6
6
|
|
7
|
-
rake_tasks do
|
8
|
-
load File.join(root, "lib", "tasks", "exchanges.rake")
|
9
|
-
end
|
10
|
-
|
11
7
|
config.generators do |g|
|
12
8
|
g.test_framework :rspec
|
13
9
|
end
|
@@ -108,13 +104,14 @@ module Spree
|
|
108
104
|
]
|
109
105
|
end
|
110
106
|
|
111
|
-
#
|
107
|
+
# Filter sensitive information during logging
|
112
108
|
initializer "spree.params.filter", before: :load_config_initializers do |app|
|
113
109
|
app.config.filter_parameters += [
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
110
|
+
%r{^password$},
|
111
|
+
%r{^password_confirmation$},
|
112
|
+
%r{^number$}, # Credit Card number
|
113
|
+
%r{^verification_value$} # Credit Card verification value
|
114
|
+
]
|
118
115
|
end
|
119
116
|
|
120
117
|
initializer "spree.core.checking_migrations", before: :load_config_initializers do |_app|
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree/core.rb
CHANGED
@@ -80,7 +80,6 @@ require 'spree/core/controller_helpers/respond_with'
|
|
80
80
|
require 'spree/core/controller_helpers/search'
|
81
81
|
require 'spree/core/controller_helpers/store'
|
82
82
|
require 'spree/core/controller_helpers/strong_parameters'
|
83
|
-
require 'spree/core/unreturned_item_charger'
|
84
83
|
require 'spree/core/role_configuration'
|
85
84
|
require 'spree/core/stock_configuration'
|
86
85
|
require 'spree/permission_sets'
|
data/lib/spree/money.rb
CHANGED
@@ -6,6 +6,8 @@ module Spree
|
|
6
6
|
# Spree::Money is a relatively thin wrapper around Monetize which handles
|
7
7
|
# formatting via Spree::Config.
|
8
8
|
class Money
|
9
|
+
include Comparable
|
10
|
+
DifferentCurrencyError = Class.new(StandardError)
|
9
11
|
RUBY_NUMERIC_STRING = /\A-?\d+(\.\d+)?\z/
|
10
12
|
|
11
13
|
class <<self
|
@@ -92,6 +94,22 @@ module Spree
|
|
92
94
|
to_s
|
93
95
|
end
|
94
96
|
|
97
|
+
def <=>(other)
|
98
|
+
if !other.respond_to?(:money)
|
99
|
+
raise TypeError, "Can't compare #{other.class} to Spree::Money"
|
100
|
+
end
|
101
|
+
if self.currency != other.currency
|
102
|
+
# By default, ::Money will try to run a conversion on `other.money` and
|
103
|
+
# try a comparison on that. We do not want any currency conversion to
|
104
|
+
# take place so we'll catch this here and raise an error.
|
105
|
+
raise(
|
106
|
+
DifferentCurrencyError,
|
107
|
+
"Can't compare #{self.currency} with #{other.currency}"
|
108
|
+
)
|
109
|
+
end
|
110
|
+
@money <=> other.money
|
111
|
+
end
|
112
|
+
|
95
113
|
# Delegates comparison to the internal ruby money instance.
|
96
114
|
#
|
97
115
|
# @see http://www.rubydoc.info/gems/money/Money/Arithmetic#%3D%3D-instance_method
|
@@ -7,7 +7,7 @@ module Spree
|
|
7
7
|
can :display, OptionValue
|
8
8
|
can :create, Order
|
9
9
|
can [:read, :update], Order do |order, token|
|
10
|
-
order.user == user || order.guest_token && token == order.guest_token
|
10
|
+
order.user == user || (order.guest_token.present? && token == order.guest_token)
|
11
11
|
end
|
12
12
|
can :create, ReturnAuthorization do |return_authorization|
|
13
13
|
return_authorization.order.user == user
|
@@ -88,7 +88,7 @@ module Spree
|
|
88
88
|
:number, :month, :year, :expiry, :verification_value,
|
89
89
|
:first_name, :last_name, :cc_type, :gateway_customer_profile_id,
|
90
90
|
:gateway_payment_profile_id, :last_digits, :name, :encrypted_data,
|
91
|
-
:existing_card_id
|
91
|
+
:existing_card_id, :wallet_payment_source_id
|
92
92
|
]
|
93
93
|
|
94
94
|
@@stock_item_attributes = [:variant, :stock_location, :backorderable, :variant_id]
|
@@ -60,4 +60,5 @@ end
|
|
60
60
|
RSpec.configure do |config|
|
61
61
|
config.extend Spree::TestingSupport::AuthorizationHelpers::Controller, type: :controller
|
62
62
|
config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :feature
|
63
|
+
config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :request
|
63
64
|
end
|
@@ -20,6 +20,12 @@ module CapybaraExt
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def fill_in_quantity(table_column, selector, quantity)
|
23
|
+
Spree::Deprecation.warn <<-WARN.strip_heredoc
|
24
|
+
fill_in_quantity is deprecated. Instead use:
|
25
|
+
within(#{table_column.inspect}) do
|
26
|
+
fill_in #{selector.inspect}, with: #{quantity.inspect}
|
27
|
+
end
|
28
|
+
WARN
|
23
29
|
within(table_column) do
|
24
30
|
fill_in selector, with: quantity
|
25
31
|
end
|
@@ -100,6 +106,13 @@ module CapybaraExt
|
|
100
106
|
end
|
101
107
|
|
102
108
|
def wait_for_ajax
|
109
|
+
|
110
|
+
Spree::Deprecation.warn <<-WARN.squish, caller
|
111
|
+
wait_for_ajax has been deprecated.
|
112
|
+
Please refer to the capybara documentation on how to properly wait for asyncronous behavior:
|
113
|
+
https://github.com/teamcapybara/capybara#asynchronous-javascript-ajax-and-friends
|
114
|
+
WARN
|
115
|
+
|
103
116
|
counter = 0
|
104
117
|
while page.evaluate_script("typeof($) === 'undefined' || $.active > 0")
|
105
118
|
counter += 1
|
@@ -76,6 +76,9 @@ FactoryGirl.define do
|
|
76
76
|
|
77
77
|
after(:create) do |order|
|
78
78
|
order.refresh_shipment_rates
|
79
|
+
order.shipments.each do |shipment|
|
80
|
+
shipment.inventory_units.update_all state: 'on_hand', pending: false
|
81
|
+
end
|
79
82
|
order.update_column(:completed_at, Time.current)
|
80
83
|
end
|
81
84
|
|
@@ -96,7 +99,6 @@ FactoryGirl.define do
|
|
96
99
|
after(:create) do |order, evaluator|
|
97
100
|
create(evaluator.payment_type, amount: order.total, order: order, state: 'completed')
|
98
101
|
order.shipments.each do |shipment|
|
99
|
-
shipment.inventory_units.update_all state: 'on_hand'
|
100
102
|
shipment.update_column('state', 'ready')
|
101
103
|
end
|
102
104
|
order.reload
|
@@ -119,6 +121,8 @@ FactoryGirl.define do
|
|
119
121
|
shipped_at: Time.current
|
120
122
|
)
|
121
123
|
end
|
124
|
+
# We need to update the shipment_state after all callbacks have run
|
125
|
+
order.update_columns(shipment_state: 'shipped')
|
122
126
|
order.reload
|
123
127
|
end
|
124
128
|
end
|
@@ -6,7 +6,7 @@ require 'spree/testing_support/factories/store_credit_factory'
|
|
6
6
|
FactoryGirl.define do
|
7
7
|
factory :payment, aliases: [:credit_card_payment], class: Spree::Payment do
|
8
8
|
association(:payment_method, factory: :credit_card_payment_method)
|
9
|
-
source { create(:credit_card, user: order.user) }
|
9
|
+
source { create(:credit_card, user: order.user, address: order.bill_address) }
|
10
10
|
order
|
11
11
|
state 'checkout'
|
12
12
|
response_code '12345'
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spree/testing_support/factories/order_factory'
|
2
2
|
require 'spree/testing_support/factories/stock_location_factory'
|
3
3
|
require 'spree/testing_support/factories/shipping_method_factory'
|
4
|
-
require 'spree/testing_support/factories/stock_location_factory'
|
5
4
|
|
6
5
|
FactoryGirl.define do
|
7
6
|
factory :shipment, class: Spree::Shipment do
|
data/solidus_core.gemspec
CHANGED
@@ -28,9 +28,9 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_dependency 'ffaker', '~> 2.0'
|
29
29
|
s.add_dependency 'friendly_id', '~> 5.0'
|
30
30
|
s.add_dependency 'highline', '~> 1.7' # Necessary for the install generator
|
31
|
-
s.add_dependency 'kaminari', '
|
31
|
+
s.add_dependency 'kaminari', '>= 0.17', '< 2.0'
|
32
32
|
s.add_dependency 'monetize', '~> 1.1'
|
33
|
-
s.add_dependency 'paperclip', '
|
33
|
+
s.add_dependency 'paperclip', ['>= 4.2', '< 6']
|
34
34
|
s.add_dependency 'paranoia', '~> 2.2.0.pre'
|
35
35
|
s.add_dependency 'premailer-rails'
|
36
36
|
s.add_dependency 'rails', '~> 5.0.0'
|
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
|
|
39
39
|
s.add_dependency 'state_machines-activerecord', '~> 0.4'
|
40
40
|
s.add_dependency 'stringex', '~> 1.5.1'
|
41
41
|
s.add_dependency 'truncate_html', '~> 0.9', '>= 0.9.2'
|
42
|
-
s.add_dependency 'twitter_cldr', '
|
42
|
+
s.add_dependency 'twitter_cldr', '>= 3.0', '< 5'
|
43
43
|
|
44
44
|
s.add_development_dependency 'email_spec', '~> 1.6'
|
45
45
|
end
|