fixing txId reference based on nominal type
This commit is contained in:
parent
708cf016e4
commit
9181c1e81b
@ -80,28 +80,3 @@ function setValueDeeper(object: any, names: string[], value: any): any {
|
||||
}
|
||||
return { ...object, [head]: setValueDeeper(object[head] ?? {}, rest, value) };
|
||||
}
|
||||
|
||||
type TTT<T extends object, K extends keyof T, R> = K extends keyof T
|
||||
? R extends T[K]
|
||||
? number
|
||||
: never
|
||||
: never;
|
||||
|
||||
function impl<T extends object, K extends keyof T, R extends T[K]>(
|
||||
obj: T,
|
||||
name: K,
|
||||
): T[K] {
|
||||
return obj[name];
|
||||
}
|
||||
|
||||
interface Pepe {
|
||||
name: string;
|
||||
when: Date;
|
||||
size: number;
|
||||
}
|
||||
const p: Pepe = {
|
||||
name: "n",
|
||||
when: new Date(),
|
||||
size: 1,
|
||||
};
|
||||
const a = impl(p, "size");
|
||||
|
@ -23,6 +23,7 @@ import {
|
||||
Amounts,
|
||||
MerchantContractTerms as ContractTerms,
|
||||
PreparePayResultType,
|
||||
TransactionIdStr,
|
||||
} from "@gnu-taler/taler-util";
|
||||
import * as tests from "@gnu-taler/web-util/testing";
|
||||
import beer from "../../../static-dev/beer.png";
|
||||
@ -48,7 +49,7 @@ export const NoEnoughBalanceAvailable = tests.createExample(BaseView, {
|
||||
|
||||
uri: "",
|
||||
payStatus: {
|
||||
transactionId: " ",
|
||||
transactionId: " " as TransactionIdStr,
|
||||
status: PreparePayResultType.InsufficientBalance,
|
||||
balanceDetails: {
|
||||
amountRequested: "USD:10",
|
||||
@ -88,7 +89,7 @@ export const NoEnoughBalanceMaterial = tests.createExample(BaseView, {
|
||||
|
||||
uri: "",
|
||||
payStatus: {
|
||||
transactionId: " ",
|
||||
transactionId: " " as TransactionIdStr,
|
||||
status: PreparePayResultType.InsufficientBalance,
|
||||
balanceDetails: {
|
||||
amountRequested: "USD:10",
|
||||
@ -128,7 +129,7 @@ export const NoEnoughBalanceAgeAcceptable = tests.createExample(BaseView, {
|
||||
|
||||
uri: "",
|
||||
payStatus: {
|
||||
transactionId: " ",
|
||||
transactionId: " " as TransactionIdStr,
|
||||
status: PreparePayResultType.InsufficientBalance,
|
||||
balanceDetails: {
|
||||
amountRequested: "USD:10",
|
||||
@ -169,7 +170,7 @@ export const NoEnoughBalanceMerchantAcceptable = tests.createExample(BaseView, {
|
||||
|
||||
uri: "",
|
||||
payStatus: {
|
||||
transactionId: " ",
|
||||
transactionId: " " as TransactionIdStr,
|
||||
status: PreparePayResultType.InsufficientBalance,
|
||||
balanceDetails: {
|
||||
amountRequested: "USD:10",
|
||||
@ -211,7 +212,7 @@ export const NoEnoughBalanceMerchantDepositable = tests.createExample(
|
||||
|
||||
uri: "",
|
||||
payStatus: {
|
||||
transactionId: " ",
|
||||
transactionId: " " as TransactionIdStr,
|
||||
status: PreparePayResultType.InsufficientBalance,
|
||||
balanceDetails: {
|
||||
amountRequested: "USD:10",
|
||||
@ -252,7 +253,7 @@ export const NoEnoughBalanceFeeGap = tests.createExample(BaseView, {
|
||||
|
||||
uri: "",
|
||||
payStatus: {
|
||||
transactionId: " ",
|
||||
transactionId: " " as TransactionIdStr,
|
||||
status: PreparePayResultType.InsufficientBalance,
|
||||
balanceDetails: {
|
||||
amountRequested: "USD:10",
|
||||
@ -296,7 +297,7 @@ export const PaymentPossible = tests.createExample(BaseView, {
|
||||
|
||||
uri: "taler://pay/merchant-backend.taler/2021.242-01G2X4275RBWG/?c=66BE594PDZR24744J6EQK52XM0",
|
||||
payStatus: {
|
||||
transactionId: " ",
|
||||
transactionId: " " as TransactionIdStr,
|
||||
status: PreparePayResultType.PaymentPossible,
|
||||
talerUri: "taler://pay/..",
|
||||
amountEffective: "USD:10",
|
||||
@ -336,7 +337,7 @@ export const PaymentPossibleWithFee = tests.createExample(BaseView, {
|
||||
|
||||
uri: "taler://pay/merchant-backend.taler/2021.242-01G2X4275RBWG/?c=66BE594PDZR24744J6EQK52XM0",
|
||||
payStatus: {
|
||||
transactionId: " ",
|
||||
transactionId: " " as TransactionIdStr,
|
||||
status: PreparePayResultType.PaymentPossible,
|
||||
talerUri: "taler://pay/..",
|
||||
amountEffective: "USD:10.20",
|
||||
@ -373,7 +374,7 @@ export const TicketWithAProductList = tests.createExample(BaseView, {
|
||||
|
||||
uri: "taler://pay/merchant-backend.taler/2021.242-01G2X4275RBWG/?c=66BE594PDZR24744J6EQK52XM0",
|
||||
payStatus: {
|
||||
transactionId: " ",
|
||||
transactionId: " " as TransactionIdStr,
|
||||
status: PreparePayResultType.PaymentPossible,
|
||||
talerUri: "taler://pay/..",
|
||||
amountEffective: "USD:10.20",
|
||||
@ -429,7 +430,7 @@ export const TicketWithShipping = tests.createExample(BaseView, {
|
||||
|
||||
uri: "taler://pay/merchant-backend.taler/2021.242-01G2X4275RBWG/?c=66BE594PDZR24744J6EQK52XM0",
|
||||
payStatus: {
|
||||
transactionId: " ",
|
||||
transactionId: " " as TransactionIdStr,
|
||||
status: PreparePayResultType.PaymentPossible,
|
||||
talerUri: "taler://pay/..",
|
||||
amountEffective: "USD:10.20",
|
||||
@ -477,7 +478,7 @@ export const AlreadyConfirmedByOther = tests.createExample(BaseView, {
|
||||
|
||||
uri: "taler://pay/merchant-backend.taler/2021.242-01G2X4275RBWG/?c=66BE594PDZR24744J6EQK52XM0",
|
||||
payStatus: {
|
||||
transactionId: " ",
|
||||
transactionId: " " as TransactionIdStr,
|
||||
status: PreparePayResultType.AlreadyConfirmed,
|
||||
talerUri: "taler://pay/..",
|
||||
amountEffective: "USD:10",
|
||||
|
@ -19,9 +19,10 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { PendingTaskType } from "@gnu-taler/taler-wallet-core";
|
||||
import { PendingTaskType, TaskId } from "@gnu-taler/taler-wallet-core";
|
||||
import * as tests from "@gnu-taler/web-util/testing";
|
||||
import { View as TestedComponent } from "./DeveloperPage.js";
|
||||
import { PendingIdStr } from "@gnu-taler/taler-util";
|
||||
|
||||
export default {
|
||||
title: "developer",
|
||||
@ -35,7 +36,7 @@ export const AllOff = tests.createExample(TestedComponent, {
|
||||
onDownloadDatabase: async () => "this is the content of the database",
|
||||
operations: [
|
||||
{
|
||||
id: "",
|
||||
id: " " as TaskId,
|
||||
type: PendingTaskType.ExchangeUpdate,
|
||||
exchangeBaseUrl: "http://exchange.url.",
|
||||
givesLifeness: false,
|
||||
|
@ -19,7 +19,11 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { AbsoluteTime, AttentionType } from "@gnu-taler/taler-util";
|
||||
import {
|
||||
AbsoluteTime,
|
||||
AttentionType,
|
||||
TransactionIdStr,
|
||||
} from "@gnu-taler/taler-util";
|
||||
import * as tests from "@gnu-taler/web-util/testing";
|
||||
import { ReadyView } from "./views.js";
|
||||
|
||||
@ -34,7 +38,7 @@ export const Ready = tests.createExample(ReadyView, {
|
||||
read: false,
|
||||
info: {
|
||||
type: AttentionType.KycWithdrawal,
|
||||
transactionId: "123",
|
||||
transactionId: "123" as TransactionIdStr,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -42,7 +46,7 @@ export const Ready = tests.createExample(ReadyView, {
|
||||
read: false,
|
||||
info: {
|
||||
type: AttentionType.MerchantRefund,
|
||||
transactionId: "123",
|
||||
transactionId: "123" as TransactionIdStr,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -26,6 +26,7 @@ import {
|
||||
TalerProtocolTimestamp,
|
||||
TransactionCommon,
|
||||
TransactionDeposit,
|
||||
TransactionIdStr,
|
||||
TransactionMajorState,
|
||||
TransactionPayment,
|
||||
TransactionPeerPullCredit,
|
||||
@ -63,7 +64,7 @@ const commonTransaction: TransactionCommon = {
|
||||
major: TransactionMajorState.Done,
|
||||
},
|
||||
timestamp: TalerProtocolTimestamp.now(),
|
||||
transactionId: "txn:deposit:12",
|
||||
transactionId: "txn:deposit:12" as TransactionIdStr,
|
||||
type: TransactionType.Deposit,
|
||||
} as Omit<
|
||||
Omit<Omit<TransactionCommon, "extendedStatus">, "frozen">,
|
||||
|
@ -28,6 +28,7 @@ import {
|
||||
TalerProtocolTimestamp,
|
||||
Transaction,
|
||||
TransactionDeposit,
|
||||
TransactionIdStr,
|
||||
TransactionMajorState,
|
||||
TransactionType,
|
||||
TranslatedString,
|
||||
@ -74,10 +75,8 @@ interface Props {
|
||||
goToWalletHistory: (currency?: string) => Promise<void>;
|
||||
}
|
||||
|
||||
export function TransactionPage({
|
||||
tid: transactionId,
|
||||
goToWalletHistory,
|
||||
}: Props): VNode {
|
||||
export function TransactionPage({ tid, goToWalletHistory }: Props): VNode {
|
||||
const transactionId = tid as TransactionIdStr; //FIXME: validate
|
||||
const { i18n } = useTranslationContext();
|
||||
const api = useBackendContext();
|
||||
const state = useAsyncAsHook(
|
||||
@ -152,7 +151,7 @@ export interface WalletTransactionProps {
|
||||
onCancel: () => Promise<void>;
|
||||
onDelete: () => Promise<void>;
|
||||
onRetry: () => Promise<void>;
|
||||
onRefund: (id: string) => Promise<void>;
|
||||
onRefund: (id: TransactionIdStr) => Promise<void>;
|
||||
onBack: () => Promise<void>;
|
||||
}
|
||||
|
||||
@ -621,7 +620,7 @@ export function TransactionView({
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={safely("refund transaction", () =>
|
||||
onRefund(transaction.proposalId),
|
||||
onRefund(transaction.transactionId),
|
||||
)}
|
||||
>
|
||||
<i18n.Translate>Accept</i18n.Translate>
|
||||
|
Loading…
Reference in New Issue
Block a user