Skip to content
This repository has been archived by the owner on May 21, 2020. It is now read-only.

feat: implemented user order details #360

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

defudef
Copy link
Contributor

@defudef defudef commented Apr 8, 2020

  • I'm confirming that if i made any changes to public APIs or exposed any public APIs they are doccumented.

@defudef defudef changed the title Feature/ implemented user order details feat: implemented user order details Apr 8, 2020
@defudef defudef self-assigned this Apr 8, 2020
@filrak
Copy link
Contributor

filrak commented Apr 8, 2020

also coverage decreased

@defudef defudef requested review from Qrzy and filrak April 9, 2020 09:00

export const getOrderDate = (order: Order): string => order?.createdAt || '';

export const getOrderId = (order: Order): string => order?.id || '';

export const getOrderNumber = (order: Order): string => order?.orderNumber || getOrderId(order);
Copy link
Contributor

Choose a reason for hiding this comment

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

how that is different from ID? Did you made sure that this field is not specific to commercetools?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A lot of ecommerce platforms have the ID and Order Number separately.

Copy link
Collaborator

Choose a reason for hiding this comment

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

export const getOrderId = (order: Order): string => order?.id || order?.orderNumber;

Copy link
Contributor

@filrak filrak Apr 10, 2020

Choose a reason for hiding this comment

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

does a lot mean all of them? keep in mind that helpers are for the UI, are both needed in the UI? Imho @andrzejewsky proposed right solution


export const getOrderPrice = (order: Order): AgnosticPrice => getPrice(order?.totalPrice);

const transformAddressToString = (address: Address): string => (
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't that be a set of helpers OR just a non-agnostic object?

@andrzejewsky we've just discussed that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's temporary actually (just to keep DRY)

Copy link
Contributor

Choose a reason for hiding this comment

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

if something is temporarly add an issue and todo here with issue linked

packages/core/theme-module/theme/pages/MyAccount.vue Outdated Show resolved Hide resolved
});

return {
cartGetters,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not entirely sure about that so its up for discussion but maybe we should just have item getters in orderGetters are we sure that in every platform item from order is the same one as cart item? Also from the DX point of view It doesn't seem intuitive, for every other comparable you have a single corresponding getter
@defudef @andrzejewsky whats your opinion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we need in this case orderItemGetters with OrderItem component. Unfortunately, there is no component in SFUI for that case

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I get it, why you want to pair component and getters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is with a component that renders bought items:

SfCollectedProduct
        v-for="product in orderGetters.getItems(order)"
        :key="cartGetters.getItemSku(product)"
        :image="cartGetters.getItemImage(product)"
        :title="cartGetters.getItemName(product)"
        :regular-price="'$' + cartGetters.getItemPrice(product).regular"
        :qty="cartGetters.getItemQty(product)"
        class="ordered-product"
      />

the orderGetters doesn't have methods that returns: SKU, image, or quantity

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RFC proposed here: #363

@defudef defudef requested review from filrak and patzick April 10, 2020 08:44
Copy link
Contributor

@patzick patzick left a comment

Choose a reason for hiding this comment

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

One thing from me, Address should be an implementation interface here :)

Comment on lines +216 to +217
getBillingAddress: (address: ORDER) => string;
getShippingAddress: (address: ORDER) => string;
Copy link
Contributor

Choose a reason for hiding this comment

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

would change that for implementation to decide about address structure

Suggested change
getBillingAddress: (address: ORDER) => string;
getShippingAddress: (address: ORDER) => string;
getBillingAddress: (address: ORDER) => ADDRESS;
getShippingAddress: (address: ORDER) => ADDRESS;

Copy link
Contributor

Choose a reason for hiding this comment

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

remove and create RFC, ideally before 4 m so we can discuss it on decision making window @defudef

Copy link
Contributor

@filrak filrak left a comment

Choose a reason for hiding this comment

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

Get rid of additional getters in core

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants