Subscription api fix for subscribable product#312
Conversation
|
@shahmayur001 postgres keeps failing |
|
Fully fixes #308 |
I had manually added the solidus_support gem on my gemfile to run the test suites
My tests were passing I am not sure why the cases are failing here as the branch that was resolving the issue of the test suites has been merged already but on Circle CI the errors on tests are still related to that.
@kennyadsl Do I have to do anything specific to load the support gem changes ? |
|
@kennyadsl done and ready to merge |
|
there are some specs still failing. Can you take a look please? |
|
@kennyadsl they seem to fail only on sqlite and do not seem to be related to us. |
|
@kennyadsl should be possible to merge this. |

Summary:
This PR introduces improvements and new features to the Solidus Subscriptions module, with a focus on subscription validation and handling subscription-related logic.
Changes:
Validation for Subscribable Products:
ensure_subscribable_validis added to theSolidusSubscriptions::LineItemmodel. This validation ensures that only products marked as subscribable can be added to a subscription. If a product is not subscribable, an error is added to thesubscribablefield with the message "The requested item cannot be subscribed".Localization:
config/locales/en.ymlto define the error message for the subscribable validation ("The requested item cannot be subscribed").Subscription Form Enhancements:
app/views/cart_line_items/_subscription_fields.html.erbto display subscription fields dynamically based on whether a product variant is subscribable. The form will show the subscription options only if the selected variant is subscribable.Controller Enhancements:
CreateSubscriptionconcern to improve the logic for handling subscription line items. A new helper methodvalid_subscription_line_item_params?is introduced to ensure that all required parameters are present before processing subscription-related actions.Promotion Rules Registration:
SubscriptionCreationOrderandSubscriptionInstallmentOrder) are only registered if theSpree::Promotionclass is defined, ensuring compatibility with different Solidus versions.Test Coverage:
New Tests:
CreateSubscriptionconcern, particularly for the new helper methodvalid_subscription_line_item_params?.SolidusSubscriptions::LineItemmodel to test the new subscribable validation.Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: