Skip to content

Commit

Permalink
Merge pull request #53 from yalla-coop/fix-bugs
Browse files Browse the repository at this point in the history
Fix-bugs
  • Loading branch information
ajluker authored Oct 14, 2024
2 parents cd6e49c + 64e53a7 commit 1ea44f7
Show file tree
Hide file tree
Showing 5 changed files with 282 additions and 176 deletions.
2 changes: 1 addition & 1 deletion web/api-modules/products/use-cases/get-products.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const toProduct = (product) => ({
async function findProducts(client) {
const response = await client.request(`
{
products(first: 250) {
products(first: 250, sortKey: TITLE) {
edges {
node {
id
Expand Down
9 changes: 7 additions & 2 deletions web/connector/productUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { throwError } from '../utils/index.js';
import loadConnectorWithResources from './index.js';
import loadProductTypes from './mappedProductTypes.js';
import config from '../config.js';
import currencyMeasureFor from '../utils/currencyMeasureFor.js';

const createQuantitativeValue = (connector, value, unit) =>
connector.createQuantity({
Expand Down Expand Up @@ -45,7 +46,6 @@ async function createVariantSuppliedProduct(
try {
const connector = await loadConnectorWithResources();
const kilogram = connector.MEASURES.UNIT.QUANTITYUNIT.KILOGRAM;
const euro = connector.MEASURES.UNIT.CURRENCYUNIT.EURO;

const semanticBase = `${config.PRODUCER_SHOP_URL}api/dfc/Enterprises/${enterpriseName}/SuppliedProducts/${variant.id}`;

Expand All @@ -55,7 +55,12 @@ async function createVariantSuppliedProduct(
kilogram
);
const hasVat = variant.taxable ? 1.0 : 0.0; // TODO check how the vat rate can be added
const price = createPrice(connector, variant.price, euro, hasVat);
const price = createPrice(
connector,
variant.price,
currencyMeasureFor(connector, variant.currencyCode),
hasVat
);
const offer = createOffer(connector, semanticBase, price);
const inventoryQuantity =
variant.inventoryPolicy === 'CONTINUE' ? -1 : variant.inventoryQuantity;
Expand Down
Loading

0 comments on commit 1ea44f7

Please sign in to comment.