Skip to content

Commit

Permalink
Prepare order data
Browse files Browse the repository at this point in the history
  • Loading branch information
belsman committed Mar 1, 2024
1 parent aa37ee2 commit 9c73748
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ <h3>{{ "TopBar.OrderOverview" | translate }}</h3>
<p class="item-color">
{{ "Checkout.color" | translate }}:

{{ item.product.selectedColor }}
{{ item.variant.selectedColor }}
</p>
<p class="item-size">
{{ "Checkout.size" | translate }}: {{ item.product.selectedSize }}
{{ "Checkout.size" | translate }}: {{ item.variant.selectedSize }}
</p>
<p class="availability">{{ "Checkout.InStock" | translate }}</p>
<br />
Expand Down
14 changes: 5 additions & 9 deletions src/app/features/checkout/services/checkout.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,27 @@ export class CheckoutService {
productId: item.variant.parentVariantId,
variantId: item.variant.id, // productVariant
quantity: item.quantity,
unitPrice: { // The price of one unit of item
unitPrice: {
// The price of one unit of item
regularPrice: item.variant.price.regularPrice,
sale: item.variant.price.sale,
salePrice: item.variant.price.salePrice,
currencyId: item.variant.price.currencyId,
},
amount: {
currencyId: item.variant.price.currencyId,
gross: 26, // ((vat in included per item.) + (shipping per item)) + (tarrifs) * the quantity
net: 25, // item * quantity
gross: item.variant.price.salePrice * item.quantity,
net: item.variant.price.salePrice * item.quantity,
vats: [
{
taxId: item.taxType,
taxId: item.taxType, // Tax Id is usually on the product.
vat: 4.0,
},
],
},
}));

// TODO
// 1. Get cart items.
// 2. Map these cart items to create "order.items[0].items". Where "order" is IIoRestorecommerceOrderOrderList
// 3. Map or Extract from the cart or it items to get the "order.items[0].totalAmounts".

// 4. UserId: This is the id of the buyer. It could be anonymous. Or the id of the login user. Extracted using the user service.
// 5. customerId: Let it be the same as the userId.
// 6. shopId: Id of the current shop. Possibly the merchant's shopId (A merchant could have many shop).
Expand All @@ -74,7 +71,6 @@ export class CheckoutService {
// customerOrderNr -- The number of the order.
// customerRmk about the good. Maybe after a product has been fulfilled.


// TODO Implement auth with the User Id and Address

const orderInput: IIoRestorecommerceOrderOrderList = {
Expand Down

0 comments on commit 9c73748

Please sign in to comment.