Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release #102

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ import { Subject } from '@restorecommerce/rc-grpc-clients/dist/generated-server/
export type BigVAT = {
tax_id: string;
vat: BigNumber;
}
};

export type BigAmount = {
currency_id: string;
Expand Down Expand Up @@ -1439,7 +1439,7 @@ export class OrderingService
currency_id: item.amount.currency_id,
gross: new BigNumber(item.amount.gross!),
net: new BigNumber(item.amount.net!),
vats: item.amount.vats,
vats: [...item.amount.vats],
};
}
return amounts;
Expand All @@ -1463,7 +1463,7 @@ export class OrderingService
vats[vat.tax_id!].vat = vats[vat.tax_id!]?.vat.plus(vat.vat) ?? new BigNumber(vat.vat);
}
else {
vats[vat.tax_id!] = {
vats[vat.tax_id!] = {
tax_id: vat.tax_id,
vat: new BigNumber(vat.vat)
};
Expand Down
103 changes: 100 additions & 3 deletions test/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const countries: CountryResponse[] = [{
countryCode: 'DE',
name: 'Deutschland',
geographicalName: 'Germany',
economicAreas: [],
economicAreas: ['EU'],
},
status: {
id: 'germany',
Expand All @@ -172,7 +172,7 @@ const taxes: TaxResponse[] = [
countryId: 'germany',
rate: 0.19,
typeId: 'taxType_1',
variant: 'MwSt.'
abbreviation: 'MwSt.',
},
status: {
id: 'tax_1',
Expand Down Expand Up @@ -265,6 +265,88 @@ const products: ProductResponse[] = [
message: 'OK',
}
},
{
payload: {
id: 'physicalProduct_2',
active: true,
shopId: 'shop_1',
tags: [],
associations: [],
product: {
name: 'Physical Product 2',
description: 'This is a physical product',
manufacturerId: 'manufacturer_1',
taxIds: [
taxes[0].payload?.id as string,
],
physical: {
variants: [
{
id: '1',
name: 'Physical Product 1 Blue',
description: 'This is a physical product in blue',
price: {
currencyId: 'currency_1',
regularPrice: 19.99,
salePrice: 18.99,
sale: false,
},
images: [],
files: [],
stockKeepingUnit: '123456789',
stockLevel: 300,
package: {
sizeInCm: {
height: 10,
length: 20,
width: 15,
},
weightInKg: 0.58,
rotatable: true,
},
properties: [
{
id: 'urn:product:property:color:main:name',
value: 'blue',
unitCode: 'text',
},
{
id: 'urn:product:property:color:main:value',
value: '#0000FF',
unitCode: '#RGB',
}
],
},
{
id: '2',
name: 'Physical Product 1 Red',
description: 'This is a physical product in red',
images: [],
files: [],
properties: [
{
id: 'urn:product:property:color:main:name',
value: 'red',
unitCode: 'text',
},
{
id: 'urn:product:property:color:main:value',
value: '#FF0000',
unitCode: '#RGB',
}
],
parentVariantId: '1',
}
]
}
},
},
status: {
id: 'physicalProduct_2',
code: 200,
message: 'OK',
}
},
];

const contactPoints = [
Expand Down Expand Up @@ -314,7 +396,7 @@ const shops = [
id: 'shop_1',
name: 'Shop1',
description: 'a mocked shop for unit tests',
domain: 'www.shop.com',
domains: ['www.shop.com'],
organizationId: organizations[0].payload?.id,
shopNumber: '0000000001',
},
Expand All @@ -336,6 +418,11 @@ const validOrders: { [key: string]: OrderList } = {
productId: products[0]?.payload?.id,
variantId: products[0]?.payload?.product?.physical?.variants?.[0]?.id,
quantity: 4,
},
{
productId: products[1]?.payload?.id,
variantId: products[1]?.payload?.product?.physical?.variants?.[0]?.id,
quantity: 2,
}
],
notificationEmail: '[email protected]',
Expand Down Expand Up @@ -366,6 +453,11 @@ const validOrders: { [key: string]: OrderList } = {
productId: products[0]?.payload?.id,
variantId: products[0]?.payload?.product?.physical?.variants?.[0]?.id,
quantity: 4,
},
{
productId: products[1]?.payload?.id,
variantId: products[1]?.payload?.product?.physical?.variants?.[0]?.id,
quantity: 2,
}
],
userId: 'user_1',
Expand Down Expand Up @@ -401,6 +493,11 @@ const invalidOrders: { [key: string]: OrderList } = {
productId: products[0]?.payload?.id,
variantId: products[0]?.payload?.product?.physical?.variants?.[0]?.id,
quantity: 4,
},
{
productId: products[1]?.payload?.id,
variantId: products[1]?.payload?.product?.physical?.variants?.[0]?.id,
quantity: 2,
}
],
userId: 'userId_1',
Expand Down
Loading