BalanceTransactionSourceId should include ReserveTransaction
Opened this issue · 3 comments
pdoms commented
Describe the bug
When listing BalanceTransactions
deserialization fails at path to data.source
if the source is a ReserveTransaction
(with prefix rtx_
).
To Reproduce
- Have a
ReserveTransaction
(Reserved Funds
) in your stripe environment - Call
BalanceTransaction::list
- no specific params or specifyparams.type_ = Some(BalanceTransactionType::ReserveTransaction.as_str());
Expected behavior
If the BalanceTransaction
is of type ReserveTransaction
Deserialization should work.
Code snippets
No response
OS
Ubuntu 22.04
Rust version
1.77.1 2024-03-27
Library version
async-stripe 0.37.1
API version
2022-08-01
Additional context
I assume it is a bug origination in the openAPI
specs for stripe and thus incorrect code generation.
However, a manual/temporary fix could be the following.
src/ids.rs
def_id!(ReserveTransactionId, "rtx_"); //changed from "rtx" to "rtx_"
[...]
def_id!(
#[optional]
enum BalanceTransactionSourceId {
[...]
TransferReversal(TransferReversalId),
ReserveTransaction(ReserveTransactionId),
}
);
src/resources/balance_transactions_ext.rs
impl Object for BalanceTransactionSourceUnion {
type Id = BalanceTransactionSourceId;
fn id(&self) -> Self::Id {
use BalanceTransactionSourceId as Id;
use BalanceTransactionSourceUnion as Source;
match self {
[...]
Source::ReserveTransaction(x) => Id::ReserveTransaction(x.id()), //from Id::None
[...]
}
}
arlyon commented
I have opened a PR to change the ID to rtx_
, that was an oversight thanks for reporting!
arlyon commented
Please let me know if that PR solves your issue