feat(payout_link): secure payout links using server side validations and client side headers (#5219)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Kashif
2024-07-17 18:23:55 +05:30
committed by GitHub
parent 35c9b8afe1
commit 2d204c9f73
23 changed files with 803 additions and 357 deletions

View File

@ -1,4 +1,4 @@
use std::fmt::Display;
use std::{collections::HashSet, fmt::Display};
use common_utils::{
events::{ApiEventMetric, ApiEventsType},
@ -59,7 +59,13 @@ pub struct PaymentLinkStatusData {
}
#[derive(Debug, Eq, PartialEq)]
pub enum GenericLinks {
pub struct GenericLinks {
pub allowed_domains: HashSet<String>,
pub data: GenericLinksData,
}
#[derive(Debug, Eq, PartialEq)]
pub enum GenericLinksData {
ExpiredLink(GenericExpiredLinkData),
PaymentMethodCollect(GenericLinkFormData),
PayoutLink(GenericLinkFormData),
@ -67,12 +73,12 @@ pub enum GenericLinks {
PaymentMethodCollectStatus(GenericLinkStatusData),
}
impl Display for GenericLinks {
impl Display for GenericLinksData {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
match self {
match *self {
Self::ExpiredLink(_) => "ExpiredLink",
Self::PaymentMethodCollect(_) => "PaymentMethodCollect",
Self::PayoutLink(_) => "PayoutLink",