tabledog / tdog-cli

Download your Stripe account to a SQLite database.
MIT License
18 stars 2 forks source link

Change PaymentMethodDetailsIdeal's bank from enum to string #3

Open Dador opened 1 year ago

Dador commented 1 year ago

Change PaymentMethodDetailsIdeal's bank from enum to string. And the same for all usage of bic.

Stripe doesn't specify exact list of banks and new bank could be added at any moment, so this could lead to new errors in the future.

Specifically I got this error when trying to run for first time:

thread 'main' panicked at 'called Result::unwrap() on an Err value: Net(reqwest::Error { kind: Decode, source: Error("unknown variant revolut, expected one of abn_amro, asn_bank, bunq, handelsbanken, ing, knab, moneyou, rabobank, regiobank, sns_bank, triodos_bank, van_lanschot", line: 57, column: 27) })', tdog-cli/tdog-cli/crates/tdog_core/src/providers/stripe/dl.rs:744:22

And also this error for bic:

thread 'main' panicked at 'called Result::unwrap() on an Err value: Net(reqwest::Error { kind: Decode, source: Error("unknown variant REVOLT21XXX, expected one of ABNANL2A, ASNBNL21, BUNQNL2A, FVLBNL22, HANDNL2A, INGBNL2A, KNABNL2H, MOYONL21, RABONL2U, RBRBNL21, SNSBNL2A, TRIONL2U", line: 58, column: 30) })', tdog-cli/crates/tdog_core/src/providers/stripe/dl.rs:744:22

There are also other errors related to payment method that was hard to debug, so I ended up using cloudquery. For example:

thread 'main' panicked at 'called Result::unwrap() on an Err value: Net(reqwest::Error { kind: Decode, source: Error("data did not match any variant of untagged enum UniPaymentMethod", line: 3383, column: 7) })', tdog-cli/crates/tdog_core/src/providers/stripe/dl.rs:752:14

oozzal commented 1 year ago

Same issue. Here's backtrace with RUST_BACKTRACE=full:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Net(reqwest::Error { kind: Decode, source: Error("unknown variant `link`, expected one of `amex_
express_checkout`, `apple_pay`, `google_pay`, `masterpass`, `samsung_pay`, `visa_checkout`", line: 5682, column: 26) })', /Users/runner/work/tdog-cli/tdog-cli/crates/td
og_core/src/providers/stripe/dl.rs:744:22
stack backtrace:
   0:        0x1037481f4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc80096156cd24709
   1:        0x103764aab - core::fmt::write::hb6b947db0e571766
   2:        0x103742e28 - std::io::Write::write_fmt::h59c4febf5f8fcb1e
   3:        0x103749edd - std::panicking::default_hook::{{closure}}::h0e76f92bbb367061
   4:        0x103749bc1 - std::panicking::default_hook::hbbbb8c05ad6cce9a
   5:        0x10374a45e - std::panicking::rust_panic_with_hook::ha581a2c99399f83b
   6:        0x10374a353 - std::panicking::begin_panic_handler::{{closure}}::h97df6e4273b6a879
   7:        0x103748677 - std::sys_common::backtrace::__rust_end_short_backtrace::ha4a3b48ae6bfb343
   8:        0x10374a02a - _rust_begin_unwind
   9:        0x10378aa43 - core::panicking::panic_fmt::h4a5343602e6cbb54
  10:        0x10378ab35 - core::result::unwrap_failed::h7e319279c31d43f4
  11:        0x102abf8d1 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h00948dabfcaca2f1
  12:        0x1027fbc16 - <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::h9efbda3a82103c22
  13:        0x102ae09c8 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h6e4668d039a9733b
  14:        0x102b057e8 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::he790799f12b7400b
  15:        0x10280146f - std::thread::local::LocalKey<T>::with::h697318ff290238d2
  16:        0x102a62ce4 - tokio::runtime::enter::Enter::block_on::hacc5b68b6986851d
  17:        0x1027aca67 - tokio::runtime::thread_pool::ThreadPool::block_on::h712af46027228213
  18:        0x1027f8585 - tokio::runtime::context::enter::he0889fde2b8acea6
  19:        0x102b2a6df - tokio::runtime::handle::Handle::enter::h17b444367f8cb989
  20:        0x10282d743 - tdog_cli::main::h2bb42f4f39d46d63
  21:        0x1027c7a66 - std::sys_common::backtrace::__rust_begin_short_backtrace::h6bb2b89ec5471151
  22:        0x1028001d1 - std::rt::lang_start::{{closure}}::h9e08a0b58be14e20
  23:        0x10373d66a - std::rt::lang_start_internal::hdb19fe6764e59ca8
  24:        0x10282d809 - _main