mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 05:17:02 +08:00
refactor(payment_methods): add a new domain type for payment method data to be used in connector module (#4140)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
use api_models::enums::Connector;
|
||||
use error_stack::ResultExt;
|
||||
|
||||
use crate::{core::errors, types::api};
|
||||
use crate::{core::errors, types::domain};
|
||||
|
||||
pub fn generate_card_from_details(
|
||||
card_number: String,
|
||||
card_exp_year: String,
|
||||
card_exp_month: String,
|
||||
card_cvv: String,
|
||||
) -> errors::RouterResult<api::Card> {
|
||||
Ok(api::Card {
|
||||
) -> errors::RouterResult<domain::Card> {
|
||||
Ok(domain::Card {
|
||||
card_number: card_number
|
||||
.parse::<cards::CardNumber>()
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
@ -27,7 +27,9 @@ pub fn generate_card_from_details(
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_test_card_details(connector_name: Connector) -> errors::RouterResult<Option<api::Card>> {
|
||||
pub fn get_test_card_details(
|
||||
connector_name: Connector,
|
||||
) -> errors::RouterResult<Option<domain::Card>> {
|
||||
match connector_name {
|
||||
Connector::Stripe => Some(generate_card_from_details(
|
||||
"4242424242424242".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user