tos change, not so sure

This commit is contained in:
Sebastian 2023-08-30 13:22:29 -03:00
parent 7895728308
commit 79973a63dd
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
5 changed files with 41 additions and 57 deletions

View File

@ -69,13 +69,28 @@ export function ShowButtonsNonAcceptedTosView({
terms, terms,
}: State.ShowButtonsNotAccepted): VNode { }: State.ShowButtonsNotAccepted): VNode {
const { i18n } = useTranslationContext(); const { i18n } = useTranslationContext();
const ableToReviewTermsOfService = // const ableToReviewTermsOfService =
showingTermsOfService.button.onClick !== undefined; // showingTermsOfService.button.onClick !== undefined;
// if (!ableToReviewTermsOfService) {
// return (
// <Fragment>
// {terms.status === ExchangeTosStatus.Pending && (
// <section style={{ justifyContent: "space-around", display: "flex" }}>
// <WarningText>
// <i18n.Translate>
// Exchange doesn&apos;t have terms of service
// </i18n.Translate>
// </WarningText>
// </section>
// )}
// </Fragment>
// );
// }
if (!ableToReviewTermsOfService) {
return ( return (
<Fragment> <Fragment>
{terms.status === ExchangeTosStatus.NotFound && ( {/* {terms.status === ExchangeTosStatus.NotFound && (
<section style={{ justifyContent: "space-around", display: "flex" }}> <section style={{ justifyContent: "space-around", display: "flex" }}>
<WarningText> <WarningText>
<i18n.Translate> <i18n.Translate>
@ -83,23 +98,8 @@ export function ShowButtonsNonAcceptedTosView({
</i18n.Translate> </i18n.Translate>
</WarningText> </WarningText>
</section> </section>
)} )} */}
</Fragment> {terms.status === ExchangeTosStatus.Pending && (
);
}
return (
<Fragment>
{terms.status === ExchangeTosStatus.NotFound && (
<section style={{ justifyContent: "space-around", display: "flex" }}>
<WarningText>
<i18n.Translate>
Exchange doesn&apos;t have terms of service
</i18n.Translate>
</WarningText>
</section>
)}
{terms.status === "new" && (
<section style={{ justifyContent: "space-around", display: "flex" }}> <section style={{ justifyContent: "space-around", display: "flex" }}>
<Button <Button
variant="contained" variant="contained"
@ -110,19 +110,6 @@ export function ShowButtonsNonAcceptedTosView({
</Button> </Button>
</section> </section>
)} )}
{terms.status === "changed" && (
<section style={{ justifyContent: "space-around", display: "flex" }}>
<Button
variant="contained"
color="success"
onClick={showingTermsOfService.button.onClick}
>
<i18n.Translate>
Review new version of terms of service
</i18n.Translate>
</Button>
</section>
)}
</Fragment> </Fragment>
); );
} }
@ -138,7 +125,7 @@ export function ShowTosContentView({
return ( return (
<Fragment> <Fragment>
{terms.status !== ExchangeTosStatus.NotFound && !terms.content && ( {!terms.content && (
<section style={{ justifyContent: "space-around", display: "flex" }}> <section style={{ justifyContent: "space-around", display: "flex" }}>
<WarningBox> <WarningBox>
<i18n.Translate> <i18n.Translate>
@ -194,7 +181,7 @@ export function ShowTosContentView({
</LinkSuccess> </LinkSuccess>
</section> </section>
)} )}
{termsAccepted && terms.status !== ExchangeTosStatus.NotFound && ( {termsAccepted && terms.status !== ExchangeTosStatus.Proposed && (
<section style={{ justifyContent: "space-around", display: "flex" }}> <section style={{ justifyContent: "space-around", display: "flex" }}>
<CheckboxOutlined <CheckboxOutlined
name="terms" name="terms"

View File

@ -304,8 +304,8 @@ function exchangeSelectionState(
const [ageRestricted, setAgeRestricted] = useState(0); const [ageRestricted, setAgeRestricted] = useState(0);
const currentExchange = selectedExchange.selected; const currentExchange = selectedExchange.selected;
const tosNeedToBeAccepted = const tosNeedToBeAccepted =
currentExchange.tosStatus == ExchangeTosStatus.New || currentExchange.tosStatus == ExchangeTosStatus.Pending ||
currentExchange.tosStatus == ExchangeTosStatus.Changed; currentExchange.tosStatus == ExchangeTosStatus.Proposed;
/** /**
* With the exchange and amount, ask the wallet the information * With the exchange and amount, ask the wallet the information

View File

@ -37,7 +37,7 @@ const exchanges: ExchangeListItem[] = [
exchangeBaseUrl: "http://exchange.demo.taler.net", exchangeBaseUrl: "http://exchange.demo.taler.net",
paytoUris: [], paytoUris: [],
tosStatus: ExchangeTosStatus.Accepted, tosStatus: ExchangeTosStatus.Accepted,
exchangeStatus: ExchangeEntryStatus.Ok, exchangeStatus: ExchangeEntryStatus.Used,
permanent: true, permanent: true,
auditors: [ auditors: [
{ {
@ -202,7 +202,7 @@ describe("Withdraw CTA states", () => {
const exchangeWithNewTos = exchanges.map((e) => ({ const exchangeWithNewTos = exchanges.map((e) => ({
...e, ...e,
tosStatus: ExchangeTosStatus.New, tosStatus: ExchangeTosStatus.Proposed,
})); }));
handler.addWalletCallResponse( handler.addWalletCallResponse(

View File

@ -24,6 +24,7 @@ import {
ExchangeEntryStatus, ExchangeEntryStatus,
ExchangeListItem, ExchangeListItem,
ExchangeTosStatus, ExchangeTosStatus,
ExchangeUpdateStatus,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { expect } from "chai"; import { expect } from "chai";
@ -36,9 +37,9 @@ const exchangeArs: ExchangeListItem = {
currency: "ARS", currency: "ARS",
exchangeBaseUrl: "http://", exchangeBaseUrl: "http://",
tosStatus: ExchangeTosStatus.Accepted, tosStatus: ExchangeTosStatus.Accepted,
exchangeStatus: ExchangeEntryStatus.Ok, exchangeEntryStatus: ExchangeEntryStatus.Used,
exchangeUpdateStatus: ExchangeUpdateStatus.Initial,
paytoUris: [], paytoUris: [],
permanent: true,
ageRestrictionOptions: [], ageRestrictionOptions: [],
}; };

View File

@ -163,20 +163,16 @@ export function SettingsView({
<i18n.Translate>ok</i18n.Translate> <i18n.Translate>ok</i18n.Translate>
</SuccessText> </SuccessText>
); );
case ExchangeTosStatus.Changed: case ExchangeTosStatus.Pending:
return ( return (
<WarningText> <WarningText>
<i18n.Translate>changed</i18n.Translate> <i18n.Translate>pending</i18n.Translate>
</WarningText> </WarningText>
); );
case ExchangeTosStatus.New: case ExchangeTosStatus.Proposed:
case ExchangeTosStatus.NotFound:
return ( return (
<DestructiveText> <i18n.Translate>proposed</i18n.Translate>
<i18n.Translate>not accepted</i18n.Translate>
</DestructiveText>
); );
case ExchangeTosStatus.Unknown:
default: default:
return ( return (
<DestructiveText> <DestructiveText>