fix tests and added addExchange
This commit is contained in:
parent
2e8e1a15c9
commit
e227fa4e47
@ -48,7 +48,7 @@ export enum Pages {
|
|||||||
|
|
||||||
pay = '/pay',
|
pay = '/pay',
|
||||||
refund = '/refund',
|
refund = '/refund',
|
||||||
tips = '/tips',
|
tips = '/tip',
|
||||||
withdraw = '/withdraw',
|
withdraw = '/withdraw',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,13 @@ export function ManualWithdrawPage({ }: Props): VNode {
|
|||||||
try {
|
try {
|
||||||
const r = await fetch(`${exchange}/keys`)
|
const r = await fetch(`${exchange}/keys`)
|
||||||
const j = await r.json()
|
const j = await r.json()
|
||||||
setCurrency(j.currency)
|
if (j.currency) {
|
||||||
|
await wxApi.addExchange({
|
||||||
|
exchangeBaseUrl: `${exchange}/`,
|
||||||
|
forceUpdate: true
|
||||||
|
})
|
||||||
|
setCurrency(j.currency)
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setError('The exchange url seems invalid')
|
setError('The exchange url seems invalid')
|
||||||
setCurrency(undefined)
|
setCurrency(undefined)
|
||||||
|
@ -44,6 +44,7 @@ import {
|
|||||||
AcceptManualWithdrawalRequest,
|
AcceptManualWithdrawalRequest,
|
||||||
AmountJson,
|
AmountJson,
|
||||||
ExchangesListRespose,
|
ExchangesListRespose,
|
||||||
|
AddExchangeRequest,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { AddBackupProviderRequest, BackupProviderState, OperationFailedError, RemoveBackupProviderRequest } from "@gnu-taler/taler-wallet-core";
|
import { AddBackupProviderRequest, BackupProviderState, OperationFailedError, RemoveBackupProviderRequest } from "@gnu-taler/taler-wallet-core";
|
||||||
import { BackupInfo } from "@gnu-taler/taler-wallet-core";
|
import { BackupInfo } from "@gnu-taler/taler-wallet-core";
|
||||||
@ -326,6 +327,18 @@ export function getExchangeWithdrawalInfo(
|
|||||||
): Promise<ExchangeWithdrawDetails> {
|
): Promise<ExchangeWithdrawDetails> {
|
||||||
return callBackend("getExchangeWithdrawalInfo", req);
|
return callBackend("getExchangeWithdrawalInfo", req);
|
||||||
}
|
}
|
||||||
|
// export const codecForAddExchangeRequest = (): Codec<AddExchangeRequest> =>
|
||||||
|
// buildCodecForObject<AddExchangeRequest>()
|
||||||
|
// .property("exchangeBaseUrl", codecForString())
|
||||||
|
// .property("forceUpdate", codecOptional(codecForBoolean()))
|
||||||
|
// .build("AddExchangeRequest");
|
||||||
|
|
||||||
|
export function addExchange(
|
||||||
|
req: AddExchangeRequest,
|
||||||
|
): Promise<void> {
|
||||||
|
return callBackend("addExchange", req);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export function prepareTip(req: PrepareTipRequest): Promise<PrepareTipResult> {
|
export function prepareTip(req: PrepareTipRequest): Promise<PrepareTipResult> {
|
||||||
return callBackend("prepareTip", req);
|
return callBackend("prepareTip", req);
|
||||||
|
Loading…
Reference in New Issue
Block a user