From 15b3663336561ccf55d78dc66668d28627b4d59b Mon Sep 17 00:00:00 2001 From: Sean Pianka Date: Fri, 26 Apr 2024 15:14:41 -0400 Subject: [PATCH] feat(setup_intent): verify microdeposits flow Signed-off-by: Sean Pianka --- src/resources/setup_intent_ext.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/resources/setup_intent_ext.rs b/src/resources/setup_intent_ext.rs index 61e8fe8b8..0a4be0d76 100644 --- a/src/resources/setup_intent_ext.rs +++ b/src/resources/setup_intent_ext.rs @@ -1,6 +1,7 @@ use serde::Serialize; use crate::client::{Client, Response}; +use crate::params::Expand; use crate::resources::SetupIntent; use crate::{PaymentMethodId, SetupIntentCancellationReason, SetupIntentId}; @@ -47,6 +48,24 @@ pub struct CancelSetupIntent { pub cancellation_reason: Option, } +/// Verifies microdeposits on a SetupIntent object. +/// +/// For more details see +#[derive(Clone, Debug, Default, Serialize)] +pub struct VerifyMicrodeposits<'a> { + /// Two positive integers, in cents, equal to the values of the microdeposits sent to the bank account. + #[serde(skip_serializing_if = "Option::is_none")] + pub amounts: Option>, + + /// A six-character code starting with SM present in the microdeposit sent to the bank account. + #[serde(skip_serializing_if = "Option::is_none")] + pub descriptor_code: Option<&'a str>, + + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Expand::is_empty")] + pub expand: &'a [&'a str], +} + impl SetupIntent { pub fn confirm( client: &Client, @@ -56,6 +75,14 @@ impl SetupIntent { client.post_form(&format!("/setup_intents/{}/confirm", setup_id), ¶ms) } + pub fn verify_micro_deposits( + client: &Client, + setup_id: &SetupIntentId, + params: VerifyMicrodeposits, + ) -> Response { + client.post_form(&format!("/setup_intents/{}/verify_microdeposits", setup_id), ¶ms) + } + /// A SetupIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_confirmation, or requires_action. /// /// For more details see .