solidus_subscriptions 1.0.0.rc1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +57 -9
  3. data/.github/dependabot.yml +7 -0
  4. data/.rubocop.yml +3 -0
  5. data/CHANGELOG.md +201 -163
  6. data/Gemfile +14 -1
  7. data/README.md +17 -7
  8. data/app/controllers/solidus_subscriptions/api/v1/subscriptions_controller.rb +25 -1
  9. data/app/controllers/spree/admin/subscriptions_controller.rb +32 -4
  10. data/app/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions.rb +2 -2
  11. data/app/decorators/models/solidus_subscriptions/spree/wallet_payment_source/report_default_change_to_subscriptions.rb +2 -2
  12. data/app/jobs/solidus_subscriptions/create_subscription_job.rb +11 -0
  13. data/app/jobs/solidus_subscriptions/process_installment_job.rb +1 -1
  14. data/app/models/solidus_subscriptions/subscription.rb +75 -31
  15. data/app/subscribers/solidus_subscriptions/churn_buster_subscriber.rb +1 -0
  16. data/app/subscribers/solidus_subscriptions/event_storage_subscriber.rb +1 -0
  17. data/app/subscribers/solidus_subscriptions/order_subscriber.rb +16 -0
  18. data/app/views/spree/admin/shared/_subscription_actions.html.erb +27 -8
  19. data/app/views/spree/admin/shared/_subscription_sidebar.html.erb +2 -0
  20. data/app/views/spree/admin/subscriptions/_state_pill.html.erb +3 -2
  21. data/app/views/spree/admin/subscriptions/index.html.erb +50 -13
  22. data/bin/sandbox +1 -6
  23. data/config/locales/en.yml +16 -0
  24. data/config/routes.rb +9 -3
  25. data/db/migrate/20210905145955_add_paused_to_subscriptions.rb +5 -0
  26. data/{app/decorators → lib/decorators/api}/controllers/solidus_subscriptions/spree/api/line_items_controller/create_subscription_line_items.rb +14 -0
  27. data/lib/generators/solidus_subscriptions/install/install_generator.rb +16 -0
  28. data/lib/generators/solidus_subscriptions/install/templates/app/controllers/concerns/create_subscription.rb +17 -0
  29. data/lib/generators/solidus_subscriptions/install/templates/app/views/cart_line_items/_subscription_fields.html.erb +30 -0
  30. data/lib/generators/solidus_subscriptions/install/templates/initializer.rb +16 -1
  31. data/lib/solidus_subscriptions/checkout.rb +2 -9
  32. data/lib/solidus_subscriptions/configuration.rb +37 -8
  33. data/lib/solidus_subscriptions/dispatcher/payment_failed_dispatcher.rb +2 -2
  34. data/lib/solidus_subscriptions/dispatcher/success_dispatcher.rb +2 -2
  35. data/lib/solidus_subscriptions/engine.rb +28 -0
  36. data/lib/solidus_subscriptions/order_creator.rb +29 -0
  37. data/lib/solidus_subscriptions/permission_sets/default_customer.rb +1 -1
  38. data/lib/solidus_subscriptions/processing_error_handlers/rails_logger.rb +25 -0
  39. data/lib/solidus_subscriptions/subscription_generator.rb +6 -0
  40. data/lib/solidus_subscriptions/version.rb +1 -1
  41. data/lib/solidus_subscriptions.rb +1 -0
  42. data/solidus_subscriptions.gemspec +6 -6
  43. data/spec/controllers/spree/api/line_items_controller_spec.rb +63 -28
  44. data/spec/controllers/spree/api/users_controller_spec.rb +3 -0
  45. data/spec/decorators/controllers/solidus_subscriptions/spree/orders_controller/create_subscription_line_items_spec.rb +4 -4
  46. data/spec/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions_spec.rb +2 -2
  47. data/spec/features/admin/subscriptions_spec.rb +13 -3
  48. data/spec/jobs/solidus_subscriptions/create_subscription_job_spec.rb +20 -0
  49. data/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb +17 -0
  50. data/spec/lib/solidus_subscriptions/dispatcher/payment_failed_dispatcher_spec.rb +3 -3
  51. data/spec/lib/solidus_subscriptions/dispatcher/success_dispatcher_spec.rb +3 -3
  52. data/spec/lib/solidus_subscriptions/subscription_generator_spec.rb +1 -1
  53. data/spec/models/solidus_subscriptions/installment_spec.rb +1 -1
  54. data/spec/models/solidus_subscriptions/subscription_spec.rb +893 -16
  55. data/spec/models/spree/wallet_payment_source_spec.rb +3 -3
  56. data/spec/requests/api/v1/subscriptions_spec.rb +229 -0
  57. data/spec/subscribers/solidus_subscriptions/churn_buster_subscriber_spec.rb +8 -8
  58. data/spec/subscribers/solidus_subscriptions/order_subscriber_spec.rb +13 -0
  59. metadata +31 -23
  60. data/app/decorators/models/solidus_subscriptions/spree/order/finalize_creates_subscriptions.rb +0 -23
  61. data/config/initializers/subscribers.rb +0 -9
  62. data/spec/decorators/models/solidus_subscriptions/spree/order/finalize_creates_subscriptions_spec.rb +0 -32
  63. /data/{app/decorators → lib/decorators/frontend}/controllers/solidus_subscriptions/spree/orders_controller/create_subscription_line_items.rb +0 -0
  64. /data/{app → lib}/views/spree/frontend/products/_subscription_line_item_fields.html.erb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45719f0e107935ab6aa80a88c77f9a4e4724c75a6232d5b48522cbdd46fe1b13
