Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Updates salesforce opportunity line item form validation #502

Merged
merged 6 commits into from
Jul 12, 2023

Conversation

brobro10000
Copy link
Member

@brobro10000 brobro10000 commented Jun 29, 2023

Adds validation on the SubscriptionPlanForm class for salesforce_opportunity_line_item
Uses the approach of a form validation as opposed to model validation to account for existing salesforce_opportunity_line_item that do not match the following format:
Regex: /^00k[a-zA-Z0-9]{15}$/
18 alphanumeric characters where the first three characters must be the sequence '00k'
Only the lower case 'k' will be accepted

Overrides the help_text for the field to inform the user of the new format restrictions.
Adds additional text during validation error specifying that the salesforce_opportunity_line_item must start with '00k'
Updates the seeded data for devstack with the correct format.
Updates get_random_salesforce_id function to match the format due to its uses of generating random salesforce_opportunity_line_item field values for tests

Screenshot 2023-06-29 at 4 02 42 PM

Description

Description of changes made

Link to the associated ticket: https://openedx.atlassian.net/browse/ENT-XXXX

Testing considerations

  • Include instructions for any required manual tests, and any manual testing that has
    already been performed.
  • Include unit and a11y tests as appropriate
  • Consider performance issues.
  • Check that Database migrations are backwards-compatible

Post-review

Squash commits into discrete sets of changes

@brobro10000 brobro10000 force-pushed the hu/ent-7323 branch 2 times, most recently from bb23deb to 78dee16 Compare June 30, 2023 14:39
@brobro10000 brobro10000 force-pushed the hu/ent-7323 branch 3 times, most recently from c4aceb7 to cfa2f32 Compare July 6, 2023 20:32
Comment on lines 152 to 154
if product.plan_type.sf_id_required and \
self.cleaned_data.get('salesforce_opportunity_line_item') is None or \
not verify_salesforce_opportunity_product_line_item(self.cleaned_data.get('salesforce_opportunity_line_item')):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can use parens to format this type of thing across lines without using backslash, i.e.

if (
    product.plan_type.sf_id_required
    and self.cleaned_data.get('salesforce_opportunity_line_item') is None
    or not verify_salesforce_opportunity_product_line_item(self.cleaned_data.get('salesforce_opportunity_line_item')
):

@brobro10000 brobro10000 merged commit fef7ced into master Jul 12, 2023
6 checks passed
@brobro10000 brobro10000 deleted the hu/ent-7323 branch July 12, 2023 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants