fix: api lock on PaymentsCreate (#2916)

This commit is contained in:
Kartikeya Hegde
2023-11-20 20:52:56 +05:30
committed by GitHub
parent 922dc90019
commit cfabfa60db
7 changed files with 87 additions and 62 deletions

View File

@ -1679,6 +1679,20 @@ impl std::fmt::Display for PaymentIdType {
}
}
impl PaymentIdType {
pub fn and_then<F, E>(self, f: F) -> Result<Self, E>
where
F: FnOnce(String) -> Result<String, E>,
{
match self {
Self::PaymentIntentId(s) => f(s).map(Self::PaymentIntentId),
Self::ConnectorTransactionId(s) => f(s).map(Self::ConnectorTransactionId),
Self::PaymentAttemptId(s) => f(s).map(Self::PaymentAttemptId),
Self::PreprocessingId(s) => f(s).map(Self::PreprocessingId),
}
}
}
impl Default for PaymentIdType {
fn default() -> Self {
Self::PaymentIntentId(Default::default())