diff options
author | Sebastian <sebasjm@gmail.com> | 2021-11-24 08:57:26 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2021-11-24 08:58:49 -0300 |
commit | 0bfd4523b3408d9c841a1f25fd9ec86e81d6dd8f (patch) | |
tree | f453943d92fefbd04b9222a5f25f2c9563c239f3 /packages/taler-wallet-webextension/src/cta | |
parent | f07436aa4910114a514235fb17879411dae0a555 (diff) | |
download | wallet-core-0bfd4523b3408d9c841a1f25fd9ec86e81d6dd8f.tar.xz |
adding tos information in settings and return to manual withdraw when adding an exchange
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta')
3 files changed, 68 insertions, 153 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx index 5eddde64f..5109055e8 100644 --- a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx +++ b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx @@ -8,6 +8,7 @@ import { LinkSuccess, TermsOfService, WarningBox, + WarningText, } from "../components/styled"; import { TermsState } from "../utils"; @@ -28,10 +29,27 @@ export function TermsOfServiceSection({ if (!reviewing) { if (!reviewed) { if (!onReview) { - return <section>Terms of service status: {terms.status}</section>; + return ( + <Fragment> + {terms.status === "notfound" && ( + <section> + <WarningText> + {i18n.str`Exchange doesn't have terms of service`} + </WarningText> + </section> + )} + </Fragment> + ); } return ( <Fragment> + {terms.status === "notfound" && ( + <section> + <WarningText> + {i18n.str`Exchange doesn't have terms of service`} + </WarningText> + </section> + )} {terms.status === "new" && ( <section> <ButtonSuccess upperCased onClick={() => onReview(true)}> @@ -64,7 +82,6 @@ export function TermsOfServiceSection({ enabled={reviewed} label={i18n.str`I accept the exchange terms of service`} onToggle={() => { - console.log("asdasd", reviewed); onAccept(!reviewed); if (onReview) onReview(false); }} diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx index fbbecd6f3..3915dc126 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx +++ b/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { amountFractionalBase } from "@gnu-taler/taler-util"; +import { amountFractionalBase, ExchangeListItem } from "@gnu-taler/taler-util"; import { createExample } from "../test-utils"; import { termsHtml, termsPdf, termsPlain, termsXml } from "./termsExample"; import { View as TestedComponent } from "./Withdraw"; @@ -32,24 +32,38 @@ export default { }, }; -export const NewTerms = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], +const exchangeList: ExchangeListItem[] = [ + { + currency: "USD", + exchangeBaseUrl: "exchange.demo.taler.net", + tos: { + currentVersion: "1", + acceptedVersion: "1", + content: "terms of service content", + contentType: "text/plain", }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], + paytoUris: ["asd"], + }, + { + currency: "USD", + exchangeBaseUrl: "exchange.test.taler.net", + tos: { + currentVersion: "1", + acceptedVersion: "1", + content: "terms of service content", + contentType: "text/plain", }, - ], + paytoUris: ["asd"], + }, +]; + +export const NewTerms = createExample(TestedComponent, { + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", fraction: 0, - value: 0, + value: 1, }, amount: { currency: "USD", @@ -71,18 +85,7 @@ export const NewTerms = createExample(TestedComponent, { }); export const TermsReviewingPLAIN = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -110,18 +113,7 @@ export const TermsReviewingPLAIN = createExample(TestedComponent, { }); export const TermsReviewingHTML = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -151,18 +143,7 @@ export const TermsReviewingHTML = createExample(TestedComponent, { }); export const TermsReviewingPDF = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -192,18 +173,7 @@ export const TermsReviewingPDF = createExample(TestedComponent, { }); export const TermsReviewingXML = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -231,18 +201,7 @@ export const TermsReviewingXML = createExample(TestedComponent, { }); export const NewTermsAccepted = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -269,18 +228,7 @@ export const NewTermsAccepted = createExample(TestedComponent, { }); export const TermsShowAgainXML = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -309,18 +257,7 @@ export const TermsShowAgainXML = createExample(TestedComponent, { }); export const TermsChanged = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -347,18 +284,7 @@ export const TermsChanged = createExample(TestedComponent, { }); export const TermsNotFound = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -382,18 +308,7 @@ export const TermsNotFound = createExample(TestedComponent, { }); export const TermsAlreadyAccepted = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", @@ -417,18 +332,7 @@ export const TermsAlreadyAccepted = createExample(TestedComponent, { }); export const WithoutFee = createExample(TestedComponent, { - knownExchanges: [ - { - currency: "USD", - exchangeBaseUrl: "exchange.demo.taler.net", - paytoUris: ["asd"], - }, - { - currency: "USD", - exchangeBaseUrl: "exchange.test.taler.net", - paytoUris: ["asd"], - }, - ], + knownExchanges: exchangeList, exchangeBaseUrl: "exchange.demo.taler.net", withdrawalFee: { currency: "USD", diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx index 4ebbe11c6..eead51690 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx +++ b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx @@ -38,7 +38,6 @@ import { ButtonWarning, LinkSuccess, WalletAction, - WarningText, } from "../components/styled"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook"; import { amountToString, buildTermsOfServiceState, TermsState } from "../utils"; @@ -98,17 +97,19 @@ export function View({ text={amountToString(Amounts.sub(amount, withdrawalFee).amount)} kind="positive" /> - <Part - title="Chosen amount" - text={amountToString(amount)} - kind="neutral" - /> {Amounts.isNonZero(withdrawalFee) && ( - <Part - title="Exchange fee" - text={amountToString(withdrawalFee)} - kind="negative" - /> + <Fragment> + <Part + title="Chosen amount" + text={amountToString(amount)} + kind="neutral" + /> + <Part + title="Exchange fee" + text={amountToString(withdrawalFee)} + kind="negative" + /> + </Fragment> )} {exchangeBaseUrl && ( <Part title="Exchange" text={exchangeBaseUrl} kind="neutral" big /> @@ -140,13 +141,6 @@ export function View({ )} </section> )} - {terms.status === "notfound" && ( - <section> - <WarningText> - {i18n.str`Exchange doesn't have terms of service`} - </WarningText> - </section> - )} <TermsOfServiceSection reviewed={reviewed} reviewing={reviewing} |