summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-02-09 11:11:34 -0300
committerSebastian <sebasjm@gmail.com>2024-02-09 11:11:34 -0300
commit8055f8834974773170f83c7013174e141ced53cb (patch)
treef5a7a6504857dc964b37634bb936655ebf7e5d45
parent6e370c3502a8e6474d4665eb42ae1bfdec3034a1 (diff)
downloadwallet-core-8055f8834974773170f83c7013174e141ced53cb.tar.gz
wallet-core-8055f8834974773170f83c7013174e141ced53cb.tar.bz2
wallet-core-8055f8834974773170f83c7013174e141ced53cb.zip
fix #8354: show import key after updating
-rw-r--r--packages/merchant-backoffice-ui/src/declaration.d.ts4
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx2
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatedSuccessfully.tsx4
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/Table.tsx2
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/index.tsx24
5 files changed, 22 insertions, 14 deletions
diff --git a/packages/merchant-backoffice-ui/src/declaration.d.ts b/packages/merchant-backoffice-ui/src/declaration.d.ts
index 38ab9d254..d716fe132 100644
--- a/packages/merchant-backoffice-ui/src/declaration.d.ts
+++ b/packages/merchant-backoffice-ui/src/declaration.d.ts
@@ -912,10 +912,6 @@ export namespace MerchantBackend {
// available, otherwise empty array.
wire_details: TransactionWireTransfer[];
- // Reports about trouble obtaining wire transfer details,
- // empty array if no trouble were encountered.
- wire_reports: TransactionWireReport[];
-
// The refund details for this order. One entry per
// refunded coin; empty array if there are no refunds.
refund_details: RefundDetails[];
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx
index 6e73a01a5..8b892e122 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx
@@ -91,7 +91,6 @@ export const PaidNotRefundable = createExample(TestedComponent, {
refund_details: [],
refund_pending: false,
wire_details: [],
- wire_reports: [],
wired: false,
},
});
@@ -115,7 +114,6 @@ export const PaidRefundable = createExample(TestedComponent, {
refund_details: [],
refund_pending: false,
wire_details: [],
- wire_reports: [],
wired: false,
},
});
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatedSuccessfully.tsx b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatedSuccessfully.tsx
index db3842711..45939c19d 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatedSuccessfully.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatedSuccessfully.tsx
@@ -29,10 +29,6 @@ interface Props {
onConfirm: () => void;
}
-function isNotUndefined<X>(x: X | undefined): x is X {
- return !!x;
-}
-
export function CreatedSuccessfully({
entity,
onConfirm,
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/Table.tsx b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/Table.tsx
index 0c28027fe..b7c22c17f 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/Table.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/Table.tsx
@@ -161,7 +161,7 @@ function Table({
onClick={(): void => onSelect(i)}
style={{ cursor: "pointer" }}
>
- {i.otp_device_id}
+ {i.device_description}
</td>
<td class="is-actions-cell right-sticky">
<div class="buttons is-right">
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/index.tsx
index 52f6c6c29..7c7092a4e 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/index.tsx
@@ -33,6 +33,7 @@ import { Notification } from "../../../../utils/types.js";
import { UpdatePage } from "./UpdatePage.js";
import { HttpStatusCode } from "@gnu-taler/taler-util";
import { useOtpDeviceAPI, useOtpDeviceDetails } from "../../../../hooks/otp.js";
+import { CreatedSuccessfully } from "../create/CreatedSuccessfully.js";
export type Entity = MerchantBackend.OTP.OtpDevicePatchDetails & WithId;
@@ -55,6 +56,7 @@ export default function UpdateValidator({
const { updateOtpDevice } = useOtpDeviceAPI();
const result = useOtpDeviceDetails(vid);
const [notif, setNotif] = useState<Notification | undefined>(undefined);
+ const [keyUpdated, setKeyUpdated] = useState<MerchantBackend.OTP.OtpDeviceAddDetails | null>(null)
const { i18n } = useTranslationContext();
@@ -73,6 +75,10 @@ export default function UpdateValidator({
return onLoadError(result);
}
+ if (keyUpdated) {
+ return <CreatedSuccessfully entity={keyUpdated} onConfirm={onConfirm} />
+ }
+
return (
<Fragment>
<NotificationCard notification={notif} />
@@ -85,9 +91,21 @@ export default function UpdateValidator({
otp_ctr: result.data.otp_ctr
}}
onBack={onBack}
- onUpdate={(data) => {
- return updateOtpDevice(vid, data)
- .then(onConfirm)
+ onUpdate={async (newInfo) => {
+ return updateOtpDevice(vid, newInfo)
+ .then((d) => {
+ if (newInfo.otp_key) {
+ setKeyUpdated({
+ otp_algorithm: newInfo.otp_algorithm,
+ otp_device_description: newInfo.otp_device_description,
+ otp_device_id: newInfo.id,
+ otp_key: newInfo.otp_key,
+ otp_ctr: newInfo.otp_ctr,
+ })
+ } else {
+ onConfirm()
+ }
+ })
.catch((error) => {
setNotif({
message: i18n.str`could not update template`,