chore: merging back release v0.3.0 back to main (#636) (#655)

Co-authored-by: Sangamesh Kulkarni <59434228+Sangamesh26@users.noreply.github.com>
Co-authored-by: ItsMeShashank <shashank.attarde@juspay.in>
Co-authored-by: Abhishek <abhishek.marrivagu@juspay.in>
Co-authored-by: Jagan <jaganelavarasan@gmail.com>
Co-authored-by: SamraatBansal <55536657+SamraatBansal@users.noreply.github.com>
Co-authored-by: Sampras Lopes <lsampras@protonmail.com>
This commit is contained in:
Arun Raj M
2023-02-26 13:55:17 +05:30
committed by GitHub
parent 7792de55ef
commit f3224cc4df
74 changed files with 5979 additions and 355 deletions

View File

@ -296,7 +296,7 @@ pub struct ListPaymentMethodResponse {
}
]
))]
pub payment_methods: HashSet<ListPaymentMethod>,
pub payment_methods: Vec<ListPaymentMethod>,
}
#[derive(Eq, PartialEq, Hash, Debug, serde::Deserialize, ToSchema)]
@ -362,9 +362,12 @@ pub struct ListPaymentMethod {
/// Type of payment experience enabled with the connector
#[schema(value_type = Option<Vec<PaymentExperience>>, example = json!(["redirect_to_url"]))]
pub payment_experience: Option<Vec<api_enums::PaymentExperience>>,
/// Eligible connectors for this payment method
#[schema(example = json!(["stripe", "adyen"]))]
pub eligible_connectors: Option<Vec<String>>,
}
/// We need a custom serializer to only send relevant fields in ListPaymentMethodResponse
/// Currently if the payment method is Wallet or Paylater the relevant fields are `payment_method`
/// and `payment_method_issuers`. Otherwise only consider
/// `payment_method`,`payment_method_issuers`,`payment_method_types`,`payment_schemes` fields.
@ -377,6 +380,7 @@ impl serde::Serialize for ListPaymentMethod {
let mut state = serializer.serialize_struct("ListPaymentMethod", 4)?;
state.serialize_field("payment_method", &self.payment_method)?;
state.serialize_field("payment_experience", &self.payment_experience)?;
state.serialize_field("eligible_connectors", &self.eligible_connectors)?;
match self.payment_method {
api_enums::PaymentMethodType::Wallet | api_enums::PaymentMethodType::PayLater => {
state.serialize_field("payment_method_issuers", &self.payment_method_issuers)?;