summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-12-01 10:09:38 -0300
committerSebastian <sebasjm@gmail.com>2023-12-01 10:09:54 -0300
commit1e5abb5b2aa9545e194f6db879e7480162f6d481 (patch)
treed5e31d4cfe595aeb20c6e0dce2719e2a5ebc352c /packages/taler-wallet-core/src
parentce2e58962cb0a61725fe0fe3dd8535965f482b95 (diff)
downloadwallet-core-1e5abb5b2aa9545e194f6db879e7480162f6d481.tar.gz
wallet-core-1e5abb5b2aa9545e194f6db879e7480162f6d481.tar.bz2
wallet-core-1e5abb5b2aa9545e194f6db879e7480162f6d481.zip
exchange account info
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r--packages/taler-wallet-core/src/db.ts38
-rw-r--r--packages/taler-wallet-core/src/operations/transactions.ts11
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts24
3 files changed, 44 insertions, 29 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index e92b0d449..4cc11d9eb 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -577,11 +577,11 @@ export interface ExchangeDetailsRecord {
* Information about ToS acceptance from the user.
*/
tosAccepted:
- | {
- etag: string;
- timestamp: DbPreciseTimestamp;
- }
- | undefined;
+ | {
+ etag: string;
+ timestamp: DbPreciseTimestamp;
+ }
+ | undefined;
wireInfo: WireInfo;
@@ -1334,9 +1334,9 @@ export enum ConfigRecordKey {
*/
export type ConfigRecord =
| {
- key: ConfigRecordKey.WalletBackupState;
- value: WalletBackupConfState;
- }
+ key: ConfigRecordKey.WalletBackupState;
+ value: WalletBackupConfState;
+ }
| { key: ConfigRecordKey.CurrencyDefaultsApplied; value: boolean }
| { key: ConfigRecordKey.DevMode; value: boolean };
@@ -1378,6 +1378,10 @@ export interface WgInfoBankIntegrated {
* a Taler-integrated bank.
*/
bankInfo: ReserveBankInfo;
+ /**
+ * Info about withdrawal accounts, possibly including currency conversion.
+ */
+ exchangeCreditAccounts?: WithdrawalExchangeAccountDetails[];
}
export interface WgInfoBankManual {
@@ -1599,15 +1603,15 @@ export enum BackupProviderStateTag {
export type BackupProviderState =
| {
- tag: BackupProviderStateTag.Provisional;
- }
+ tag: BackupProviderStateTag.Provisional;
+ }
| {
- tag: BackupProviderStateTag.Ready;
- nextBackupTimestamp: DbPreciseTimestamp;
- }
+ tag: BackupProviderStateTag.Ready;
+ nextBackupTimestamp: DbPreciseTimestamp;
+ }
| {
- tag: BackupProviderStateTag.Retrying;
- };
+ tag: BackupProviderStateTag.Retrying;
+ };
export interface BackupProviderTerms {
supportedProtocolVersion: string;
@@ -3065,7 +3069,7 @@ export async function openStoredBackupsDatabase(
idbFactory,
TALER_WALLET_STORED_BACKUPS_DB_NAME,
1,
- () => {},
+ () => { },
onStoredBackupsDbUpgradeNeeded,
);
@@ -3088,7 +3092,7 @@ export async function openTalerDatabase(
idbFactory,
TALER_WALLET_META_DB_NAME,
1,
- () => {},
+ () => { },
onMetaDbUpgradeNeeded,
);
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts
index 0ff552916..ee8c90407 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -540,7 +540,7 @@ function buildTransactionForPeerPullCredit(
const silentWithdrawalErrorForInvoice =
wsrOrt?.lastError &&
wsrOrt.lastError.code ===
- TalerErrorCode.WALLET_WITHDRAWAL_GROUP_INCOMPLETE &&
+ TalerErrorCode.WALLET_WITHDRAWAL_GROUP_INCOMPLETE &&
Object.values(wsrOrt.lastError.errorsPerCoin ?? {}).every((e) => {
return (
e.code === TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR &&
@@ -570,10 +570,10 @@ function buildTransactionForPeerPullCredit(
kycUrl: pullCredit.kycUrl,
...(wsrOrt?.lastError
? {
- error: silentWithdrawalErrorForInvoice
- ? undefined
- : wsrOrt.lastError,
- }
+ error: silentWithdrawalErrorForInvoice
+ ? undefined
+ : wsrOrt.lastError,
+ }
: {}),
};
}
@@ -674,6 +674,7 @@ function buildTransactionForBankIntegratedWithdraw(
withdrawalDetails: {
type: WithdrawalType.TalerBankIntegrationApi,
confirmed: wgRecord.wgInfo.bankInfo.timestampBankConfirmed ? true : false,
+ exchangeCreditAccountDetails: wgRecord.wgInfo.exchangeCreditAccounts,
reservePub: wgRecord.reservePub,
bankConfirmationUrl: wgRecord.wgInfo.bankInfo.confirmUrl,
reserveIsReady:
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index 9c798e813..868ac3adc 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -866,10 +866,10 @@ async function handleKycRequired(
amlStatus === AmlStatus.normal || amlStatus === undefined
? WithdrawalGroupStatus.PendingKyc
: amlStatus === AmlStatus.pending
- ? WithdrawalGroupStatus.PendingAml
- : amlStatus === AmlStatus.fronzen
- ? WithdrawalGroupStatus.SuspendedAml
- : assertUnreachable(amlStatus);
+ ? WithdrawalGroupStatus.PendingAml
+ : amlStatus === AmlStatus.fronzen
+ ? WithdrawalGroupStatus.SuspendedAml
+ : assertUnreachable(amlStatus);
notificationKycUrl = kycUrl;
@@ -1205,8 +1205,7 @@ export async function updateWithdrawalDenoms(
denom.verificationStatus === DenominationVerificationStatus.Unverified
) {
logger.trace(
- `Validating denomination (${current + 1}/${
- denominations.length
+ `Validating denomination (${current + 1}/${denominations.length
}) signature of ${denom.denomPubHash}`,
);
let valid = false;
@@ -1852,7 +1851,7 @@ export async function getExchangeWithdrawalInfo(
) {
logger.warn(
`wallet's support for exchange protocol version ${WALLET_EXCHANGE_PROTOCOL_VERSION} might be outdated ` +
- `(exchange has ${exchangeDetails.protocolVersionRange}), checking for updates`,
+ `(exchange has ${exchangeDetails.protocolVersionRange}), checking for updates`,
);
}
}
@@ -2524,11 +2523,22 @@ export async function acceptWithdrawalFromUri(
withdrawInfo.wireTypes,
);
+ const { exchangeDetails } = await ws.exchangeOps.updateExchangeFromUrl(
+ ws,
+ selectedExchange,
+ );
+
+ const withdrawalAccountList = await fetchWithdrawalAccountInfo(ws, {
+ exchangeDetails,
+ instructedAmount: withdrawInfo.amount,
+ });
+
const withdrawalGroup = await internalCreateWithdrawalGroup(ws, {
amount: withdrawInfo.amount,
exchangeBaseUrl: req.selectedExchange,
wgInfo: {
withdrawalType: WithdrawalRecordType.BankIntegrated,
+ exchangeCreditAccounts: withdrawalAccountList,
bankInfo: {
exchangePaytoUri,
talerWithdrawUri: req.talerWithdrawUri,