Skip to content

Commit

Permalink
Merge branch 'main' into payone-template-code
Browse files Browse the repository at this point in the history
  • Loading branch information
KiranKBR committed Apr 26, 2024
2 parents a951e02 + 3335195 commit 2abc532
Show file tree
Hide file tree
Showing 26 changed files with 711 additions and 436 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,38 @@ All notable changes to HyperSwitch will be documented here.

- - -

## 2024.04.26.0

### Features

- **core:** [Payouts] Add access_token flow for Payout Create and Fulfill flow ([#4375](https://github.com/juspay/hyperswitch/pull/4375)) ([`7f0d04f`](https://github.com/juspay/hyperswitch/commit/7f0d04fe3782cf6777c67e40e708c7abb5c4f45e))
- Add an api for toggling extended card info feature ([#4444](https://github.com/juspay/hyperswitch/pull/4444)) ([`87d9fce`](https://github.com/juspay/hyperswitch/commit/87d9fced07e5cc1366eb6d16d2584bd920ad16fe))

### Bug Fixes

- **connector:** [CYBERSOURCE] Handle HTML Error Response and add Descriptor field in ApplePay payments request ([#4451](https://github.com/juspay/hyperswitch/pull/4451)) ([`dbd3160`](https://github.com/juspay/hyperswitch/commit/dbd3160fcf310b2942ef096bfb091881bfeec902))

### Refactors

- **configs:** Add comments to configs for deployments to environments ([#4458](https://github.com/juspay/hyperswitch/pull/4458)) ([`9d096e6`](https://github.com/juspay/hyperswitch/commit/9d096e6b4883e34908eca0d5aa134a88bec22b40))
- **connector:** Pass optional browser_info to stripe for increased trust ([#4374](https://github.com/juspay/hyperswitch/pull/4374)) ([`4c793c3`](https://github.com/juspay/hyperswitch/commit/4c793c3c00e93ebf4a4db3439a213474ff57b54d))
- **core:** Make save_payment_method as post_update_tracker trait function ([#4307](https://github.com/juspay/hyperswitch/pull/4307)) ([`5f40eee`](https://github.com/juspay/hyperswitch/commit/5f40eee3fa264390ea6ac7feaca7737d83dccb3a))
- **payment_methods:** Store `card_network` in locker ([#4425](https://github.com/juspay/hyperswitch/pull/4425)) ([`5b54d55`](https://github.com/juspay/hyperswitch/commit/5b54d55c5e0d2c8ae1090fb566434efb50120857))
- **voucher:** Remove billing details from voucher pmd ([#4361](https://github.com/juspay/hyperswitch/pull/4361)) ([`2dd0ee6`](https://github.com/juspay/hyperswitch/commit/2dd0ee68bf23e5f49d22011f0294f44f4e97423b))

### Documentation

- **cypress:** Update Cypress README Documentation ([#4380](https://github.com/juspay/hyperswitch/pull/4380)) ([`8ee1a58`](https://github.com/juspay/hyperswitch/commit/8ee1a58c386fc5f08025c6ac90c96468e6d26bc7))
- Add documentation page for building Docker images ([#4457](https://github.com/juspay/hyperswitch/pull/4457)) ([`705e827`](https://github.com/juspay/hyperswitch/commit/705e82779a2b7bfd0cb1cd856b4a760d487cd8c5))

### Miscellaneous Tasks

- **postman:** Update Postman collection files ([`047f917`](https://github.com/juspay/hyperswitch/commit/047f9171a5ae5e8211e18b1c882672dab0c26d07))

**Full Changelog:** [`2024.04.25.0...2024.04.26.0`](https://github.com/juspay/hyperswitch/compare/2024.04.25.0...2024.04.26.0)

- - -

## 2024.04.25.0

### Features
Expand Down
7 changes: 7 additions & 0 deletions crates/api_models/src/admin.rs
Expand Up @@ -1088,3 +1088,10 @@ pub struct PaymentLinkConfig {
/// Enable saved payment method option for payment link
pub enabled_saved_payment_method: bool,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
pub struct ExtendedCardInfoChoice {
pub enabled: bool,
}

impl common_utils::events::ApiEventMetric for ExtendedCardInfoChoice {}
11 changes: 11 additions & 0 deletions crates/common_utils/src/access_token.rs
@@ -0,0 +1,11 @@
//! Commonly used utilities for access token

use std::fmt::Display;

/// Create a key for fetching the access token from redis
pub fn create_access_token_key(
merchant_id: impl Display,
merchant_connector_id: impl Display,
) -> String {
format!("access_token_{merchant_id}_{merchant_connector_id}")
}
1 change: 1 addition & 0 deletions crates/common_utils/src/lib.rs
Expand Up @@ -2,6 +2,7 @@
#![warn(missing_docs, missing_debug_implementations)]
#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR" ), "/", "README.md"))]

pub mod access_token;
pub mod consts;
pub mod crypto;
pub mod custom_serde;
Expand Down
89 changes: 86 additions & 3 deletions crates/diesel_models/src/business_profile.rs
Expand Up @@ -35,6 +35,7 @@ pub struct BusinessProfile {
pub payment_link_config: Option<serde_json::Value>,
pub session_expiry: Option<i64>,
pub authentication_connector_details: Option<serde_json::Value>,
pub is_extended_card_info_enabled: Option<bool>,
}

#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
Expand All @@ -61,6 +62,7 @@ pub struct BusinessProfileNew {
pub payment_link_config: Option<serde_json::Value>,
pub session_expiry: Option<i64>,
pub authentication_connector_details: Option<serde_json::Value>,
pub is_extended_card_info_enabled: Option<bool>,
}

#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
Expand All @@ -84,6 +86,84 @@ pub struct BusinessProfileUpdateInternal {
pub payment_link_config: Option<serde_json::Value>,
pub session_expiry: Option<i64>,
pub authentication_connector_details: Option<serde_json::Value>,
pub is_extended_card_info_enabled: Option<bool>,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub enum BusinessProfileUpdate {
Update {
profile_name: Option<String>,
modified_at: Option<time::PrimitiveDateTime>,
return_url: Option<String>,
enable_payment_response_hash: Option<bool>,
payment_response_hash_key: Option<String>,
redirect_to_merchant_with_http_post: Option<bool>,
webhook_details: Option<serde_json::Value>,
metadata: Option<pii::SecretSerdeValue>,
routing_algorithm: Option<serde_json::Value>,
intent_fulfillment_time: Option<i64>,
frm_routing_algorithm: Option<serde_json::Value>,
payout_routing_algorithm: Option<serde_json::Value>,
is_recon_enabled: Option<bool>,
applepay_verified_domains: Option<Vec<String>>,
payment_link_config: Option<serde_json::Value>,
session_expiry: Option<i64>,
authentication_connector_details: Option<serde_json::Value>,
},
ExtendedCardInfoUpdate {
is_extended_card_info_enabled: Option<bool>,
},
}

impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
fn from(business_profile_update: BusinessProfileUpdate) -> Self {
match business_profile_update {
BusinessProfileUpdate::Update {
profile_name,
modified_at,
return_url,
enable_payment_response_hash,
payment_response_hash_key,
redirect_to_merchant_with_http_post,
webhook_details,
metadata,
routing_algorithm,
intent_fulfillment_time,
frm_routing_algorithm,
payout_routing_algorithm,
is_recon_enabled,
applepay_verified_domains,
payment_link_config,
session_expiry,
authentication_connector_details,
} => Self {
profile_name,
modified_at,
return_url,
enable_payment_response_hash,
payment_response_hash_key,
redirect_to_merchant_with_http_post,
webhook_details,
metadata,
routing_algorithm,
intent_fulfillment_time,
frm_routing_algorithm,
payout_routing_algorithm,
is_recon_enabled,
applepay_verified_domains,
payment_link_config,
session_expiry,
authentication_connector_details,
..Default::default()
},
BusinessProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
} => Self {
is_extended_card_info_enabled,
..Default::default()
},
}
}
}

impl From<BusinessProfileNew> for BusinessProfile {
Expand All @@ -109,13 +189,14 @@ impl From<BusinessProfileNew> for BusinessProfile {
payment_link_config: new.payment_link_config,
session_expiry: new.session_expiry,
authentication_connector_details: new.authentication_connector_details,
is_extended_card_info_enabled: new.is_extended_card_info_enabled,
}
}
}

impl BusinessProfileUpdateInternal {
impl BusinessProfileUpdate {
pub fn apply_changeset(self, source: BusinessProfile) -> BusinessProfile {
let Self {
let BusinessProfileUpdateInternal {
profile_name,
modified_at: _,
return_url,
Expand All @@ -133,7 +214,8 @@ impl BusinessProfileUpdateInternal {
payment_link_config,
session_expiry,
authentication_connector_details,
} = self;
is_extended_card_info_enabled,
} = self.into();
BusinessProfile {
profile_name: profile_name.unwrap_or(source.profile_name),
modified_at: common_utils::date_time::now(),
Expand All @@ -154,6 +236,7 @@ impl BusinessProfileUpdateInternal {
payment_link_config,
session_expiry,
authentication_connector_details,
is_extended_card_info_enabled,
..source
}
}
Expand Down
8 changes: 5 additions & 3 deletions crates/diesel_models/src/query/business_profile.rs
Expand Up @@ -2,7 +2,9 @@ use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, T

use super::generics;
use crate::{
business_profile::{BusinessProfile, BusinessProfileNew, BusinessProfileUpdateInternal},
business_profile::{
BusinessProfile, BusinessProfileNew, BusinessProfileUpdate, BusinessProfileUpdateInternal,
},
errors,
schema::business_profile::dsl,
PgPooledConn, StorageResult,
Expand All @@ -18,12 +20,12 @@ impl BusinessProfile {
pub async fn update_by_profile_id(
self,
conn: &PgPooledConn,
business_profile: BusinessProfileUpdateInternal,
business_profile: BusinessProfileUpdate,
) -> StorageResult<Self> {
match generics::generic_update_by_id::<<Self as HasTable>::Table, _, _, _>(
conn,
self.profile_id.clone(),
business_profile,
BusinessProfileUpdateInternal::from(business_profile),
)
.await
{
Expand Down
1 change: 1 addition & 0 deletions crates/diesel_models/src/schema.rs
Expand Up @@ -193,6 +193,7 @@ diesel::table! {
payment_link_config -> Nullable<Jsonb>,
session_expiry -> Nullable<Int8>,
authentication_connector_details -> Nullable<Jsonb>,
is_extended_card_info_enabled -> Nullable<Bool>,
}
}

Expand Down

0 comments on commit 2abc532

Please sign in to comment.