diff --git a/packages/api/package.json b/packages/api/package.json
index 320db11..6054abc 100644
--- a/packages/api/package.json
+++ b/packages/api/package.json
@@ -50,9 +50,9 @@
"@fastify/cors": "^10.0.1",
"@fastify/middie": "9.0.2",
"@fastify/static": "8.0.1",
- "@modular-api/api": "^0.5.5",
+ "@modular-api/api": "^0.5.6",
"@modular-api/fastify-cart": "^0.3.0",
- "@modular-api/fastify-checkout": "^0.4.5",
+ "@modular-api/fastify-checkout": "^0.4.6",
"@modular-api/fastify-oidc": "^0.6.0",
"@mollie/api-client": "^4.0.0",
"@slimfact/app": "^0.1.0",
diff --git a/packages/app/package.json b/packages/app/package.json
index 2e289f3..a2f8229 100644
--- a/packages/app/package.json
+++ b/packages/app/package.json
@@ -43,8 +43,8 @@
},
"devDependencies": {
"@modular-api/fastify-cart": "^0.3.0",
- "@modular-api/fastify-checkout": "^0.4.4",
- "@modular-api/quasar-components": "^0.3.1",
+ "@modular-api/fastify-checkout": "^0.4.6",
+ "@modular-api/quasar-components": "^0.3.2",
"@quasar/extras": "1.16.12",
"@quasar/quasar-ui-qcalendar": "4.0.0-beta.16",
"@simsustech/quasar-components": "^0.10.6",
diff --git a/packages/app/src/lang/en-US.ts b/packages/app/src/lang/en-US.ts
index 411614b..df6b11e 100644
--- a/packages/app/src/lang/en-US.ts
+++ b/packages/app/src/lang/en-US.ts
@@ -199,7 +199,11 @@ const lang: Language = {
},
messages: {
createReceipt: ({ clientDetails, totalIncludingTax }) =>
- `Are you sure you want to create a receipt for the bill to ${clientDetails.companyName || clientDetails.contactPersonName} with the amount of ${totalIncludingTax}?`
+ `Are you sure you want to create a receipt for the bill to ${clientDetails.companyName || clientDetails.contactPersonName} with the amount of ${totalIncludingTax}?`,
+ addCashPayment: ({ clientDetails, totalIncludingTax }) =>
+ `Enter the amount that was paid in cash for the bill to ${clientDetails.companyName || clientDetails.contactPersonName} with the amount of ${totalIncludingTax}`,
+ addPinPayment: ({ clientDetails, totalIncludingTax }) =>
+ `Enter the amount that was paid by pin for the bill to ${clientDetails.companyName || clientDetails.contactPersonName} with the amount of ${totalIncludingTax}`
}
},
checkout: {
diff --git a/packages/app/src/lang/index.ts b/packages/app/src/lang/index.ts
index 87ed263..accc91a 100644
--- a/packages/app/src/lang/index.ts
+++ b/packages/app/src/lang/index.ts
@@ -229,6 +229,20 @@ export interface Language {
clientDetails: ClientDetails
totalIncludingTax: number | string
}) => string
+ addCashPayment: ({
+ clientDetails,
+ totalIncludingTax
+ }: {
+ clientDetails: ClientDetails
+ totalIncludingTax: number | string
+ }) => string
+ addPinPayment: ({
+ clientDetails,
+ totalIncludingTax
+ }: {
+ clientDetails: ClientDetails
+ totalIncludingTax: number | string
+ }) => string
}
}
checkout: {
diff --git a/packages/app/src/lang/nl.ts b/packages/app/src/lang/nl.ts
index 09fe31f..a221929 100644
--- a/packages/app/src/lang/nl.ts
+++ b/packages/app/src/lang/nl.ts
@@ -201,7 +201,11 @@ const lang: Language = {
},
messages: {
createReceipt: ({ clientDetails, totalIncludingTax }) =>
- `Weet u zeker dat u een bon wilt maken voor de rekening aan ${clientDetails.companyName || clientDetails.contactPersonName} ter hoogte van ${totalIncludingTax}?`
+ `Weet u zeker dat u een kwitantie wilt maken voor de rekening aan ${clientDetails.companyName || clientDetails.contactPersonName} ter hoogte van ${totalIncludingTax}?`,
+ addCashPayment: ({ clientDetails, totalIncludingTax }) =>
+ `Vul het bedrag in dat contant is betaald aan de rekening aan ${clientDetails.companyName || clientDetails.contactPersonName} ter hoogte van ${totalIncludingTax}.`,
+ addPinPayment: ({ clientDetails, totalIncludingTax }) =>
+ `Vul het bedrag in dat per pin is betaald aan de rekening aan ${clientDetails.companyName || clientDetails.contactPersonName} ter hoogte van ${totalIncludingTax}.`
}
},
checkout: {
diff --git a/packages/app/src/pages/InvoicePage.vue b/packages/app/src/pages/InvoicePage.vue
index 370d836..ada5e80 100644
--- a/packages/app/src/pages/InvoicePage.vue
+++ b/packages/app/src/pages/InvoicePage.vue
@@ -89,7 +89,8 @@
+
+
+
+
+
+
+
+
+ {{ lang.payment.methods.cash }}
+
+
+
+
+
+
+
+
+
+
+ {{ lang.payment.methods.pin }}
+
+
+
+
{
if (invoice.value) {
const data = generateEpcQrCodeData({
name: invoice.value.companyDetails.name,
- bic: 'RABONL2U' || invoice.value.companyDetails.bic,
- iban: 'NL82RABO6579776978' || invoice.value.companyDetails.iban,
- amount: invoice.value.amountDue,
+ bic: invoice.value.companyDetails.bic,
+ iban: invoice.value.companyDetails.iban,
+ amount: invoice.value.amountDue || 0,
currency: invoice.value.currency,
information: description.value,
unstructuredReference: invoice.value.uuid
@@ -415,6 +462,85 @@ const format = (value: number) =>
}).format(value / 100)
const language = ref($q.lang.isoName)
+
+const openAddCashPaymentDialog = async ({ data }: { data: Invoice }) => {
+ const format = (value: number) =>
+ Intl.NumberFormat(data.locale, {
+ maximumFractionDigits: 2,
+ style: 'currency',
+ currency: data.currency
+ }).format(value / 100)
+ return $q
+ .dialog({
+ component: PriceInputDialog,
+ componentProps: {
+ message: lang.value.bill.messages.addCashPayment({
+ clientDetails: data.clientDetails,
+ totalIncludingTax: format(data.totalIncludingTax)
+ }),
+ currency: data.currency
+ }
+ })
+ .onOk(async (amount) => {
+ const result = useMutation('admin.addPaymentToInvoice', {
+ args: {
+ id: data.id,
+ payment: {
+ amount,
+ currency: data.currency,
+ description: new Date().toISOString().slice(0, 10),
+ method: PaymentMethod.cash
+ }
+ },
+ immediate: true
+ })
+
+ await result.immediatePromise
+
+ if (!result.error.value) execute()
+ })
+}
+
+const openAddPinPaymentDialog = async ({ data }: { data: Invoice }) => {
+ const format = (value: number) =>
+ Intl.NumberFormat($q.lang.isoName, {
+ maximumFractionDigits: 2,
+ style: 'currency',
+ currency: data.currency
+ }).format(value / 100)
+ return $q
+ .dialog({
+ component: AddPaymentDialog,
+ componentProps: {
+ message: lang.value.bill.messages.addPinPayment({
+ clientDetails: data.clientDetails,
+ totalIncludingTax: format(data.totalIncludingTax)
+ }),
+ currency: data.currency
+ }
+ })
+ .onOk(async ({ amount, transactionReference }) => {
+ const result = useMutation('admin.addPaymentToInvoice', {
+ args: {
+ id: data.id,
+ payment: {
+ amount,
+ currency: data.currency,
+ description: new Date().toISOString().slice(0, 10),
+ transactionReference,
+ method: PaymentMethod.pin
+ }
+ },
+ immediate: true
+ })
+ await result.immediatePromise
+
+ if (!result.error.value) {
+ await execute()
+ }
+ })
+}
+
onMounted(async () => {
if (__IS_PWA__) {
await import('../pwa.js')
@@ -423,7 +549,6 @@ onMounted(async () => {
await loadConfiguration(language)
await useOAuthClient()
- await oAuthClient.value?.getUserInfo()
try {
await oAuthClient.value?.signInSilently({})
@@ -431,6 +556,8 @@ onMounted(async () => {
console.error('Failed to sign in silently')
}
+ await oAuthClient.value?.getUserInfo()
+
if (oAuthClient.value?.getAccessToken()) {
user.value = await oAuthClient.value?.getUser()
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 64274dd..508222f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -49,14 +49,14 @@ importers:
specifier: 8.0.1
version: 8.0.1
'@modular-api/api':
- specifier: ^0.5.5
- version: 0.5.5(bcrypt@5.1.1)(fastify@5.0.0)(handlebars@4.7.8)(kysely@0.27.4)(openid-client@5.7.0)(otplib@12.0.1)(typescript@5.6.2)(vue@3.5.8(typescript@5.6.2))
+ specifier: ^0.5.6
+ version: 0.5.6(bcrypt@5.1.1)(fastify@5.0.0)(handlebars@4.7.8)(kysely@0.27.4)(openid-client@5.7.0)(otplib@12.0.1)(typescript@5.6.2)(vue@3.5.8(typescript@5.6.2))
'@modular-api/fastify-cart':
specifier: ^0.3.0
version: 0.3.0(kysely@0.27.4)
'@modular-api/fastify-checkout':
- specifier: ^0.4.5
- version: 0.4.5(kysely@0.27.4)
+ specifier: ^0.4.6
+ version: 0.4.6(kysely@0.27.4)
'@modular-api/fastify-oidc':
specifier: ^0.6.0
version: 0.6.0(@fastify/static@8.0.1)(bcrypt@5.1.1)(fastify@5.0.0)(handlebars@4.7.8)(kysely@0.27.4)(otplib@12.0.1)(typescript@5.6.2)
@@ -210,11 +210,11 @@ importers:
specifier: ^0.3.0
version: 0.3.0(kysely@0.27.4)
'@modular-api/fastify-checkout':
- specifier: ^0.4.4
- version: 0.4.4(kysely@0.27.4)
+ specifier: ^0.4.6
+ version: 0.4.6(kysely@0.27.4)
'@modular-api/quasar-components':
- specifier: ^0.3.1
- version: 0.3.1(quasar@2.17.0)
+ specifier: ^0.3.2
+ version: 0.3.2(quasar@2.17.0)
'@quasar/extras':
specifier: 1.16.12
version: 1.16.12
@@ -1771,8 +1771,8 @@ packages:
resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==}
hasBin: true
- '@modular-api/api@0.5.5':
- resolution: {integrity: sha512-XhDV7v/6NAe7eV1Ab6c2n1KT8nQ+zhoyzKvvcWYKP28plvy8jfvLLOSIsVdlmMX/Ddq6ugHj32BFQ3U4M5QMuw==}
+ '@modular-api/api@0.5.6':
+ resolution: {integrity: sha512-WK62emElEgLDxcci/AYLqgAZLJEwFWzkyyHE1SiAaWXzXUaw1e4nVii+BkiASKfhGTieSlRLt+U9tqIJIeKP/w==}
peerDependencies:
kysely: ^0.27.4
openid-client: ^5.6.5
@@ -1782,13 +1782,8 @@ packages:
peerDependencies:
kysely: ^0.27.4
- '@modular-api/fastify-checkout@0.4.4':
- resolution: {integrity: sha512-WQNx5RldDAJUWwdJCshNNyY9X1rpydhbV5EYZgQWCWxWi48JEDDSWo2JqmwRL+PVOEwbUnwf7gtTxy7nFl2wvg==}
- peerDependencies:
- kysely: ^0.27.4
-
- '@modular-api/fastify-checkout@0.4.5':
- resolution: {integrity: sha512-RGh+3rB5Iv7hbzHd9ayUWGqtTTxbILzhwUONYCDc20YnAKWmoavzPqtxmAWETJRy06TW7PwCdqEOISNXm+XJdw==}
+ '@modular-api/fastify-checkout@0.4.6':
+ resolution: {integrity: sha512-Xs2pzEQYbRnBribpMqZ1lq9btBsHkTjotUePONTsjD/CXhcbdFn35zDub289ZaCnW2s9p+OYQ4bI8iLGAUQMjA==}
peerDependencies:
kysely: ^0.27.4
@@ -1806,8 +1801,8 @@ packages:
'@fastify/static': ^7.0.3
fastify: ^4.26.2
- '@modular-api/quasar-components@0.3.1':
- resolution: {integrity: sha512-6qo6ZVWIYo3Aq8HnZDuaBZ41Nvn4fEHaimfulTqKsOwyxStzTWo8bi+O7wMh/7NGzb7hP32i3ygOWSF4z3YRTA==}
+ '@modular-api/quasar-components@0.3.2':
+ resolution: {integrity: sha512-wdnb2p2/wBnTfktDleutPPi9lK3y0pg03ok6Y8ciSbITxLpp0F2B1D7p0zdxwkD78g2MBVcTbJOsEZCkrY8xXw==}
peerDependencies:
quasar: ^2.15.2
@@ -7255,7 +7250,7 @@ snapshots:
- encoding
- supports-color
- '@modular-api/api@0.5.5(bcrypt@5.1.1)(fastify@5.0.0)(handlebars@4.7.8)(kysely@0.27.4)(openid-client@5.7.0)(otplib@12.0.1)(typescript@5.6.2)(vue@3.5.8(typescript@5.6.2))':
+ '@modular-api/api@0.5.6(bcrypt@5.1.1)(fastify@5.0.0)(handlebars@4.7.8)(kysely@0.27.4)(openid-client@5.7.0)(otplib@12.0.1)(typescript@5.6.2)(vue@3.5.8(typescript@5.6.2))':
dependencies:
'@fastify/cookie': 10.0.1
'@fastify/cors': 10.0.1
@@ -7263,7 +7258,7 @@ snapshots:
'@fastify/middie': 9.0.2
'@fastify/static': 8.0.1
'@modular-api/fastify-cart': 0.3.0(kysely@0.27.4)
- '@modular-api/fastify-checkout': 0.4.5(kysely@0.27.4)
+ '@modular-api/fastify-checkout': 0.4.6(kysely@0.27.4)
'@modular-api/fastify-oidc': 0.6.0(@fastify/static@8.0.1)(bcrypt@5.1.1)(fastify@5.0.0)(handlebars@4.7.8)(kysely@0.27.4)(otplib@12.0.1)(typescript@5.6.2)
'@trpc/server': 10.45.2
'@types/compression': 1.7.5
@@ -7301,19 +7296,7 @@ snapshots:
transitivePeerDependencies:
- encoding
- '@modular-api/fastify-checkout@0.4.4(kysely@0.27.4)':
- dependencies:
- '@fastify/cookie': 10.0.1
- '@fastify/middie': 9.0.2
- '@fastify/static': 8.0.1
- '@mollie/api-client': 4.0.0
- '@vitrify/tools': 0.2.0
- fastify-plugin: 5.0.1
- kysely: 0.27.4
- transitivePeerDependencies:
- - encoding
-
- '@modular-api/fastify-checkout@0.4.5(kysely@0.27.4)':
+ '@modular-api/fastify-checkout@0.4.6(kysely@0.27.4)':
dependencies:
'@fastify/cookie': 10.0.1
'@fastify/middie': 9.0.2
@@ -7349,7 +7332,7 @@ snapshots:
'@fastify/static': 8.0.1
fastify: 5.0.0
- '@modular-api/quasar-components@0.3.1(quasar@2.17.0)':
+ '@modular-api/quasar-components@0.3.2(quasar@2.17.0)':
dependencies:
quasar: 2.17.0
validator: 13.12.0