get-transaction-by-id.rst (20665B)
1 .. ts:op:: getTransactionById 2 :read-only: 3 4 Get a single transaction by its identifier. 5 6 **Request:** 7 8 The request ``args`` must be a `TransactionByIdRequest` object. 9 10 **Response:** 11 12 On success, the result is a `Transaction` object. 13 14 **Expected errors:** 15 16 The caller can handle the following errors inline: 17 ``WALLET_TRANSACTION_NOT_FOUND``, ``WALLET_CORE_API_BAD_REQUEST``. 18 19 **Details:** 20 21 The ``transactionId`` must have the form of a `TransactionIdStr`; 22 malformed identifiers fail with ``WALLET_CORE_API_BAD_REQUEST``, 23 well-formed but unknown identifiers with 24 ``WALLET_TRANSACTION_NOT_FOUND``. 25 26 The full contract terms (``contractTerms``) are only reported for 27 payment transactions and only when ``includeContractTerms`` is 28 set. 29 30 .. ts:def:: Transaction 31 32 // A transaction in the wallet's transaction history. The 33 // ``type`` field discriminates the union; all members share the 34 // fields of `TransactionCommon`. 35 type Transaction = 36 | TransactionWithdrawal 37 | TransactionPayment 38 | TransactionRefund 39 | TransactionRefresh 40 | TransactionDeposit 41 | TransactionPeerPullCredit 42 | TransactionPeerPullDebit 43 | TransactionPeerPushCredit 44 | TransactionPeerPushDebit 45 | TransactionInternalWithdrawal 46 | TransactionRecoup 47 | TransactionDenomLoss; 48 49 .. ts:def:: TransactionIdStr 50 51 // Opaque, stable identifier of a transaction, of the form 52 // ``txn:<type>:<id>`` where ``<type>`` is a `TransactionType`. 53 // (The TypeScript source additionally brands this string type; 54 // the brand only exists at compile time.) 55 type TransactionIdStr = `txn:${string}:${string}`; 56 57 .. ts:def:: TransactionType 58 59 type TransactionType = 60 | "withdrawal" 61 | "internal-withdrawal" 62 | "payment" 63 | "refund" 64 | "refresh" 65 | "deposit" 66 | "peer-push-debit" 67 | "peer-push-credit" 68 | "peer-pull-debit" 69 | "peer-pull-credit" 70 | "recoup" 71 | "denom-loss"; 72 73 .. ts:def:: TransactionCommon 74 75 interface TransactionCommon { 76 // Opaque unique ID for the transaction, used as a starting 77 // point for paginating queries and for invoking actions on the 78 // transaction (e.g. deleting it from the history). 79 transactionId: TransactionIdStr; 80 81 // The transaction produced funds under an exchange key set that 82 // the user subsequently purged from the wallet. 83 legacy?: boolean; 84 85 // Short identifier assigned by this wallet for local, 86 // human-facing use, of the form ``#<type>:<localIdent>``. 87 // Intentionally not portable: importing or merging a wallet can 88 // assign different local identifiers. Clients must use 89 // ``transactionId`` when they need a stable ID. Undefined when 90 // the wallet backend does not support local IDs. 91 localTransactionId?: string; 92 93 // Type of the transaction; discriminates the `Transaction` 94 // union. 95 type: TransactionType; 96 97 // Main timestamp of the transaction. 98 timestamp: TalerPreciseTimestamp; 99 100 // Scopes of this transaction. 101 scopes: ScopeInfo[]; 102 103 // Transaction state, as per DD37. 104 txState: TransactionState; 105 106 // Wallet-internal state ID, only used for debugging and 107 // testing. 108 stId: number; 109 110 // Possible transitions based on the current state. 111 txActions: TransactionAction[]; 112 113 // Raw amount of the transaction (exclusive of fees or other 114 // extra costs). 115 amountRaw: AmountString; 116 117 // Amount shown when the transaction was confirmed, including 118 // estimated fees. Preserved when execution fails, expires or 119 // is aborted. 120 amountEffective: AmountString; 121 122 // Settled wallet balance effect, including fees and abort 123 // recovery. Nonnegative; the transaction type determines 124 // whether this is a debit or a credit. Absent until the 125 // transaction and its recovery have settled, or when the amount 126 // cannot be established for historical records. Ordinary 127 // merchant refunds remain separate credits. Associated 128 // refreshes have zero effect. 129 amountEffectiveFinal?: AmountString; 130 131 error?: TalerErrorDetail; 132 133 abortReason?: TalerErrorDetail; 134 135 failReason?: TalerErrorDetail; 136 137 // Location where the user must go to complete KYC; present 138 // when the transaction's minor state is ``kyc``. 139 kycUrl?: string; 140 141 // KYC payto hash. Useful for testing, not so useful for UIs. 142 kycPaytoHash?: string; 143 144 // KYC access token. Useful for testing, not so useful for UIs. 145 kycAccessToken?: string; 146 147 kycAuthTransferInfo?: KycAuthTransferInfo; 148 } 149 150 .. ts:def:: TransactionState 151 152 interface TransactionState { 153 // Major state component of the transaction state. 154 major: TransactionMajorState; 155 156 // Minor state component of the transaction. 157 minor?: TransactionMinorState; 158 159 // Whether the wallet is currently actively processing the 160 // transaction or waiting for a counterparty. Will eventually 161 // be folded into a new major state. 162 working?: boolean; 163 } 164 165 .. ts:def:: TransactionMajorState 166 167 type TransactionMajorState = 168 // No state, only used when reporting transitions into the 169 // initial state. 170 | "none" 171 | "pending" 172 | "done" 173 | "aborting" 174 | "aborted" 175 | "dialog" 176 | "finalizing" 177 // A suspended pending state. 178 | "suspended" 179 | "suspended-finalizing" 180 | "suspended-aborting" 181 | "failed" 182 | "expired" 183 // Only used for notifications, never in the transaction 184 // history. 185 | "deleted"; 186 187 .. ts:def:: TransactionMinorState 188 189 type TransactionMinorState = 190 | "aborting-bank" 191 | "accept-refund" 192 | "auto-refund" 193 | "balance-kyc" 194 | "bank" 195 | "bank-confirm-transfer" 196 | "bank-register-reserve" 197 | "check-refund" 198 | "claim-proposal" 199 | "completed-by-other-wallet" 200 | "continued-with-other-wallet" 201 | "create-purse" 202 | "delete-purse" 203 | "deposit" 204 | "deposit-abort-partial" 205 | "deposit-abort-recovered" 206 | "deposit-abort-recovery-failed" 207 | "deposit-abort-refund-failed" 208 | "deposit-abort-too-late" 209 | "exchange" 210 | "exchange-wait-reserve" 211 | "kyc-auth" 212 | "kyc-hard-limit" 213 | "kyc-init" 214 | "kyc" 215 | "merge" 216 | "paid-by-other" 217 | "proposed" 218 | "ready" 219 | "rebind-session" 220 | "refresh" 221 | "refused" 222 | "repurchase" 223 | "submit-payment" 224 | "track" 225 | "unknown" 226 | "withdraw" 227 | "waiting-for-other-wallet" 228 | "abort"; 229 230 .. ts:def:: TransactionAction 231 232 // Actions the user can request on a transaction in its current 233 // state; each action corresponds to one of the transaction 234 // operations. 235 type TransactionAction = 236 | "delete" 237 | "suspend" 238 | "resume" 239 | "abort" 240 | "fail" 241 | "retry"; 242 243 .. ts:def:: KycAuthTransferInfo 244 245 interface KycAuthTransferInfo { 246 // Payto URI of the account that must make the transfer. The 247 // KYC auth transfer will *not* work if it originates from a 248 // different account. 249 debitPaytoUri: string; 250 251 // Account public key. Included in the transfer subject for 252 // some of the transfer options. 253 accountPub: string; 254 255 // Options for making the KYC auth transfer, grouped by exchange 256 // credit account in the same format used for withdrawals. 257 transferOptionsExt: WithdrawalExchangeAccountDetails[]; 258 259 // Options for making the KYC auth transfer payment to the 260 // exchange. Deprecated: use ``transferOptionsExt`` instead. 261 transferOptions: TransferOption[]; 262 263 // Validity of the transferOptions, or undefined if they do not 264 // expire. Deprecated: use the per-account expiry in 265 // ``transferOptionsExt`` instead. 266 transferExpiry: TalerProtocolTimestamp | undefined; 267 268 // Amount that the exchange expects to be deposited. Usually 269 // the smallest amount that can be transferred via a bank 270 // transfer. Deprecated: use ``transferOptions`` instead. 271 amount: AmountString; 272 273 // Possible target payto URIs. Deprecated: use 274 // ``transferOptions`` instead. 275 creditPaytoUris: string[]; 276 } 277 278 .. ts:def:: TransactionWithdrawal 279 280 // A withdrawal transaction (either bank-integrated or manual). 281 interface TransactionWithdrawal extends TransactionCommon { 282 type: "withdrawal"; 283 284 // Exchange of the withdrawal. 285 exchangeBaseUrl: string | undefined; 286 287 // Amount that got subtracted from the reserve balance. 288 amountRaw: AmountString; 289 290 // Amount that actually was (or will be) added to the wallet's 291 // balance. 292 amountEffective: AmountString; 293 294 withdrawalDetails: WithdrawalDetails; 295 } 296 297 .. ts:def:: TransactionInternalWithdrawal 298 299 // Internal withdrawal operation, only reported on request. Some 300 // transactions (peer-*-credit) internally do a withdrawal, but 301 // only the peer-*-credit transaction is reported. The internal 302 // withdrawal transaction gives access to the details of the 303 // underlying withdrawal for testing/debugging. It is usually not 304 // reported, so that the amounts of transactions properly add up. 305 interface TransactionInternalWithdrawal extends TransactionCommon { 306 type: "internal-withdrawal"; 307 308 // Exchange of the withdrawal. 309 exchangeBaseUrl: string; 310 311 // Amount that got subtracted from the reserve balance. 312 amountRaw: AmountString; 313 314 // Amount that actually was (or will be) added to the wallet's 315 // balance. 316 amountEffective: AmountString; 317 318 withdrawalDetails: WithdrawalDetails; 319 } 320 321 .. ts:def:: WithdrawalDetails 322 323 type WithdrawalDetails = 324 | WithdrawalDetailsForManualTransfer 325 | WithdrawalDetailsForTalerBankIntegrationApi; 326 327 .. ts:def:: WithdrawalDetailsForManualTransfer 328 329 interface WithdrawalDetailsForManualTransfer { 330 type: "manual-transfer"; 331 332 // Payto URIs that the exchange supports. Already contains the 333 // amount and message. Deprecated: in favor of 334 // ``exchangeCreditAccountDetails``. 335 exchangePaytoUris: string[]; 336 337 exchangeCreditAccountDetails?: WithdrawalExchangeAccountDetails[]; 338 339 // Public key of the reserve. 340 reservePub: string; 341 342 // Is the reserve ready for withdrawal? 343 reserveIsReady: boolean; 344 345 // How long the exchange waits to transfer back funds from a 346 // reserve. 347 reserveClosingDelay: TalerProtocolDuration; 348 } 349 350 .. ts:def:: WithdrawalDetailsForTalerBankIntegrationApi 351 352 interface WithdrawalDetailsForTalerBankIntegrationApi { 353 type: "taler-bank-integration-api"; 354 355 // True if the bank has confirmed the withdrawal. An 356 // unconfirmed withdrawal usually requires user input and should 357 // be highlighted in the UI; see ``bankConfirmationUrl``. 358 confirmed: boolean; 359 360 // If the withdrawal is unconfirmed, this can include a URL for 361 // user-initiated confirmation. 362 bankConfirmationUrl?: string; 363 364 // Public key of the reserve. 365 reservePub: string; 366 367 // Is the reserve ready for withdrawal? 368 reserveIsReady: boolean; 369 370 // Is the bank transfer for the withdrawal externally 371 // confirmed? 372 externalConfirmation?: boolean; 373 374 exchangeCreditAccountDetails?: WithdrawalExchangeAccountDetails[]; 375 } 376 377 .. ts:def:: TransactionPayment 378 379 interface TransactionPayment extends TransactionCommon { 380 type: "payment"; 381 382 // Merchant instance base URL used to claim the order. 383 // Available even before the contract terms have been 384 // downloaded. 385 merchantBaseUrl: string; 386 387 // Public payment URI shown while this wallet waits for another 388 // wallet to claim an order that it released. 389 unclaimedPayUri?: TalerUriString; 390 391 // Additional information about the payment. Only present if 392 // the information about the order is already available. 393 info: OrderShortInfo | undefined; 394 395 // Full contract terms. Only included if explicitly requested 396 // via the ``includeContractTerms`` flag of 397 // ``getTransactionById``. 398 contractTerms?: MerchantContractTerms; 399 400 // Amount that must be paid for the contract. 401 amountRaw: AmountString; 402 403 // Amount that was paid, including deposit, wire and refresh 404 // fees. 405 amountEffective: AmountString; 406 407 // Amount that has been refunded by the merchant. 408 totalRefundRaw: AmountString; 409 410 // Amount that will be added to the wallet's balance after fees 411 // and refreshing. 412 totalRefundEffective: AmountString; 413 414 // Amount pending to be picked up. 415 refundPending: AmountString | undefined; 416 417 // Reference to applied refunds. 418 refunds: RefundInfoShort[]; 419 420 // Is the wallet currently checking for a refund? 421 refundQueryActive: boolean; 422 423 // PoS confirmation codes, separated by newlines. Only present 424 // for purchases that support PoS confirmation. 425 posConfirmation: string | undefined; 426 427 // Until when the ``posConfirmation`` is valid. 428 posConfirmationDeadline?: TalerProtocolTimestamp; 429 430 // Did we receive the payment via a taler://pay-template/ URI 431 // and did the URI contain a nfc=1 flag? 432 posConfirmationViaNfc?: boolean; 433 434 // In case this payment transaction was detected as a 435 // repurchase, the transaction ID of the original payment. 436 repurchaseTransactionId?: TransactionIdStr; 437 438 // If applicable, the choice that the user selected. 439 choiceIndex?: number; 440 } 441 442 .. ts:def:: OrderShortInfo 443 444 interface OrderShortInfo { 445 // Order ID, uniquely identifies the order within a merchant 446 // instance. 447 orderId: string; 448 449 // Hash of the contract terms. 450 contractTermsHash: string; 451 452 // More information about the merchant. 453 merchant: MerchantInfo; 454 455 // Summary of the order, given by the merchant. 456 summary: string; 457 458 // Map from IETF BCP 47 language tags to localized summaries. 459 summary_i18n?: InternationalizedString; 460 461 // URL of the fulfillment, given by the merchant. 462 fulfillmentUrl?: string; 463 464 // Plain text message that should be shown to the user when the 465 // payment is complete. 466 fulfillmentMessage?: string; 467 468 // Translations of ``fulfillmentMessage``. 469 fulfillmentMessage_i18n?: InternationalizedString; 470 } 471 472 .. ts:def:: RefundInfoShort 473 474 interface RefundInfoShort { 475 transactionId: string; 476 477 timestamp: TalerProtocolTimestamp; 478 479 amountEffective: AmountString; 480 481 amountRaw: AmountString; 482 } 483 484 .. ts:def:: TransactionRefund 485 486 interface TransactionRefund extends TransactionCommon { 487 // Recovery already included in the unsuccessful payment's 488 // final cost. 489 isAbortRecovery?: boolean; 490 491 type: "refund"; 492 493 // Amount that has been refunded by the merchant. 494 amountRaw: AmountString; 495 496 // Amount that will be added to the wallet's balance after fees 497 // and refreshing. 498 amountEffective: AmountString; 499 500 // ID of the transaction that is refunded. 501 refundedTransactionId: string; 502 503 paymentInfo: RefundPaymentInfo | undefined; 504 } 505 506 .. ts:def:: RefundPaymentInfo 507 508 // Summary information about the payment that we got a refund 509 // for. 510 interface RefundPaymentInfo { 511 summary: string; 512 513 summary_i18n?: InternationalizedString; 514 515 // More information about the merchant. 516 merchant: MerchantInfo; 517 } 518 519 .. ts:def:: TransactionRefresh 520 521 // A transaction shown for refreshes. Only shown for (1) 522 // refreshes not associated with other transactions and (2) 523 // refreshes in an error state. 524 interface TransactionRefresh extends TransactionCommon { 525 type: "refresh"; 526 527 refreshReason: RefreshReason; 528 529 // Transaction ID that caused this refresh. 530 originatingTransactionId?: string; 531 532 // Always zero for refreshes. 533 amountRaw: AmountString; 534 535 // Fees, i.e. the effective, negative effect of the refresh on 536 // the balance. Only applicable for stand-alone refreshes, and 537 // zero for other refreshes where the transaction itself 538 // accounts for the refresh fee. 539 amountEffective: AmountString; 540 541 refreshInputAmount: AmountString; 542 543 refreshOutputAmount: AmountString; 544 } 545 546 .. ts:def:: RefreshReason 547 548 // Reason why a coin is being refreshed. 549 type RefreshReason = 550 | "manual" 551 | "pay-merchant" 552 | "pay-deposit" 553 | "pay-peer-push" 554 | "pay-peer-pull" 555 | "refund" 556 | "abort-pay" 557 | "abort-deposit" 558 | "abort-peer-push-debit" 559 | "abort-peer-pull-debit" 560 | "recoup" 561 | "backup-restored" 562 | "scheduled"; 563 564 .. ts:def:: TransactionDeposit 565 566 // Deposit transaction, which effectively sends money from this 567 // wallet somewhere else. 568 interface TransactionDeposit extends TransactionCommon { 569 type: "deposit"; 570 571 depositGroupId: string; 572 573 // Target for the deposit. 574 targetPaytoUri: string; 575 576 // Raw amount that is being deposited. 577 amountRaw: AmountString; 578 579 // Deposit account public key. 580 accountPub: string; 581 582 // Effective amount that is being deposited. 583 amountEffective: AmountString; 584 585 wireTransferDeadline: TalerProtocolTimestamp; 586 587 wireTransferProgress: number; 588 589 // Did all the deposit requests succeed? 590 deposited: boolean; 591 592 trackingState: Array<DepositTransactionTrackingState>; 593 } 594 595 .. ts:def:: DepositTransactionTrackingState 596 597 interface DepositTransactionTrackingState { 598 // Raw wire transfer identifier of the deposit. 599 wireTransferId: string; 600 601 // When the wire transfer was given to the bank. 602 timestampExecuted: TalerProtocolTimestamp; 603 604 // Total amount transferred for this wtid (including fees). 605 amountRaw: AmountString; 606 607 // Wire fee amount for this exchange. 608 wireFee: AmountString; 609 } 610 611 .. ts:def:: TransactionPeerPullCredit 612 613 // Credit because we were paid for a P2P invoice we created. 614 interface TransactionPeerPullCredit extends TransactionCommon { 615 type: "peer-pull-credit"; 616 617 info: PeerInfoShort; 618 619 // Exchange used. 620 exchangeBaseUrl: string; 621 622 // Amount that got subtracted from the reserve balance. 623 amountRaw: AmountString; 624 625 // Amount that actually was (or will be) added to the wallet's 626 // balance. 627 amountEffective: AmountString; 628 629 // URI to send to the other party. Only available in the right 630 // state. 631 talerUri: string | undefined; 632 } 633 634 .. ts:def:: TransactionPeerPullDebit 635 636 // Debit because we paid someone's invoice. 637 interface TransactionPeerPullDebit extends TransactionCommon { 638 type: "peer-pull-debit"; 639 640 info: PeerInfoShort; 641 642 // Exchange used. 643 exchangeBaseUrl: string; 644 645 amountRaw: AmountString; 646 647 amountEffective: AmountString; 648 } 649 650 .. ts:def:: TransactionPeerPushDebit 651 652 // We sent money via a P2P payment. 653 interface TransactionPeerPushDebit extends TransactionCommon { 654 type: "peer-push-debit"; 655 656 info: PeerInfoShort; 657 658 // Exchange used. 659 exchangeBaseUrl: string; 660 661 // Amount that got subtracted from the reserve balance. 662 amountRaw: AmountString; 663 664 // Amount that actually was (or will be) added to the wallet's 665 // balance. 666 amountEffective: AmountString; 667 668 // URI to accept the payment. Only present if the transaction 669 // is in a state where the other party can accept the payment. 670 talerUri?: string; 671 } 672 673 .. ts:def:: TransactionPeerPushCredit 674 675 // We received money via a P2P payment. 676 interface TransactionPeerPushCredit extends TransactionCommon { 677 type: "peer-push-credit"; 678 679 info: PeerInfoShort; 680 681 // Exchange used. 682 exchangeBaseUrl: string; 683 684 // Amount that got subtracted from the reserve balance. 685 amountRaw: AmountString; 686 687 // Amount that actually was (or will be) added to the wallet's 688 // balance. 689 amountEffective: AmountString; 690 } 691 692 .. ts:def:: PeerInfoShort 693 694 interface PeerInfoShort { 695 expiration: TalerProtocolTimestamp | undefined; 696 697 summary: string | undefined; 698 699 iconId: string | undefined; 700 } 701 702 .. ts:def:: TransactionRecoup 703 704 // The exchange revoked a key and the wallet recoups funds. 705 interface TransactionRecoup extends TransactionCommon { 706 type: "recoup"; 707 } 708 709 .. ts:def:: TransactionDenomLoss 710 711 // A transaction to indicate financial loss due to denominations 712 // that became unusable for deposits. 713 interface TransactionDenomLoss extends TransactionCommon { 714 type: "denom-loss"; 715 716 lossEventType: DenomLossEventType; 717 718 exchangeBaseUrl: string; 719 } 720 721 .. ts:def:: DenomLossEventType 722 723 type DenomLossEventType = 724 | "denom-expired" 725 | "denom-vanished" 726 | "denom-unoffered" 727 // The exchange revoked the denomination. A revoked 728 // denomination also stops being offered, so this must be 729 // checked before "denom-unoffered" to say what actually 730 // happened. 731 | "denom-revoked"; 732 733 .. ts:def:: TransactionByIdRequest 734 735 interface TransactionByIdRequest { 736 transactionId: string; 737 738 // If set to true, report the full contract terms in the 739 // response if the transaction has them. 740 includeContractTerms?: boolean; 741 }