solidus_subscriptions 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) 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 -169
  6. data/Gemfile +14 -1
  7. data/README.md +17 -7
  8. data/app/controllers/solidus_subscriptions/api/v1/subscriptions_controller.rb +24 -0
  9. data/app/controllers/spree/admin/subscriptions_controller.rb +32 -4
  10. data/app/decorators/models/solidus_subscriptions/spree/wallet_payment_source/report_default_change_to_subscriptions.rb +2 -2
  11. data/app/jobs/solidus_subscriptions/create_subscription_job.rb +11 -0
  12. data/app/jobs/solidus_subscriptions/process_installment_job.rb +1 -1
  13. data/app/models/solidus_subscriptions/subscription.rb +75 -31
  14. data/app/subscribers/solidus_subscriptions/churn_buster_subscriber.rb +1 -0
  15. data/app/subscribers/solidus_subscriptions/event_storage_subscriber.rb +1 -0
  16. data/app/subscribers/solidus_subscriptions/order_subscriber.rb +16 -0
  17. data/app/views/spree/admin/shared/_subscription_actions.html.erb +27 -8
  18. data/app/views/spree/admin/shared/_subscription_sidebar.html.erb +2 -0
  19. data/app/views/spree/admin/subscriptions/_state_pill.html.erb +3 -2
  20. data/app/views/spree/admin/subscriptions/index.html.erb +50 -13
  21. data/bin/sandbox +1 -6
  22. data/config/locales/en.yml +16 -0
  23. data/config/routes.rb +9 -3
  24. data/db/migrate/20210905145955_add_paused_to_subscriptions.rb +5 -0
  25. data/lib/decorators/api/controllers/solidus_subscriptions/spree/api/line_items_controller/create_subscription_line_items.rb +14 -0
  26. data/lib/generators/solidus_subscriptions/install/install_generator.rb +16 -0
  27. data/lib/generators/solidus_subscriptions/install/templates/app/controllers/concerns/create_subscription.rb +17 -0
  28. data/lib/generators/solidus_subscriptions/install/templates/app/views/cart_line_items/_subscription_fields.html.erb +30 -0
  29. data/lib/generators/solidus_subscriptions/install/templates/initializer.rb +3 -1
  30. data/lib/solidus_subscriptions/configuration.rb +29 -6
  31. data/lib/solidus_subscriptions/dispatcher/payment_failed_dispatcher.rb +2 -2
  32. data/lib/solidus_subscriptions/dispatcher/success_dispatcher.rb +2 -2
  33. data/lib/solidus_subscriptions/engine.rb +28 -0
  34. data/lib/solidus_subscriptions/permission_sets/default_customer.rb +1 -1
  35. data/lib/solidus_subscriptions/processing_error_handlers/rails_logger.rb +25 -0
  36. data/lib/solidus_subscriptions/subscription_generator.rb +6 -0
  37. data/lib/solidus_subscriptions/version.rb +1 -1
  38. data/solidus_subscriptions.gemspec +6 -6
  39. data/spec/controllers/spree/api/line_items_controller_spec.rb +63 -28
  40. data/spec/controllers/spree/api/users_controller_spec.rb +3 -0
  41. data/spec/decorators/controllers/solidus_subscriptions/spree/orders_controller/create_subscription_line_items_spec.rb +4 -4
  42. data/spec/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions_spec.rb +2 -2
  43. data/spec/features/admin/subscriptions_spec.rb +13 -3
  44. data/spec/jobs/solidus_subscriptions/create_subscription_job_spec.rb +20 -0
  45. data/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb +17 -0
  46. data/spec/lib/solidus_subscriptions/dispatcher/payment_failed_dispatcher_spec.rb +3 -3
  47. data/spec/lib/solidus_subscriptions/dispatcher/success_dispatcher_spec.rb +3 -3
  48. data/spec/lib/solidus_subscriptions/subscription_generator_spec.rb +1 -1
  49. data/spec/models/solidus_subscriptions/installment_spec.rb +1 -1
  50. data/spec/models/solidus_subscriptions/subscription_spec.rb +893 -16
  51. data/spec/models/spree/wallet_payment_source_spec.rb +3 -3
  52. data/spec/requests/api/v1/subscriptions_spec.rb +229 -0
  53. data/spec/subscribers/solidus_subscriptions/churn_buster_subscriber_spec.rb +8 -8
  54. data/spec/subscribers/solidus_subscriptions/order_subscriber_spec.rb +13 -0
  55. metadata +24 -17
  56. data/app/decorators/models/solidus_subscriptions/spree/order/finalize_creates_subscriptions.rb +0 -25
  57. data/config/initializers/subscribers.rb +0 -9
  58. data/spec/decorators/models/solidus_subscriptions/spree/order/finalize_creates_subscriptions_spec.rb +0 -32
  59. /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: 77254a24d5d35be4a22fe74a9287f2c6ce89c8940327dbf207f93cbda65ac0c3
4
- data.tar.gz: 3e9d2b8bf25c12e47581281de6e3b659eb0951452030304be5de10f78b781388
3
+ metadata.gz: cc3b0fcba16d886c8536c325484158200dffc72f80e1e226d1c572f8a15b1b7c
4
+ data.tar.gz: 8720f4cd130d3ac77f45b8a8ba8bfa0415dcdfdc1dc2e5350aa2649e6b34b945
5
5
  SHA512:
6
- metadata.gz: 5bdb4af6b9b67879b7cb487053ce43ae0cdddcdeec0f4aea0728c177b65b7f9f1f79fae7ae866512d8b1ccc5bc1fb9620eb60bb5bb1352ecfaecb8b61816003c
7
- data.tar.gz: 58ca346aa4a7bda38c126444fb4de00e5692f9902f4bfc7c34e408addc03cc6fc331c161a5ee3553829d89d50204769591168ebf3232073509bc7539130a9522
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