Skip to content

Commit

Permalink
Inline fun
Browse files Browse the repository at this point in the history
  • Loading branch information
macpie committed Sep 4, 2024
1 parent 7291e92 commit 39170be
Showing 1 changed file with 13 additions and 25 deletions.
38 changes: 13 additions & 25 deletions mobile_verifier/src/promotion_reward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,38 +198,26 @@ async fn validate_promotion_reward(
}

impl ValidatedPromotionReward {
async fn validate(
promotion_reward: PromotionReward,
authorization_verifier: &impl AuthorizationVerifier,
gateway_info_resolver: &impl GatewayResolver,
entity_verifier: &impl EntityVerifier,
) -> anyhow::Result<Self> {
let validity = validate_promotion_reward(
&promotion_reward,
authorization_verifier,
gateway_info_resolver,
entity_verifier,
)
.await?;
Ok(Self {
validity,
promotion_reward,
})
}

fn validate_promotion_rewards<'a>(
promotion_rewards: impl Stream<Item = PromotionReward> + 'a,
authorization_verifier: &'a impl AuthorizationVerifier,
gateway_info_resolver: &'a impl GatewayResolver,
entity_verifier: &'a impl EntityVerifier,
) -> impl Stream<Item = anyhow::Result<Self>> + 'a {
promotion_rewards.then(move |promotion_reward| async move {
Self::validate(
promotion_reward,
authorization_verifier,
gateway_info_resolver,
entity_verifier,
)
async move {
let validity = validate_promotion_reward(
&promotion_reward,
authorization_verifier,
gateway_info_resolver,
entity_verifier,
)
.await?;
Ok(Self {
validity,
promotion_reward: promotion_reward,
})
}
.await
})
}
Expand Down

0 comments on commit 39170be

Please sign in to comment.