refactor(payment_methods): add support for passing card_cvc in payment_method_data object along with token (#3024)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Chethan Rao
2023-12-04 12:40:43 +05:30
committed by GitHub
parent 83fcd1a9de
commit 3ce04abae4
4 changed files with 45 additions and 26 deletions

View File

@ -204,8 +204,9 @@ pub struct PaymentsRequest {
#[schema(example = "187282ab-40ef-47a9-9206-5099ba31e432")]
pub payment_token: Option<String>,
/// This is used when payment is to be confirmed and the card is not saved
#[schema(value_type = Option<String>)]
/// This is used when payment is to be confirmed and the card is not saved.
/// This field will be deprecated soon, use the CardToken object instead
#[schema(value_type = Option<String>, deprecated)]
pub card_cvc: Option<Secret<String>>,
/// The shipping address for the payment
@ -720,12 +721,16 @@ pub struct Card {
pub nick_name: Option<Secret<String>>,
}
#[derive(Eq, PartialEq, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
#[derive(Eq, PartialEq, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema, Default)]
#[serde(rename_all = "snake_case")]
pub struct CardToken {
/// The card holder's name
#[schema(value_type = String, example = "John Test")]
pub card_holder_name: Option<Secret<String>>,
/// The CVC number for the card
#[schema(value_type = Option<String>)]
pub card_cvc: Option<Secret<String>>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]