Skip to content

Commit

Permalink
feat(connector): [Paypal] implement vaulting for paypal wallet and ca…
Browse files Browse the repository at this point in the history
…rds while purchasing (#5323)

Co-authored-by: swangi-kumari <[email protected]>
  • Loading branch information
KiranKBR and swangi-kumari authored Nov 5, 2024
1 parent c84113a commit 97102c3
Show file tree
Hide file tree
Showing 4 changed files with 361 additions and 62 deletions.
2 changes: 2 additions & 0 deletions crates/hyperswitch_domain_models/src/router_request_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ pub struct PaymentsPostSessionTokensData {
/// In case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference.
pub merchant_order_reference_id: Option<String>,
pub shipping_cost: Option<MinorUnit>,
pub setup_future_usage: Option<storage_enums::FutureUsage>,
pub router_return_url: Option<String>,
}

#[derive(Debug, Clone, PartialEq)]
Expand Down
15 changes: 14 additions & 1 deletion crates/router/src/connector/paypal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ use transformers as paypal;

use self::transformers::{auth_headers, PaypalAuthResponse, PaypalMeta, PaypalWebhookEventType};
use super::utils::{
ConnectorErrorType, PaymentsAuthorizeRequestData, PaymentsCompleteAuthorizeRequestData,
ConnectorErrorType, PaymentMethodDataType, PaymentsAuthorizeRequestData,
PaymentsCompleteAuthorizeRequestData,
};
use crate::{
configs::settings,
Expand Down Expand Up @@ -332,6 +333,18 @@ impl ConnectorValidation for Paypal {
),
}
}
fn validate_mandate_payment(
&self,
pm_type: Option<types::storage::enums::PaymentMethodType>,
pm_data: domain::PaymentMethodData,
) -> CustomResult<(), errors::ConnectorError> {
let mandate_supported_pmd = std::collections::HashSet::from([
PaymentMethodDataType::Card,
PaymentMethodDataType::PaypalRedirect,
PaymentMethodDataType::PaypalSdk,
]);
connector_utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())
}
}

impl
Expand Down
Loading

0 comments on commit 97102c3

Please sign in to comment.