4
- data.tar.gz: 9703884d1d0f90d6eb580df7c33e74c0f90cf5809b9377c237edeef4883a8f84
3
+ metadata.gz: cc3b0fcba16d886c8536c325484158200dffc72f80e1e226d1c572f8a15b1b7c
4
+ data.tar.gz: 8720f4cd130d3ac77f45b8a8ba8bfa0415dcdfdc1dc2e5350aa2649e6b34b945
5
5
  SHA512:
6
- metadata.gz: cadc2b4bd51ae07326c4a0259c16c70dcce339a672630fd5e6aa8f5e56a47b88d86ce325db6f7c4cb5d36140fef3ac51311660c7a2449b7026b6e23bbdd411ad
7
- data.tar.gz: 3bbd14e0dff7851badd900cf605d25a5468822aff5ab4fb18e2707577c4db0c582db02ac594545747b66831b1a5d3e9d7cf8e8f408499cdb8c3c16a931e30473
6
+ metadata.gz: 89de765c10e5490a610d5925b255b6ad002bef4e8b835f7c2e2893a6376535ee9162acf928f87f7de961bef523653ec32df8845efb128235ef15b9aa0272d845
7
+ data.tar.gz: 540d9007f27817b4941742a8cf154524f274f2572823e0afe0f5d8a5b3974eb9dcbb0bc6f20296cc690c57df098c8137a5a0bacee6848ca93f1c21ccc15ac382
data/.circleci/config.yml CHANGED
@@ -8,14 +8,48 @@ orbs:
8
8
  solidusio_extensions: solidusio/extensions@volatile
9
9
 
10
10
  jobs:
11
+ run-specs-with-mysql:
12
+ executor:
13
+ name: solidusio_extensions/mysql
14
+ ruby_version: <<parameters.ruby_version>>
15
+ steps:
16
+ - checkout
17
+ - solidusio_extensions/run-tests-solidus-older
18
+ - solidusio_extensions/run-tests-solidus-current
19
+ - solidusio_extensions/run-tests-solidus-master
20
+ - solidusio_extensions/store-test-results
21
+ parameters:
22
+ ruby_version:
23
+ type: string
24
+ default: '2.7'
11
25
  run-specs-with-postgres:
12
- executor: solidusio_extensions/postgres
26
+ executor:
27
+ name: solidusio_extensions/postgres
28
+ ruby_version: <<parameters.ruby_version>>
13
29
  steps:
14
- - solidusio_extensions/run-tests
15
- run-specs-with-mysql:
16
- executor: solidusio_extensions/mysql
30
+ - checkout
31
+ - solidusio_extensions/run-tests-solidus-older
32
+ - solidusio_extensions/run-tests-solidus-current
33
+ - solidusio_extensions/run-tests-solidus-master
34
+ - solidusio_extensions/store-test-results
35
+ parameters:
36
+ ruby_version:
37
+ type: string
38
+ default: '3.0'
39
+ run-specs-with-sqlite:
40
+ executor:
41
+ name: solidusio_extensions/sqlite
42
+ ruby_version: <<parameters.ruby_version>>
17
43
  steps:
18
- - solidusio_extensions/run-tests
44
+ - checkout
45
+ - solidusio_extensions/run-tests-solidus-older
46
+ - solidusio_extensions/run-tests-solidus-current
47
+ - solidusio_extensions/run-tests-solidus-master
48
+ - solidusio_extensions/store-test-results
49
+ parameters:
50
+ ruby_version:
51
+ type: string
52
+ default: '3.1'
19
53
  lint-code:
20
54
  executor: solidusio_extensions/sqlite-memory
21
55
  steps:
@@ -24,8 +58,15 @@ jobs:
24
58
  workflows:
25
59
  "Run specs on supported Solidus versions":
26
60
  jobs:
27
- - run-specs-with-postgres
28
- - run-specs-with-mysql
61
+ - run-specs-with-mysql:
62
+ ruby_version: '2.7'
63
+ name: run-specs-with-mysql-ruby-2.7
64
+ - run-specs-with-postgres:
65
+ ruby_version: '3.0'
66
+ name: run-specs-with-postgres-ruby-3.0
67
+ - run-specs-with-sqlite:
68
+ ruby_version: '3.1'
69
+ name: run-specs-with-sqlite-ruby-3.1
29
70
  - lint-code
30
71
 
31
72
  "Weekly run specs against master":
@@ -37,5 +78,12 @@ workflows:
37
78
  only:
38
79
  - master
39
80
  jobs:
40
- - run-specs-with-postgres
41
- - run-specs-with-mysql
81
+ - run-specs-with-mysql:
82
+ ruby_version: '2.7'
83
+ name: run-specs-with-mysql-ruby-2.7
84
+ - run-specs-with-postgres:
85
+ ruby_version: '3.0'
86
+ name: run-specs-with-postgres-ruby-3.0
87
+ - run-specs-with-sqlite:
88
+ ruby_version: '3.1'
89
+ name: run-specs-with-sqlite-ruby-3.1
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 10
data/.rubocop.yml CHANGED
@@ -10,3 +10,6 @@ RSpec/DescribeClass:
10
10
 
11
11
  Rails/SkipsModelValidations:
12
12
  Enabled: false
13
+
14
+ AllCops:
15
+ NewCops: disable