Skip to content

Commit

Permalink
🎨 naming and utils
Browse files Browse the repository at this point in the history
  • Loading branch information
DuvCharles committed Nov 17, 2023
1 parent 8d11cdf commit 4ef3172
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/sylius/normalizer/cart-normalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ const normalizeOrderItemOptionValue = (
optionValue: SyliusProductOptionValue,
options: SyliusProductOption[]
): { name: string; value: string } => {
const rightOption = options.filter((option) =>
const selectedOption = options.filter((option) =>
option.values.some((value) => value.code === optionValue.code)
)[0];
return {
name: rightOption?.name ?? '',
name: selectedOption?.name ?? '',
value: optionValue.value
};
};
4 changes: 3 additions & 1 deletion lib/sylius/normalizer/utils-normalizer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Money } from '../types';

export const normalizePrice = (amount: number): Money => ({
amount: (amount / 100).toString(),
amount: centsPriceToUnitsPrice(amount).toString(),
currencyCode: 'EUR'
});

export const centsPriceToUnitsPrice = (amount: number): number => amount / 100;

0 comments on commit 4ef3172

Please sign in to comment.