mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	refactor(connector): [Payeezy] remove default case handling (#2712)
Co-authored-by: DEEPANSHU BANSAL <41580413+deepanshu-iiitu@users.noreply.github.com> Co-authored-by: chikke srujan <121822803+srujanchikke@users.noreply.github.com>
This commit is contained in:
		| @ -37,11 +37,14 @@ impl TryFrom<utils::CardIssuer> for PayeezyCardType { | |||||||
|             utils::CardIssuer::Master => Ok(Self::Mastercard), |             utils::CardIssuer::Master => Ok(Self::Mastercard), | ||||||
|             utils::CardIssuer::Discover => Ok(Self::Discover), |             utils::CardIssuer::Discover => Ok(Self::Discover), | ||||||
|             utils::CardIssuer::Visa => Ok(Self::Visa), |             utils::CardIssuer::Visa => Ok(Self::Visa), | ||||||
|             _ => Err(errors::ConnectorError::NotSupported { |  | ||||||
|                 message: issuer.to_string(), |             utils::CardIssuer::Maestro | utils::CardIssuer::DinersClub | utils::CardIssuer::JCB => { | ||||||
|                 connector: "Payeezy", |                 Err(errors::ConnectorError::NotSupported { | ||||||
|  |                     message: utils::SELECTED_PAYMENT_METHOD.to_string(), | ||||||
|  |                     connector: "Payeezy", | ||||||
|  |                 } | ||||||
|  |                 .into()) | ||||||
|             } |             } | ||||||
|             .into()), |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -97,7 +100,20 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayeezyPaymentsRequest { | |||||||
|     fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> { |     fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> { | ||||||
|         match item.payment_method { |         match item.payment_method { | ||||||
|             diesel_models::enums::PaymentMethod::Card => get_card_specific_payment_data(item), |             diesel_models::enums::PaymentMethod::Card => get_card_specific_payment_data(item), | ||||||
|             _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()), |  | ||||||
|  |             diesel_models::enums::PaymentMethod::CardRedirect | ||||||
|  |             | diesel_models::enums::PaymentMethod::PayLater | ||||||
|  |             | diesel_models::enums::PaymentMethod::Wallet | ||||||
|  |             | diesel_models::enums::PaymentMethod::BankRedirect | ||||||
|  |             | diesel_models::enums::PaymentMethod::BankTransfer | ||||||
|  |             | diesel_models::enums::PaymentMethod::Crypto | ||||||
|  |             | diesel_models::enums::PaymentMethod::BankDebit | ||||||
|  |             | diesel_models::enums::PaymentMethod::Reward | ||||||
|  |             | diesel_models::enums::PaymentMethod::Upi | ||||||
|  |             | diesel_models::enums::PaymentMethod::Voucher | ||||||
|  |             | diesel_models::enums::PaymentMethod::GiftCard => { | ||||||
|  |                 Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()) | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -165,7 +181,10 @@ fn get_transaction_type_and_stored_creds( | |||||||
|                 Some(diesel_models::enums::CaptureMethod::Automatic) => { |                 Some(diesel_models::enums::CaptureMethod::Automatic) => { | ||||||
|                     Ok((PayeezyTransactionType::Purchase, None)) |                     Ok((PayeezyTransactionType::Purchase, None)) | ||||||
|                 } |                 } | ||||||
|                 _ => Err(errors::ConnectorError::FlowNotSupported { |  | ||||||
|  |                 Some(diesel_models::enums::CaptureMethod::ManualMultiple) | ||||||
|  |                 | Some(diesel_models::enums::CaptureMethod::Scheduled) | ||||||
|  |                 | None => Err(errors::ConnectorError::FlowNotSupported { | ||||||
|                     flow: item.request.capture_method.unwrap_or_default().to_string(), |                     flow: item.request.capture_method.unwrap_or_default().to_string(), | ||||||
|                     connector: "Payeezy".to_string(), |                     connector: "Payeezy".to_string(), | ||||||
|                 }), |                 }), | ||||||
| @ -196,7 +215,23 @@ fn get_payment_method_data( | |||||||
|             }; |             }; | ||||||
|             Ok(PayeezyPaymentMethod::PayeezyCard(payeezy_card)) |             Ok(PayeezyPaymentMethod::PayeezyCard(payeezy_card)) | ||||||
|         } |         } | ||||||
|         _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()), |  | ||||||
|  |         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(_) => Err(errors::ConnectorError::NotSupported { | ||||||
|  |             message: utils::SELECTED_PAYMENT_METHOD.to_string(), | ||||||
|  |             connector: "Payeezy", | ||||||
|  |         } | ||||||
|  |         .into()), | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| @ -383,7 +418,7 @@ impl ForeignFrom<(PayeezyPaymentStatus, PayeezyTransactionType)> for enums::Atte | |||||||
|                 | PayeezyTransactionType::Purchase |                 | PayeezyTransactionType::Purchase | ||||||
|                 | PayeezyTransactionType::Recurring => Self::Charged, |                 | PayeezyTransactionType::Recurring => Self::Charged, | ||||||
|                 PayeezyTransactionType::Void => Self::Voided, |                 PayeezyTransactionType::Void => Self::Voided, | ||||||
|                 _ => Self::Pending, |                 PayeezyTransactionType::Refund | PayeezyTransactionType::Pending => Self::Pending, | ||||||
|             }, |             }, | ||||||
|             PayeezyPaymentStatus::Declined | PayeezyPaymentStatus::NotProcessed => match method { |             PayeezyPaymentStatus::Declined | PayeezyPaymentStatus::NotProcessed => match method { | ||||||
|                 PayeezyTransactionType::Capture => Self::CaptureFailed, |                 PayeezyTransactionType::Capture => Self::CaptureFailed, | ||||||
| @ -391,7 +426,7 @@ impl ForeignFrom<(PayeezyPaymentStatus, PayeezyTransactionType)> for enums::Atte | |||||||
|                 | PayeezyTransactionType::Purchase |                 | PayeezyTransactionType::Purchase | ||||||
|                 | PayeezyTransactionType::Recurring => Self::AuthorizationFailed, |                 | PayeezyTransactionType::Recurring => Self::AuthorizationFailed, | ||||||
|                 PayeezyTransactionType::Void => Self::VoidFailed, |                 PayeezyTransactionType::Void => Self::VoidFailed, | ||||||
|                 _ => Self::Pending, |                 PayeezyTransactionType::Refund | PayeezyTransactionType::Pending => Self::Pending, | ||||||
|             }, |             }, | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 HeetVekariya
					HeetVekariya