[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant-backoffice] branch master updated (9d43258 -> ee27f2e)
From: |
gnunet |
Subject: |
[taler-merchant-backoffice] branch master updated (9d43258 -> ee27f2e) |
Date: |
Thu, 27 May 2021 21:31:57 +0200 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a change to branch master
in repository merchant-backoffice.
from 9d43258 fix linting
new 2c0e1a0 fixed @gnu-taler/taler-util dependency
new ee27f2e fix jest
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
packages/frontend/package.json | 6 +++++-
packages/frontend/src/utils/amount.ts | 37 ++++++++++++-----------------------
pnpm-lock.yaml | 2 +-
3 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/packages/frontend/package.json b/packages/frontend/package.json
index 634f622..451b524 100644
--- a/packages/frontend/package.json
+++ b/packages/frontend/package.json
@@ -107,6 +107,10 @@
},
"jest": {
"preset": "jest-preset-preact",
+ "transformIgnorePatterns": [
+ "node_modules/.pnpm/(?!(@gnu-taler\\+taler-util))",
+ "\\.pnp\\.[^\\\/]+$"
+ ],
"setupFiles": [
"<rootDir>/tests/__mocks__/browserMocks.ts",
"<rootDir>/tests/__mocks__/setupTests.ts"
@@ -118,4 +122,4 @@
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|po)$":
"<rootDir>/tests/__mocks__/fileTransformer.js"
}
}
-}
+}
\ No newline at end of file
diff --git a/packages/frontend/src/utils/amount.ts
b/packages/frontend/src/utils/amount.ts
index 190e876..8fdf048 100644
--- a/packages/frontend/src/utils/amount.ts
+++ b/packages/frontend/src/utils/amount.ts
@@ -56,36 +56,23 @@ export function mergeRefunds(prev:
MerchantBackend.Orders.RefundDetails[], cur:
}
export const multiplyPrice = (price: string, q: number) => {
- // const a = Amounts.parseOrThrow(price)
- // const r = Amounts.mult(a, q)
- // return Amounts.stringify(r.amount)
- const [currency, value] = price.split(':')
- const total = parseInt(value, 10) * q
- return `${currency}:${total}`
+ const a = Amounts.parseOrThrow(price)
+ const r = Amounts.mult(a, q)
+ return Amounts.stringify(r.amount)
}
export const subtractPrices = (one: string, two: string) => {
- // const a = Amounts.parseOrThrow(one)
- // const b = Amounts.parseOrThrow(two)
- // const r = Amounts.sub(a, b)
- // return Amounts.stringify(r.amount)
- const [currency, valueOne] = one.split(':')
- const [, valueTwo] = two.split(':')
- return `${currency}:${parseInt(valueOne, 10) - parseInt(valueTwo, 10)}`
+ const a = Amounts.parseOrThrow(one)
+ const b = Amounts.parseOrThrow(two)
+ const r = Amounts.sub(a, b)
+ return Amounts.stringify(r.amount)
}
export const rate = (one: string, two: string) => {
- // const a = Amounts.parseOrThrow(one)
- // const b = Amounts.parseOrThrow(two)
- // const af = Amounts.toFloat(a)
- // const bf = Amounts.toFloat(b)
- // return af / bf
- const [, valueOne] = (one || '').split(':')
- const [, valueTwo] = (two || '').split(':')
- const intOne = parseInt(valueOne, 10)
- const intTwo = parseInt(valueTwo, 10)
- if (!intTwo) return intOne
- if (!intOne) return 0
- return intOne / intTwo
+ const a = Amounts.parseOrThrow(one)
+ const b = Amounts.parseOrThrow(two)
+ const af = Amounts.toFloat(a)
+ const bf = Amounts.toFloat(b)
+ return af / bf
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b98358e..dd5acf0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1576,7 +1576,7 @@ packages:
dev: true
/@gnu-taler/taler-util/0.8.2:
- resolution: {integrity: sha1-B6/UuryzdS4wsbBtK1vTn/kNAaM=, tarball:
https://gitlab.com/api/v4/projects/20136151/packages/npm/@gnu-taler/taler-util/-/@gnu-taler/taler-util-0.8.2.tgz}
+ resolution: {integrity: sha1-suKMin9qIwQiIAf5n97Bf9siUfM=, tarball:
https://gitlab.com/api/v4/projects/20136151/packages/npm/@gnu-taler/taler-util/-/@gnu-taler/taler-util-0.8.2.tgz}
dependencies:
tslib: 2.2.0
dev: false
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant-backoffice] branch master updated (9d43258 -> ee27f2e),
gnunet <=