Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sweta-Kumari-Sharma committed Jan 15, 2025
1 parent d516fc7 commit 70909c0
Show file tree
Hide file tree
Showing 16 changed files with 13 additions and 25 deletions.
3 changes: 0 additions & 3 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,6 @@ pub enum PayLaterData {
/// The token for the sdk workflow
token: String,
},
KlarnaCheckout {},
/// For Affirm redirect as PayLater Option
AffirmRedirect {},
/// For AfterpayClearpay redirect as PayLater Option
Expand Down Expand Up @@ -1934,7 +1933,6 @@ impl GetAddressFromPaymentMethodData for PayLaterData {
| Self::WalleyRedirect {}
| Self::AlmaRedirect {}
| Self::KlarnaSdk { .. }
| Self::KlarnaCheckout {}
| Self::AffirmRedirect {}
| Self::AtomeRedirect {} => None,
}
Expand Down Expand Up @@ -2396,7 +2394,6 @@ impl GetPaymentMethodType for PayLaterData {
match self {
Self::KlarnaRedirect { .. } => api_enums::PaymentMethodType::Klarna,
Self::KlarnaSdk { .. } => api_enums::PaymentMethodType::Klarna,
Self::KlarnaCheckout {} => api_enums::PaymentMethodType::Klarna,
Self::AffirmRedirect {} => api_enums::PaymentMethodType::Affirm,
Self::AfterpayClearpayRedirect { .. } => api_enums::PaymentMethodType::AfterpayClearpay,
Self::PayBrightRedirect {} => api_enums::PaymentMethodType::PayBright,
Expand Down
3 changes: 2 additions & 1 deletion crates/connector_configs/src/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ impl DashboardRequestPayload {
Some(api_models::enums::PaymentExperience::RedirectToUrl)
}
(Connector::Paypal, Paypal) => payment_experience,
(Connector::Klarna, Klarna) => payment_experience,
(Connector::Zen, GooglePay) | (Connector::Zen, ApplePay) => {
Some(api_models::enums::PaymentExperience::RedirectToUrl)
}
(Connector::Braintree, Paypal) | (Connector::Klarna, Klarna) => {
(Connector::Braintree, Paypal) => {
Some(api_models::enums::PaymentExperience::InvokeSdkClient)
}
(Connector::Globepay, AliPay)
Expand Down
4 changes: 4 additions & 0 deletions crates/connector_configs/toml/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,10 @@ key1="Client Secret"
[klarna]
[[klarna.pay_later]]
payment_method_type = "klarna"
payment_experience = "invoke_sdk_client"
[[klarna.pay_later]]
payment_method_type = "klarna"
payment_experience = "redirect_to_url"
[klarna.connector_auth.BodyKey]
key1="Klarna Merchant Username"
api_key="Klarna Merchant ID Password"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,6 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
email: Some(match paylater {
PayLaterData::KlarnaRedirect {} => item.router_data.get_billing_email()?,
PayLaterData::KlarnaSdk { token: _ }
| PayLaterData::KlarnaCheckout {}
| PayLaterData::AffirmRedirect {}
| PayLaterData::AfterpayClearpayRedirect {}
| PayLaterData::PayBrightRedirect {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ impl TryFrom<(&types::TokenizationRouterData, PayLaterData)> for SquareTokenRequ
PayLaterData::AfterpayClearpayRedirect { .. }
| PayLaterData::KlarnaRedirect { .. }
| PayLaterData::KlarnaSdk { .. }
| PayLaterData::KlarnaCheckout {}
| PayLaterData::AffirmRedirect { .. }
| PayLaterData::PayBrightRedirect { .. }
| PayLaterData::WalleyRedirect { .. }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,6 @@ impl TryFrom<&PayLaterData> for ZenPaymentsRequest {
match value {
PayLaterData::KlarnaRedirect { .. }
| PayLaterData::KlarnaSdk { .. }
| PayLaterData::KlarnaCheckout {}
| PayLaterData::AffirmRedirect {}
| PayLaterData::AfterpayClearpayRedirect { .. }
| PayLaterData::PayBrightRedirect {}
Expand Down
2 changes: 0 additions & 2 deletions crates/hyperswitch_connectors/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2098,7 +2098,6 @@ pub enum PaymentMethodDataType {
SwishQr,
KlarnaRedirect,
KlarnaSdk,
KlarnaCheckout,
AffirmRedirect,
AfterpayClearpayRedirect,
PayBrightRedirect,
Expand Down Expand Up @@ -2223,7 +2222,6 @@ impl From<PaymentMethodData> for PaymentMethodDataType {
PaymentMethodData::PayLater(pay_later_data) => match pay_later_data {
payment_method_data::PayLaterData::KlarnaRedirect { .. } => Self::KlarnaRedirect,
payment_method_data::PayLaterData::KlarnaSdk { .. } => Self::KlarnaSdk,
payment_method_data::PayLaterData::KlarnaCheckout {} => Self::KlarnaCheckout,
payment_method_data::PayLaterData::AffirmRedirect {} => Self::AffirmRedirect,
payment_method_data::PayLaterData::AfterpayClearpayRedirect { .. } => {
Self::AfterpayClearpayRedirect
Expand Down
3 changes: 0 additions & 3 deletions crates/hyperswitch_domain_models/src/payment_method_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ pub enum CardRedirectData {
pub enum PayLaterData {
KlarnaRedirect {},
KlarnaSdk { token: String },
KlarnaCheckout {},
AffirmRedirect {},
AfterpayClearpayRedirect {},
PayBrightRedirect {},
Expand Down Expand Up @@ -898,7 +897,6 @@ impl From<api_models::payments::PayLaterData> for PayLaterData {
match value {
api_models::payments::PayLaterData::KlarnaRedirect { .. } => Self::KlarnaRedirect {},
api_models::payments::PayLaterData::KlarnaSdk { token } => Self::KlarnaSdk { token },
api_models::payments::PayLaterData::KlarnaCheckout {} => Self::KlarnaCheckout {},
api_models::payments::PayLaterData::AffirmRedirect {} => Self::AffirmRedirect {},
api_models::payments::PayLaterData::AfterpayClearpayRedirect { .. } => {
Self::AfterpayClearpayRedirect {}
Expand Down Expand Up @@ -1552,7 +1550,6 @@ impl GetPaymentMethodType for PayLaterData {
match self {
Self::KlarnaRedirect { .. } => api_enums::PaymentMethodType::Klarna,
Self::KlarnaSdk { .. } => api_enums::PaymentMethodType::Klarna,
Self::KlarnaCheckout {} => api_enums::PaymentMethodType::Klarna,
Self::AffirmRedirect {} => api_enums::PaymentMethodType::Affirm,
Self::AfterpayClearpayRedirect { .. } => api_enums::PaymentMethodType::AfterpayClearpay,
Self::PayBrightRedirect {} => api_enums::PaymentMethodType::PayBright,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10145,9 +10145,9 @@ impl Default for settings::RequiredFields {
RequiredFieldFinal {
mandate : HashMap::new(),
non_mandate: HashMap::from([
( "payment_method_data.pay_later.klarna.billing_country".to_string(),
( "billing.address.country".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.pay_later.klarna.billing_country".to_string(),
required_field: "payment_method_data.billing.address.country".to_string(),
display_name: "billing_country".to_string(),
field_type: enums::FieldType::UserAddressCountry{
options: vec![
Expand Down Expand Up @@ -10195,9 +10195,9 @@ impl Default for settings::RequiredFields {
mandate : HashMap::new(),
non_mandate: HashMap::new(),
common : HashMap::from([
( "payment_method_data.pay_later.klarna.billing_country".to_string(),
( "billing.address.country".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.pay_later.klarna.billing_country".to_string(),
required_field: "payment_method_data.billing.address.country".to_string(),
display_name: "billing_country".to_string(),
field_type: enums::FieldType::UserAddressCountry{
options: vec![
Expand Down
3 changes: 1 addition & 2 deletions crates/router/src/connector/adyen/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2350,8 +2350,7 @@ impl
check_required_field(billing_address, "billing")?;
Ok(AdyenPaymentMethod::Atome)
}
domain::payments::PayLaterData::KlarnaCheckout {}
| domain::payments::PayLaterData::KlarnaSdk { .. } => {
domain::payments::PayLaterData::KlarnaSdk { .. } => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
)
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/klarna.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ impl
})),
}
}
domain::PaymentMethodData::PayLater(domain::PayLaterData::KlarnaCheckout {}) => {
domain::PaymentMethodData::PayLater(domain::PayLaterData::KlarnaRedirect {}) => {
match (payment_experience, payment_method_type) {
(
common_enums::PaymentExperience::RedirectToUrl,
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/klarna/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl TryFrom<&KlarnaRouterData<&types::PaymentsAuthorizeRouterData>> for KlarnaP
})),
}
}
domain::PaymentMethodData::PayLater(domain::PayLaterData::KlarnaCheckout {}) => {
domain::PaymentMethodData::PayLater(domain::PayLaterData::KlarnaRedirect {}) => {
match request.order_details.clone() {
Some(order_details) => Ok(Self {
purchase_country: item.router_data.get_billing_country()?,
Expand Down
1 change: 0 additions & 1 deletion crates/router/src/connector/nuvei/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,6 @@ where
get_pay_later_info(AlternativePaymentMethodType::AfterPay, item)
}
domain::PayLaterData::KlarnaSdk { .. }
| domain::PayLaterData::KlarnaCheckout {}
| domain::PayLaterData::AffirmRedirect {}
| domain::PayLaterData::PayBrightRedirect {}
| domain::PayLaterData::WalleyRedirect {}
Expand Down
1 change: 0 additions & 1 deletion crates/router/src/connector/paypal/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,6 @@ impl TryFrom<&domain::PayLaterData> for PaypalPaymentsRequest {
match value {
domain::PayLaterData::KlarnaRedirect { .. }
| domain::PayLaterData::KlarnaSdk { .. }
| domain::PayLaterData::KlarnaCheckout {}
| domain::PayLaterData::AffirmRedirect {}
| domain::PayLaterData::AfterpayClearpayRedirect { .. }
| domain::PayLaterData::PayBrightRedirect {}
Expand Down
1 change: 0 additions & 1 deletion crates/router/src/connector/stripe/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,6 @@ impl TryFrom<&domain::payments::PayLaterData> for StripePaymentMethodType {
}

domain::PayLaterData::KlarnaSdk { .. }
| domain::PayLaterData::KlarnaCheckout {}
| domain::PayLaterData::PayBrightRedirect {}
| domain::PayLaterData::WalleyRedirect {}
| domain::PayLaterData::AlmaRedirect {}
Expand Down
2 changes: 0 additions & 2 deletions crates/router/src/connector/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2781,7 +2781,6 @@ pub enum PaymentMethodDataType {
SwishQr,
KlarnaRedirect,
KlarnaSdk,
KlarnaCheckout,
AffirmRedirect,
AfterpayClearpayRedirect,
PayBrightRedirect,
Expand Down Expand Up @@ -2905,7 +2904,6 @@ impl From<domain::payments::PaymentMethodData> for PaymentMethodDataType {
domain::payments::PaymentMethodData::PayLater(pay_later_data) => match pay_later_data {
domain::payments::PayLaterData::KlarnaRedirect { .. } => Self::KlarnaRedirect,
domain::payments::PayLaterData::KlarnaSdk { .. } => Self::KlarnaSdk,
domain::payments::PayLaterData::KlarnaCheckout {} => Self::KlarnaCheckout,
domain::payments::PayLaterData::AffirmRedirect {} => Self::AffirmRedirect,
domain::payments::PayLaterData::AfterpayClearpayRedirect { .. } => {
Self::AfterpayClearpayRedirect
Expand Down

0 comments on commit 70909c0

Please sign in to comment.