Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

feat: Merged basket creation and checkout in one View #4160

Merged
merged 4 commits into from
May 14, 2024
Merged

Conversation

jawad-khan
Copy link
Contributor

⛔️ MAIN BRANCH WARNING! 2U EMPLOYEES must make branches against the 2u/main BRANCH

  • I have checked the branch to which I would like to merge.

⛔️ DEPRECATION WARNING

This repository is deprecated and in maintainence-only operation while we work on a replacement, please see this announcement for more information.

Although we have stopped integrating new contributions, we always appreciate security disclosures and patches sent to [email protected]

Anyone internally merging to this repository is expected to release and monitor their changes; if you are not able to do this DO NOT MERGE, please coordinate with someone who can to ensure that the changes are released.

Required Testing

  • Before deploying this change, complete a purchase in the stage environment.
    (^ We can remove that manual check once REV-2624 is done and the corresponding e2e test runs again)

Description

Merged basket creation and checkout in one View. This view will now accept product sku and payment processor name and will return a checkout out basket id. After this call we can now move on with payment execution.

Supporting information

https://2u-internal.atlassian.net/browse/LEARNER-9913

Testing instructions

Please provide detailed step-by-step instructions for testing this change; how did YOU test this change?

Other information

Include anything else that will help reviewers and consumers understand the change.

  • Does this change depend on other changes elsewhere?
  • Any special concerns or limitations? For example: deprecations, migrations, OpenEdx vs. edx.org differences, development vs. production environment differences, security, or accessibility.

@jawad-khan jawad-khan requested a review from a team as a code owner May 9, 2024 05:33
@@ -10,6 +11,7 @@
)

urlpatterns = [
url(r'^basket-checkout/$', BasketCheckoutView.as_view(), name='mobile-basket-checkout'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like many of the other mobile view are prefixed with Mobile, should this on be as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

basket = prepare_basket(request, available_products)
except AlreadyPlacedOrderException:
logger.exception(LOGGER_BASKET_ALREADY_PURCHASED, request.user.username, skus)
return JsonResponse({'error': _(ERROR_ALREADY_PURCHASED)}, status=status.HTTP_406_NOT_ACCEPTABLE)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test to cover this path?

I think we might need another one for line 206/211 as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These lines are already covered since new test case class is inheriting MobileBasketAddItemsViewTests class.

Copy link
Contributor

Choose a reason for hiding this comment

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

interesting. i didn't expect the inheritance to behave that way. that's neat

@jawad-khan jawad-khan merged commit 5d62a7b into 2u/main May 14, 2024
8 checks passed
@jawad-khan jawad-khan deleted the LEARNER-9913 branch May 14, 2024 21:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants