diff --git a/mobile/src/api/api.ts b/mobile/src/api/api.ts index e2e962df..3d491105 100644 --- a/mobile/src/api/api.ts +++ b/mobile/src/api/api.ts @@ -768,11 +768,12 @@ export interface PublicSettings { referral_enabled: boolean; pool_names: string[]; crypto_payment_enabled: boolean; + crypto_only: boolean; nowpayments_currencies: string[]; } export const getPublicSettings = async (): Promise => { - const defaults: PublicSettings = { penalties_enabled: true, show_amende_score: true, points_enabled: true, points_separated: true, referral_enabled: true, pool_names: ['Pool 1', 'Pool 2'], crypto_payment_enabled: false, nowpayments_currencies: [] }; + const defaults: PublicSettings = { penalties_enabled: true, show_amende_score: true, points_enabled: true, points_separated: true, referral_enabled: true, pool_names: ['Pool 1', 'Pool 2'], crypto_payment_enabled: false, crypto_only: false, nowpayments_currencies: [] }; try { const { data } = await apiClient.get(`${V1}/app-settings`); return { @@ -785,6 +786,7 @@ export const getPublicSettings = async (): Promise => { ? data.pool_names : defaults.pool_names, crypto_payment_enabled: data.crypto_payment_enabled ?? false, + crypto_only: data.crypto_only ?? false, nowpayments_currencies: Array.isArray(data.nowpayments_currencies) ? data.nowpayments_currencies : [], }; } catch { @@ -813,7 +815,7 @@ export const getCryptoPaymentStatus = async (commandId: number): Promise => { try { - await apiClient.post(`${V1}/push-token`, { token }); + await apiClient.post(`${V1}/push-token`, { push_token: token }); } catch { // silencieux } diff --git a/mobile/src/screens/client/CheckoutScreen.tsx b/mobile/src/screens/client/CheckoutScreen.tsx index 9f5d6060..c6d93289 100644 --- a/mobile/src/screens/client/CheckoutScreen.tsx +++ b/mobile/src/screens/client/CheckoutScreen.tsx @@ -56,6 +56,7 @@ export default function CheckoutScreen() { // Crypto const [cryptoEnabled, setCryptoEnabled] = useState(false); + const [cryptoOnly, setCryptoOnly] = useState(false); const [cryptoCurrencies, setCryptoCurrencies] = useState([]); const [paymentMethod, setPaymentMethod] = useState<"especes" | "crypto">("especes"); const [payCurrency, setPayCurrency] = useState(""); @@ -73,6 +74,10 @@ export default function CheckoutScreen() { setCryptoEnabled(true); setCryptoCurrencies(settings.nowpayments_currencies); setPayCurrency(settings.nowpayments_currencies[0]); + if (settings.crypto_only) { + setCryptoOnly(true); + setPaymentMethod("crypto"); + } } }); AsyncStorage.multiGet([ @@ -379,6 +384,14 @@ export default function CheckoutScreen() { color: colors.textMuted, fontSize: fontSize.xs, textAlign: "center", }, cryptoSuccessText: { color: colors.success, fontSize: fontSize.sm, textAlign: "center" }, + // Crypto only badge + cryptoOnlyBadge: { + flexDirection: "row", alignItems: "center", gap: spacing.s, + backgroundColor: "rgba(247,147,26,0.10)", borderRadius: borderRadius.md, + borderWidth: 1, borderColor: CRYPTO_COLOR + "55", + padding: spacing.m, marginBottom: spacing.s, + }, + cryptoOnlyText: { color: CRYPTO_COLOR, fontSize: fontSize.sm, fontWeight: fontWeight.medium, flex: 1 }, }), [colors], ); @@ -470,34 +483,36 @@ export default function CheckoutScreen() { {cryptoEnabled && ( Méthode de paiement - - setPaymentMethod("especes")} - > - - - Espèces + + {cryptoOnly ? ( + + + + Paiement uniquement en cryptomonnaie - - setPaymentMethod("crypto")} - > - - - Crypto - - - + + ) : ( + + setPaymentMethod("especes")} + > + + + Espèces + + + setPaymentMethod("crypto")} + > + + + Crypto + + + + )} {paymentMethod === "crypto" && ( <>