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,28 +69,28 @@ export function ShowButtonsNonAcceptedTosView({
terms,
}: State.ShowButtonsNotAccepted): VNode {
const { i18n } = useTranslationContext();
const ableToReviewTermsOfService =
showingTermsOfService.button.onClick !== undefined;
// const ableToReviewTermsOfService =
// showingTermsOfService.button.onClick !== undefined;
if (!ableToReviewTermsOfService) {
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>
)}
</Fragment>
);
}
// 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>
// );
// }
return (
<Fragment>
{terms.status === ExchangeTosStatus.NotFound && (
{/* {terms.status === ExchangeTosStatus.NotFound && (
<section style={{ justifyContent: "space-around", display: "flex" }}>
<WarningText>
<i18n.Translate>
@ -98,8 +98,8 @@ export function ShowButtonsNonAcceptedTosView({
</i18n.Translate>
</WarningText>
</section>
)}
{terms.status === "new" && (
)} */}
{terms.status === ExchangeTosStatus.Pending && (
<section style={{ justifyContent: "space-around", display: "flex" }}>
<Button
variant="contained"
@ -110,19 +110,6 @@ export function ShowButtonsNonAcceptedTosView({
</Button>
</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>
);
}
@ -138,7 +125,7 @@ export function ShowTosContentView({
return (
<Fragment>
{terms.status !== ExchangeTosStatus.NotFound && !terms.content && (
{!terms.content && (
<section style={{ justifyContent: "space-around", display: "flex" }}>
<WarningBox>
<i18n.Translate>
@ -194,7 +181,7 @@ export function ShowTosContentView({
</LinkSuccess>
</section>
)}
{termsAccepted && terms.status !== ExchangeTosStatus.NotFound && (
{termsAccepted && terms.status !== ExchangeTosStatus.Proposed && (
<section style={{ justifyContent: "space-around", display: "flex" }}>
<CheckboxOutlined
name="terms"

View File

@ -141,8 +141,8 @@ export function useComponentStateFromParams({
confirm: {
onClick: isValid
? pushAlertOnError(async () => {
onAmountChanged(Amounts.stringify(amount));
})
onAmountChanged(Amounts.stringify(amount));
})
: undefined,
},
amount: {
@ -304,8 +304,8 @@ function exchangeSelectionState(
const [ageRestricted, setAgeRestricted] = useState(0);
const currentExchange = selectedExchange.selected;
const tosNeedToBeAccepted =
currentExchange.tosStatus == ExchangeTosStatus.New ||
currentExchange.tosStatus == ExchangeTosStatus.Changed;
currentExchange.tosStatus == ExchangeTosStatus.Pending ||
currentExchange.tosStatus == ExchangeTosStatus.Proposed;
/**
* With the exchange and amount, ask the wallet the information
@ -393,12 +393,12 @@ function exchangeSelectionState(
//TODO: calculate based on exchange info
const ageRestriction = ageRestrictionEnabled
? {
list: ageRestrictionOptions,
value: String(ageRestricted),
onChange: pushAlertOnError(async (v: string) =>
setAgeRestricted(parseInt(v, 10)),
),
}
list: ageRestrictionOptions,
value: String(ageRestricted),
onChange: pushAlertOnError(async (v: string) =>
setAgeRestricted(parseInt(v, 10)),
),
}
: undefined;
return {

View File

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

View File

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

View File

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