show sharing action when the tx is not completed
This commit is contained in:
parent
94eeab8ad0
commit
5e7812d63e
@ -51,9 +51,9 @@ const commonTransaction = (): TransactionCommon =>
|
|||||||
amountEffective: "USD:9",
|
amountEffective: "USD:9",
|
||||||
pending: false,
|
pending: false,
|
||||||
timestamp: TalerProtocolTimestamp.fromSeconds(
|
timestamp: TalerProtocolTimestamp.fromSeconds(
|
||||||
new Date().getTime() - count++ * 60 * 60 * 7,
|
new Date().getTime() / 1000 - count++ * 60 * 60 * 7,
|
||||||
),
|
),
|
||||||
transactionId: "12",
|
transactionId: String(count),
|
||||||
} as TransactionCommon);
|
} as TransactionCommon);
|
||||||
|
|
||||||
const exampleData = {
|
const exampleData = {
|
||||||
@ -145,6 +145,7 @@ const exampleData = {
|
|||||||
pull_debit: {
|
pull_debit: {
|
||||||
...commonTransaction(),
|
...commonTransaction(),
|
||||||
type: TransactionType.PeerPullDebit,
|
type: TransactionType.PeerPullDebit,
|
||||||
|
|
||||||
exchangeBaseUrl: "https://exchange.taler.net",
|
exchangeBaseUrl: "https://exchange.taler.net",
|
||||||
} as TransactionPeerPullDebit,
|
} as TransactionPeerPullDebit,
|
||||||
};
|
};
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
AbsoluteTime,
|
||||||
PaymentStatus,
|
PaymentStatus,
|
||||||
TalerProtocolTimestamp,
|
TalerProtocolTimestamp,
|
||||||
TransactionCommon,
|
TransactionCommon,
|
||||||
@ -146,6 +147,13 @@ const exampleData = {
|
|||||||
push_credit: {
|
push_credit: {
|
||||||
...commonTransaction,
|
...commonTransaction,
|
||||||
type: TransactionType.PeerPushCredit,
|
type: TransactionType.PeerPushCredit,
|
||||||
|
info: {
|
||||||
|
expiration: {
|
||||||
|
t_s: new Date().getTime() / 1000 + 2 * 60 * 60,
|
||||||
|
},
|
||||||
|
summary: "take this money",
|
||||||
|
completed: true,
|
||||||
|
},
|
||||||
exchangeBaseUrl: "https://exchange.taler.net",
|
exchangeBaseUrl: "https://exchange.taler.net",
|
||||||
} as TransactionPeerPushCredit,
|
} as TransactionPeerPushCredit,
|
||||||
push_debit: {
|
push_debit: {
|
||||||
@ -153,6 +161,13 @@ const exampleData = {
|
|||||||
type: TransactionType.PeerPushDebit,
|
type: TransactionType.PeerPushDebit,
|
||||||
talerUri:
|
talerUri:
|
||||||
"taler://pay-push/exchange.taler.ar/HS585JK0QCXHJ8Z8QWZA3EBAY5WY7XNC1RR2MHJXSH2Z4WP0YPJ0",
|
"taler://pay-push/exchange.taler.ar/HS585JK0QCXHJ8Z8QWZA3EBAY5WY7XNC1RR2MHJXSH2Z4WP0YPJ0",
|
||||||
|
info: {
|
||||||
|
expiration: {
|
||||||
|
t_s: new Date().getTime() / 1000 + 2 * 60 * 60,
|
||||||
|
},
|
||||||
|
summary: "take this money",
|
||||||
|
completed: true,
|
||||||
|
},
|
||||||
exchangeBaseUrl: "https://exchange.taler.net",
|
exchangeBaseUrl: "https://exchange.taler.net",
|
||||||
} as TransactionPeerPushDebit,
|
} as TransactionPeerPushDebit,
|
||||||
pull_credit: {
|
pull_credit: {
|
||||||
@ -160,11 +175,25 @@ const exampleData = {
|
|||||||
type: TransactionType.PeerPullCredit,
|
type: TransactionType.PeerPullCredit,
|
||||||
talerUri:
|
talerUri:
|
||||||
"taler://pay-push/exchange.taler.ar/HS585JK0QCXHJ8Z8QWZA3EBAY5WY7XNC1RR2MHJXSH2Z4WP0YPJ0",
|
"taler://pay-push/exchange.taler.ar/HS585JK0QCXHJ8Z8QWZA3EBAY5WY7XNC1RR2MHJXSH2Z4WP0YPJ0",
|
||||||
|
info: {
|
||||||
|
expiration: {
|
||||||
|
t_s: new Date().getTime() / 1000 + 2 * 60 * 60,
|
||||||
|
},
|
||||||
|
summary: "pay me, please?",
|
||||||
|
completed: true,
|
||||||
|
},
|
||||||
exchangeBaseUrl: "https://exchange.taler.net",
|
exchangeBaseUrl: "https://exchange.taler.net",
|
||||||
} as TransactionPeerPullCredit,
|
} as TransactionPeerPullCredit,
|
||||||
pull_debit: {
|
pull_debit: {
|
||||||
...commonTransaction,
|
...commonTransaction,
|
||||||
type: TransactionType.PeerPullDebit,
|
type: TransactionType.PeerPullDebit,
|
||||||
|
info: {
|
||||||
|
expiration: {
|
||||||
|
t_s: new Date().getTime() / 1000 + 2 * 60 * 60,
|
||||||
|
},
|
||||||
|
summary: "pay me, please?",
|
||||||
|
completed: true,
|
||||||
|
},
|
||||||
exchangeBaseUrl: "https://exchange.taler.net",
|
exchangeBaseUrl: "https://exchange.taler.net",
|
||||||
} as TransactionPeerPullDebit,
|
} as TransactionPeerPullDebit,
|
||||||
};
|
};
|
||||||
@ -527,10 +556,17 @@ export const RefundPending = createExample(TestedComponent, {
|
|||||||
transaction: { ...exampleData.refund, pending: true },
|
transaction: { ...exampleData.refund, pending: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
export const InvoiceCredit = createExample(TestedComponent, {
|
export const InvoiceCreditComplete = createExample(TestedComponent, {
|
||||||
transaction: { ...exampleData.pull_credit },
|
transaction: { ...exampleData.pull_credit },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const InvoiceCreditIncomplete = createExample(TestedComponent, {
|
||||||
|
transaction: {
|
||||||
|
...exampleData.pull_credit,
|
||||||
|
info: { ...exampleData.pull_credit.info, completed: false },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const InvoiceDebit = createExample(TestedComponent, {
|
export const InvoiceDebit = createExample(TestedComponent, {
|
||||||
transaction: { ...exampleData.pull_debit },
|
transaction: { ...exampleData.pull_debit },
|
||||||
});
|
});
|
||||||
@ -539,6 +575,15 @@ export const TransferCredit = createExample(TestedComponent, {
|
|||||||
transaction: { ...exampleData.push_credit },
|
transaction: { ...exampleData.push_credit },
|
||||||
});
|
});
|
||||||
|
|
||||||
export const TransferDebit = createExample(TestedComponent, {
|
export const TransferDebitComplete = createExample(TestedComponent, {
|
||||||
transaction: { ...exampleData.push_debit },
|
transaction: { ...exampleData.push_debit },
|
||||||
});
|
});
|
||||||
|
export const TransferDebitIncomplete = createExample(TestedComponent, {
|
||||||
|
transaction: {
|
||||||
|
...exampleData.push_debit,
|
||||||
|
info: {
|
||||||
|
...exampleData.push_debit.info,
|
||||||
|
completed: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
@ -115,6 +115,9 @@ export function TransactionPage({ tid, goToWalletHistory }: Props): VNode {
|
|||||||
return (
|
return (
|
||||||
<TransactionView
|
<TransactionView
|
||||||
transaction={state.response}
|
transaction={state.response}
|
||||||
|
onSend={async () => {
|
||||||
|
null;
|
||||||
|
}}
|
||||||
onDelete={() =>
|
onDelete={() =>
|
||||||
wxApi.deleteTransaction(tid).then(() => goToWalletHistory(currency))
|
wxApi.deleteTransaction(tid).then(() => goToWalletHistory(currency))
|
||||||
}
|
}
|
||||||
@ -129,6 +132,7 @@ export function TransactionPage({ tid, goToWalletHistory }: Props): VNode {
|
|||||||
|
|
||||||
export interface WalletTransactionProps {
|
export interface WalletTransactionProps {
|
||||||
transaction: Transaction;
|
transaction: Transaction;
|
||||||
|
onSend: () => Promise<void>;
|
||||||
onDelete: () => Promise<void>;
|
onDelete: () => Promise<void>;
|
||||||
onRetry: () => Promise<void>;
|
onRetry: () => Promise<void>;
|
||||||
onRefund: (id: string) => Promise<void>;
|
onRefund: (id: string) => Promise<void>;
|
||||||
@ -147,6 +151,7 @@ export function TransactionView({
|
|||||||
transaction,
|
transaction,
|
||||||
onDelete,
|
onDelete,
|
||||||
onRetry,
|
onRetry,
|
||||||
|
onSend,
|
||||||
onRefund,
|
onRefund,
|
||||||
}: WalletTransactionProps): VNode {
|
}: WalletTransactionProps): VNode {
|
||||||
const [confirmBeforeForget, setConfirmBeforeForget] = useState(false);
|
const [confirmBeforeForget, setConfirmBeforeForget] = useState(false);
|
||||||
@ -169,6 +174,10 @@ export function TransactionView({
|
|||||||
}: {
|
}: {
|
||||||
children: ComponentChildren;
|
children: ComponentChildren;
|
||||||
}): VNode {
|
}): VNode {
|
||||||
|
const showSend =
|
||||||
|
(transaction.type === TransactionType.PeerPullCredit ||
|
||||||
|
transaction.type === TransactionType.PeerPushDebit) &&
|
||||||
|
!transaction.info.completed;
|
||||||
const showRetry =
|
const showRetry =
|
||||||
transaction.error !== undefined ||
|
transaction.error !== undefined ||
|
||||||
transaction.timestamp.t_s === "never" ||
|
transaction.timestamp.t_s === "never" ||
|
||||||
@ -194,7 +203,13 @@ export function TransactionView({
|
|||||||
</section>
|
</section>
|
||||||
<section>{children}</section>
|
<section>{children}</section>
|
||||||
<footer>
|
<footer>
|
||||||
<div />
|
<div>
|
||||||
|
{showSend ? (
|
||||||
|
<Button variant="contained" onClick={onSend}>
|
||||||
|
<i18n.Translate>Send</i18n.Translate>
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{showRetry ? (
|
{showRetry ? (
|
||||||
<Button variant="contained" onClick={onRetry}>
|
<Button variant="contained" onClick={onRetry}>
|
||||||
@ -597,16 +612,25 @@ export function TransactionView({
|
|||||||
Invoice
|
Invoice
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
|
{transaction.info.summary ? (
|
||||||
|
<Part
|
||||||
|
title={<i18n.Translate>Subject</i18n.Translate>}
|
||||||
|
text={transaction.info.summary}
|
||||||
|
kind="neutral"
|
||||||
|
/>
|
||||||
|
) : undefined}
|
||||||
<Part
|
<Part
|
||||||
title={<i18n.Translate>Exchange</i18n.Translate>}
|
title={<i18n.Translate>Exchange</i18n.Translate>}
|
||||||
text={transaction.exchangeBaseUrl}
|
text={transaction.exchangeBaseUrl}
|
||||||
kind="neutral"
|
kind="neutral"
|
||||||
/>
|
/>
|
||||||
<Part
|
{!transaction.info.completed && (
|
||||||
title={<i18n.Translate>URI</i18n.Translate>}
|
<Part
|
||||||
text={<ShowQrWithCopy text={transaction.talerUri} />}
|
title={<i18n.Translate>URI</i18n.Translate>}
|
||||||
kind="neutral"
|
text={<ShowQrWithCopy text={transaction.talerUri} />}
|
||||||
/>
|
kind="neutral"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<Part
|
<Part
|
||||||
title={<i18n.Translate>Details</i18n.Translate>}
|
title={<i18n.Translate>Details</i18n.Translate>}
|
||||||
text={
|
text={
|
||||||
@ -635,6 +659,13 @@ export function TransactionView({
|
|||||||
Invoice
|
Invoice
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
|
{transaction.info.summary ? (
|
||||||
|
<Part
|
||||||
|
title={<i18n.Translate>Subject</i18n.Translate>}
|
||||||
|
text={transaction.info.summary}
|
||||||
|
kind="neutral"
|
||||||
|
/>
|
||||||
|
) : undefined}
|
||||||
<Part
|
<Part
|
||||||
title={<i18n.Translate>Exchange</i18n.Translate>}
|
title={<i18n.Translate>Exchange</i18n.Translate>}
|
||||||
text={transaction.exchangeBaseUrl}
|
text={transaction.exchangeBaseUrl}
|
||||||
@ -667,16 +698,25 @@ export function TransactionView({
|
|||||||
Transfer
|
Transfer
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
|
{transaction.info.summary ? (
|
||||||
|
<Part
|
||||||
|
title={<i18n.Translate>Subject</i18n.Translate>}
|
||||||
|
text={transaction.info.summary}
|
||||||
|
kind="neutral"
|
||||||
|
/>
|
||||||
|
) : undefined}
|
||||||
<Part
|
<Part
|
||||||
title={<i18n.Translate>Exchange</i18n.Translate>}
|
title={<i18n.Translate>Exchange</i18n.Translate>}
|
||||||
text={transaction.exchangeBaseUrl}
|
text={transaction.exchangeBaseUrl}
|
||||||
kind="neutral"
|
kind="neutral"
|
||||||
/>
|
/>
|
||||||
<Part
|
{!transaction.info.completed && (
|
||||||
title={<i18n.Translate>URI</i18n.Translate>}
|
<Part
|
||||||
text={<QR text={transaction.talerUri} />}
|
title={<i18n.Translate>URI</i18n.Translate>}
|
||||||
kind="neutral"
|
text={<ShowQrWithCopy text={transaction.talerUri} />}
|
||||||
/>
|
kind="neutral"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<Part
|
<Part
|
||||||
title={<i18n.Translate>Details</i18n.Translate>}
|
title={<i18n.Translate>Details</i18n.Translate>}
|
||||||
text={
|
text={
|
||||||
@ -705,6 +745,13 @@ export function TransactionView({
|
|||||||
Transfer
|
Transfer
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
|
{transaction.info.summary ? (
|
||||||
|
<Part
|
||||||
|
title={<i18n.Translate>Subject</i18n.Translate>}
|
||||||
|
text={transaction.info.summary}
|
||||||
|
kind="neutral"
|
||||||
|
/>
|
||||||
|
) : undefined}
|
||||||
<Part
|
<Part
|
||||||
title={<i18n.Translate>Exchange</i18n.Translate>}
|
title={<i18n.Translate>Exchange</i18n.Translate>}
|
||||||
text={transaction.exchangeBaseUrl}
|
text={transaction.exchangeBaseUrl}
|
||||||
|
Loading…
Reference in New Issue
Block a user