Skip to content

Commit

Permalink
fix(test): update credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed Oct 7, 2024
1 parent 8d3d2e0 commit 4257f1a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 13 deletions.
4 changes: 2 additions & 2 deletions cfg/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@
"access_token": null,
"wsdl_header": {
"Authentification": {
"user": "33333333331010",
"signature": "pass"
"user": "user-valid",
"signature": "SandboxPasswort2023!"
}
}
},
Expand Down
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@restorecommerce/service-config": "^1.0.15",
"@types/soap": "^0.21.0",
"@types/xml-js": "^1.0.0",
"bignumber.js": "^9.1.2",
"dayjs": "^1.11.10",
"redis": "^4.6.14",
"soap": "^1.0.1",
Expand Down
9 changes: 5 additions & 4 deletions src/services/fulfillment_product.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { randomUUID } from 'node:crypto';
import { BigNumber } from 'bignumber.js';
import {
createClient,
createChannel,
Expand Down Expand Up @@ -838,12 +839,12 @@ export class FulfillmentProductService
!!customer.payload.private?.user_id,
)
);
const gross = price.sale ? price.sale_price : price.regular_price;
const gross = new BigNumber(price.sale ? price.sale_price : price.regular_price);
const vats = taxes.map((tax): VAT => ({
tax_id: tax.id,
vat: gross * tax.rate,
vat: gross.multipliedBy(tax.rate).decimalPlaces(2).toNumber(),
}));
const net = vats.reduce((a, b) => a + b.vat, gross);
const net = vats.reduce((a, b) => a.plus(b.vat), gross).decimalPlaces(2).toNumber();

return {
id: randomUUID(),
Expand All @@ -862,7 +863,7 @@ export class FulfillmentProductService
price,
amount: {
currency_id: price.currency_id,
gross,
gross: gross.toNumber(),
net,
vats,
}
Expand Down
2 changes: 0 additions & 2 deletions src/stubs/dhl_soap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,6 @@ export class DHLSoap extends Stub {
if (config.ordering?.access_token) {
client.addHttpHeader('Authorization', `Bearer ${config.ordering.access_token}`);
}

console.log(client.getHttpHeaders())
return client;
}
);
Expand Down
1 change: 0 additions & 1 deletion test/fulfillment-srv-dhl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ describe('Testing Fulfillment Service Cluster:', () => {
it(`should submit fulfillment by valid samples: ${sample_name}`, async function() {
this.timeout(60000);
const response = await fulfillment_client.submit(sample);
console.log(response);
should.equal(
response?.operationStatus?.code, 200,
'response.operationStatus.code expected to be 200',
Expand Down
8 changes: 4 additions & 4 deletions test/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ const validFulfillmentProducts: { [key:string]: FulfillmentProductList } = {
attributes: [],
},{
id: 'urn:restorecommerce:fulfillment:product:attribute:dhl:accountNumber',
value: '22222222220104',
value: '33333333330102',
attributes: [],
}],
variants: [{
Expand Down Expand Up @@ -531,7 +531,7 @@ const validFulfillmentProducts: { [key:string]: FulfillmentProductList } = {
attributes: [],
},{
id: 'urn:restorecommerce:fulfillment:product:attribute:dhl:accountNumber',
value: '22222222220104',
value: '33333333330102',
attributes: [],
}],
variants: [{
Expand Down Expand Up @@ -597,7 +597,7 @@ const validFulfillmentProducts: { [key:string]: FulfillmentProductList } = {
attributes: [],
},{
id: 'urn:restorecommerce:fulfillment:product:attribute:dhl:accountNumber',
value: '22222222220104',
value: '33333333330102',
attributes: [],
}],
variants: [{
Expand Down Expand Up @@ -663,7 +663,7 @@ const validFulfillmentProducts: { [key:string]: FulfillmentProductList } = {
attributes: [],
},{
id: 'urn:restorecommerce:fulfillment:product:attribute:dhl:accountNumber',
value: '22222222220104',
value: '33333333330102',
attributes: [],
}],
variants: [{
Expand Down

0 comments on commit 4257f1a

Please sign in to comment.