diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs index e2718d1ac91c..8ba610d66d45 100644 --- a/crates/router/src/connector/authorizedotnet/transformers.rs +++ b/crates/router/src/connector/authorizedotnet/transformers.rs @@ -164,10 +164,23 @@ fn get_pm_and_subsequent_auth_detail( }); Ok((payment_details, processing_options, subseuent_auth_info)) } - _ => Err(errors::ConnectorError::NotSupported { - message: format!("{:?}", item.router_data.request.payment_method_data), - connector: "AuthorizeDotNet", - })?, + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("authorizedotnet"), + ))? + } } } _ => match item.router_data.request.payment_method_data { @@ -193,10 +206,20 @@ fn get_pm_and_subsequent_auth_detail( None, None, )), - _ => Err(errors::ConnectorError::NotSupported { - message: format!("{:?}", item.router_data.request.payment_method_data), - connector: "AuthorizeDotNet", - })?, + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("authorizedotnet"), + ))?, }, } } @@ -289,11 +312,16 @@ pub enum AuthorizationType { Pre, } -impl From for AuthorizationType { - fn from(item: enums::CaptureMethod) -> Self { - match item { - enums::CaptureMethod::Manual => Self::Pre, - _ => Self::Final, +impl TryFrom for AuthorizationType { + type Error = error_stack::Report; + + fn try_from(capture_method: enums::CaptureMethod) -> Result { + match capture_method { + enums::CaptureMethod::Manual => Ok(Self::Pre), + enums::CaptureMethod::Automatic => Ok(Self::Final), + enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err( + utils::construct_not_supported_error_report(capture_method, "authorizedotnet"), + )?, } } } @@ -307,13 +335,13 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>> ) -> Result { let (payment_details, processing_options, subsequent_auth_information) = get_pm_and_subsequent_auth_detail(item)?; - let authorization_indicator_type = - item.router_data - .request - .capture_method - .map(|c| AuthorizationIndicator { - authorization_indicator: c.into(), - }); + let authorization_indicator_type = match item.router_data.request.capture_method { + Some(capture_method) => Some(AuthorizationIndicator { + authorization_indicator: capture_method.try_into()?, + }), + None => None, + }; + let transaction_request = TransactionRequest { transaction_type: TransactionType::from(item.router_data.request.capture_method), amount: item.amount, @@ -904,6 +932,7 @@ pub enum SyncStatus { #[serde(rename = "FDSPendingReview")] FDSPendingReview, } + #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SyncTransactionResponse { @@ -938,7 +967,9 @@ impl From for enums::AttemptStatus { SyncStatus::Voided => Self::Voided, SyncStatus::CouldNotVoid => Self::VoidFailed, SyncStatus::GeneralError => Self::Failure, - _ => Self::Pending, + SyncStatus::RefundSettledSuccessfully + | SyncStatus::RefundPendingSettlement + | SyncStatus::FDSPendingReview => Self::Pending, } } } @@ -1190,9 +1221,33 @@ fn get_wallet_data( cancel_url: return_url.to_owned(), })) } - _ => Err(errors::ConnectorError::NotImplemented( - "Payment method".to_string(), - ))?, + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("authorizedotnet"), + ))? + } } } diff --git a/crates/router/src/connector/braintree/transformers.rs b/crates/router/src/connector/braintree/transformers.rs index 9201bc9e4cc2..4e8a15dfea2d 100644 --- a/crates/router/src/connector/braintree/transformers.rs +++ b/crates/router/src/connector/braintree/transformers.rs @@ -129,15 +129,53 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest { api_models::payments::WalletData::PaypalSdk(wallet_data) => { Ok(wallet_data.token.to_owned()) } - _ => Err(errors::ConnectorError::InvalidWallet), + api_models::payments::WalletData::ApplePay(_) + | api_models::payments::WalletData::GooglePay(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalRedirect(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("braintree"), + )) + } }? .into(), })) } - _ => Err(errors::ConnectorError::NotImplemented(format!( - "Current Payment Method - {:?}", - item.request.payment_method_data - ))), + api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("braintree"), + )), }?; let braintree_transaction_body = TransactionBody { amount, @@ -211,7 +249,9 @@ impl From for enums::AttemptStatus { | BraintreePaymentStatus::SettlementDeclined => Self::Failure, BraintreePaymentStatus::Authorized => Self::Authorized, BraintreePaymentStatus::Voided => Self::Voided, - _ => Self::Pending, + BraintreePaymentStatus::SubmittedForSettlement + | BraintreePaymentStatus::SettlementPending + | BraintreePaymentStatus::SettlementConfirmed => Self::Pending, } } } diff --git a/crates/router/src/connector/fiserv/transformers.rs b/crates/router/src/connector/fiserv/transformers.rs index e2511dc8d568..df794630e67b 100644 --- a/crates/router/src/connector/fiserv/transformers.rs +++ b/crates/router/src/connector/fiserv/transformers.rs @@ -182,9 +182,23 @@ impl TryFrom<&FiservRouterData<&types::PaymentsAuthorizeRouterData>> for FiservP }; Source::PaymentCard { card } } - _ => Err(errors::ConnectorError::NotImplemented( - "Payment Methods".to_string(), - ))?, + api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("fiserv"), + )) + }?, }; Ok(Self { amount, @@ -306,7 +320,7 @@ impl From for enums::RefundStatus { | FiservPaymentStatus::Authorized | FiservPaymentStatus::Captured => Self::Success, FiservPaymentStatus::Declined | FiservPaymentStatus::Failed => Self::Failure, - _ => Self::Pending, + FiservPaymentStatus::Voided | FiservPaymentStatus::Processing => Self::Pending, } } }