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

Update shipping/cart endpoints #1833

Merged
merged 6 commits into from
Mar 2, 2020

Conversation

mikejolley
Copy link
Member

@senadir Will be some more work to do here such as updating tests, testing, and checking each response/request works for our use case, but this PR implements some of what we chatted about.

  1. /cart/shipping-rates no longer quotes for a given address. It uses the session data.
  2. /cart/ returns an array of shipping-rates for convenience
  3. shipping-rates have a selected property much like you did originally (sorry)
  4. /cart/update-shipping takes an address, updates customer session, and returns new rates
  5. /cart/select-shipping-rate/ lets you set a rate id for a package by POSTing

@mikejolley mikejolley requested a review from a team as a code owner February 28, 2020 12:01
@mikejolley mikejolley requested review from senadir and removed request for a team February 28, 2020 12:01
Copy link
Member

@senadir senadir left a comment

Choose a reason for hiding this comment

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

Currently, this is not returning the correct packages when you submit an address (it still give back the default address of Locations not covered by your other zones

@senadir
Copy link
Member

senadir commented Feb 28, 2020 via email

@senadir
Copy link
Member

senadir commented Mar 2, 2020

@mikejolley based from this PR /cart/shipping-rates is redundant and should be deleted, we initially fetch shipping rates with the cart, any future interactions with shipping rates would be via updating the rates, which already return the whole cart, making the first endpoint never used.

@mikejolley
Copy link
Member Author

@senadir By us though right? There may be use cases outside of cart - you could say the same about coupons and items right now.

@senadir senadir dismissed their stale review March 2, 2020 10:53

will be fixed in the other PR

@senadir senadir merged commit c456ea7 into add/put-method-on-shipping Mar 2, 2020
@senadir senadir deleted the update/select-shipping-rates branch March 2, 2020 11:07
senadir pushed a commit that referenced this pull request Mar 3, 2020
* Items should not have keys in API response

* Include package ID in response (this is just a basic index)

* /cart/select-shipping-rate/package_id

* Add package_id to package array

* Update responses and add shipping-rates to main cart endpoint

* update-shipping endpoint
senadir pushed a commit that referenced this pull request Mar 4, 2020
* Items should not have keys in API response

* Include package ID in response (this is just a basic index)

* /cart/select-shipping-rate/package_id

* Add package_id to package array

* Update responses and add shipping-rates to main cart endpoint

* update-shipping endpoint
senadir pushed a commit that referenced this pull request Mar 5, 2020
* Items should not have keys in API response

* Include package ID in response (this is just a basic index)

* /cart/select-shipping-rate/package_id

* Add package_id to package array

* Update responses and add shipping-rates to main cart endpoint

* update-shipping endpoint
senadir pushed a commit that referenced this pull request Mar 5, 2020
* Items should not have keys in API response

* Include package ID in response (this is just a basic index)

* /cart/select-shipping-rate/package_id

* Add package_id to package array

* Update responses and add shipping-rates to main cart endpoint

* update-shipping endpoint
senadir pushed a commit that referenced this pull request Mar 5, 2020
* Items should not have keys in API response

* Include package ID in response (this is just a basic index)

* /cart/select-shipping-rate/package_id

* Add package_id to package array

* Update responses and add shipping-rates to main cart endpoint

* update-shipping endpoint
senadir added a commit that referenced this pull request Mar 5, 2020
* add select shipping endpoint to router

* add select shipping method

* add selected rates to cart

* better select rates

* move schema function to seperate function

* move validation to Cart Controller

* fix wrong session key

* Update shipping/cart endpoints (#1833)

* Items should not have keys in API response

* Include package ID in response (this is just a basic index)

* /cart/select-shipping-rate/package_id

* Add package_id to package array

* Update responses and add shipping-rates to main cart endpoint

* update-shipping endpoint

* Add querying selected shipping rate to the store (#1829)

* add selecting shipping to store

* directly call useSelectShippingRate

* refactor cart keys transformation to reducer

* remove selecting first result and accept selecting

* move update shipping to new endpoint

* pass selected rates down

* select shipping right directly and fix editor issues

* fix some broken prop types

* key -> package id

* Update and fix cart/shipping-rate tests

* fix case for when rates are set

* Update useShippingRates test

* add args to rest endpoint

* move selecting shipping rate logic to hook

* fix some naming issues

* update propTypes

* update action call

* fully watch cart state

* address review issues

* fix prop type issues

* fix issue with rates not loading in checkout

* remove extra package for shipping

* move ShippingCalculatorOptions to outside

Co-authored-by: Mike Jolley <[email protected]>
Co-authored-by: Albert Juhé Lluveras <[email protected]>
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