Skip to content

Commit

Permalink
Merge branch 'main' into iatapay/qr
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshayaFoiger committed May 27, 2024
2 parents a81a6a3 + b3d4d13 commit 1df258f
Show file tree
Hide file tree
Showing 38 changed files with 1,667 additions and 560 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@ All notable changes to HyperSwitch will be documented here.

- - -

## 2024.05.27.0

### Refactors

- **core:** Inclusion of constraint graph for merchant Payment Method list ([#4626](https://github.com/juspay/hyperswitch/pull/4626)) ([`2cabb0b`](https://github.com/juspay/hyperswitch/commit/2cabb0bedcdf0d1adf568f2533b6ab9ce8d9fc57))

### Miscellaneous Tasks

- Add missing migrations for recently added currencies ([#4760](https://github.com/juspay/hyperswitch/pull/4760)) ([`1026f47`](https://github.com/juspay/hyperswitch/commit/1026f4783000a13b43f22e4db0b36c217d39e541))

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

- - -

## 2024.05.24.1

### Features

- **payment_charges:** Add support for collecting and refunding charges on payments ([#4628](https://github.com/juspay/hyperswitch/pull/4628)) ([`55ccce6`](https://github.com/juspay/hyperswitch/commit/55ccce61898083992afeab03ba1690954b1b45ef))

### Bug Fixes

- **payment_methods:**
- Log and ignore the apple pay metadata parsing error while fetching apple pay retry connectors ([#4747](https://github.com/juspay/hyperswitch/pull/4747)) ([`a7fc4c6`](https://github.com/juspay/hyperswitch/commit/a7fc4c6fcd2f031b92e36f40a14be641673b7422))
- Revert the filter for getting the mcas which are disabled ([#4756](https://github.com/juspay/hyperswitch/pull/4756)) ([`9fb2a83`](https://github.com/juspay/hyperswitch/commit/9fb2a8301453b47e2d1c17e215f740bea8eaa91a))

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

- - -

## 2024.05.24.0

### Features
Expand Down
40 changes: 36 additions & 4 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2952,13 +2952,17 @@ pub enum NextActionType {
#[serde(tag = "type", rename_all = "snake_case")]
pub enum NextActionData {
/// Contains the url for redirection flow
RedirectToUrl { redirect_to_url: String },
RedirectToUrl {
redirect_to_url: String,
},
/// Informs the next steps for bank transfer and also contains the charges details (ex: amount received, amount charged etc)
DisplayBankTransferInformation {
bank_transfer_steps_and_charges_details: BankTransferNextStepsData,
},
/// Contains third party sdk session token response
ThirdPartySdkSessionToken { session_token: Option<SessionToken> },
ThirdPartySdkSessionToken {
session_token: Option<SessionToken>,
},
/// Contains url for Qr code image, this qr code has to be shown in sdk
QrCodeInformation {
#[schema(value_type = String)]
Expand All @@ -2985,7 +2989,12 @@ pub enum NextActionData {
display_to_timestamp: Option<i128>,
},
/// Contains the information regarding three_ds_method_data submission, three_ds authentication, and authorization flows
ThreeDsInvoke { three_ds_data: ThreeDsData },
ThreeDsInvoke {
three_ds_data: ThreeDsData,
},
InvokeSdkClient {
next_action_data: SdkNextActionData,
},
}

#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)]
Expand Down Expand Up @@ -3048,6 +3057,12 @@ pub enum QrCodeInformation {
},
}

#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Eq, PartialEq, ToSchema)]
#[serde(rename_all = "snake_case")]
pub struct SdkNextActionData {
pub next_action: NextActionCall,
}

#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct FetchQrCodeInformation {
pub qr_code_fetch_url: Url,
Expand Down Expand Up @@ -4053,6 +4068,17 @@ pub struct GpaySessionTokenData {
pub data: GpayMetaData,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaypalSdkMetaData {
pub client_id: String,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaypalSdkSessionTokenData {
#[serde(rename = "paypal_sdk")]
pub data: PaypalSdkMetaData,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ApplepaySessionRequest {
Expand Down Expand Up @@ -4230,8 +4256,12 @@ pub struct KlarnaSessionTokenResponse {
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
#[serde(rename_all = "lowercase")]
pub struct PaypalSessionTokenResponse {
/// Name of the connector
pub connector: String,
/// The session token for PayPal
pub session_token: String,
/// The next action for the sdk (ex: calling confirm or sync call)
pub sdk_next_action: SdkNextAction,
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
Expand Down Expand Up @@ -4261,13 +4291,15 @@ pub struct SdkNextAction {
pub next_action: NextActionCall,
}

#[derive(Debug, Eq, PartialEq, serde::Serialize, Clone, ToSchema)]
#[derive(Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum NextActionCall {
/// The next action call is confirm
Confirm,
/// The next action call is sync
Sync,
/// The next action call is Complete Authorize
CompleteAuthorize,
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
Expand Down
8 changes: 8 additions & 0 deletions crates/connector_configs/src/common_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ pub enum GooglePayData {
Zen(ZenGooglePay),
}

#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaypalSdkData {
pub client_id: Option<String>,
}

#[serde_with::skip_serializing_none]
#[derive(Debug, Deserialize, serde::Serialize, Clone)]
#[serde(untagged)]
Expand All @@ -79,6 +85,7 @@ pub struct ApiModelMetaData {
pub terminal_id: Option<String>,
pub merchant_id: Option<String>,
pub google_pay: Option<GoogleApiModelData>,
pub paypal_sdk: Option<PaypalSdkData>,
pub apple_pay: Option<ApplePayData>,
pub apple_pay_combined: Option<ApplePayData>,
pub endpoint_prefix: Option<String>,
Expand Down Expand Up @@ -180,6 +187,7 @@ pub struct DashboardMetaData {
pub terminal_id: Option<String>,
pub merchant_id: Option<String>,
pub google_pay: Option<GooglePayData>,
pub paypal_sdk: Option<PaypalSdkData>,
pub apple_pay: Option<ApplePayData>,
pub apple_pay_combined: Option<ApplePayData>,
pub endpoint_prefix: Option<String>,
Expand Down
3 changes: 2 additions & 1 deletion crates/connector_configs/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use serde::Deserialize;
#[cfg(any(feature = "sandbox", feature = "development", feature = "production"))]
use toml;

use crate::common_config::{CardProvider, GooglePayData, Provider, ZenApplePay};
use crate::common_config::{CardProvider, GooglePayData, PaypalSdkData, Provider, ZenApplePay};

#[derive(Default, Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct Classic {
Expand Down Expand Up @@ -79,6 +79,7 @@ pub struct ConfigMetadata {
pub account_name: Option<String>,
pub terminal_id: Option<String>,
pub google_pay: Option<GooglePayData>,
pub paypal_sdk: Option<PaypalSdkData>,
pub apple_pay: Option<ApplePayTomlConfig>,
pub merchant_id: Option<String>,
pub endpoint_prefix: Option<String>,
Expand Down
1 change: 1 addition & 0 deletions crates/connector_configs/src/response_modifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ impl From<ApiModelMetaData> for DashboardMetaData {
terminal_id: api_model.terminal_id,
merchant_id: api_model.merchant_id,
google_pay: get_google_pay_metadata_response(api_model.google_pay),
paypal_sdk: api_model.paypal_sdk,
apple_pay: api_model.apple_pay,
apple_pay_combined: api_model.apple_pay_combined,
endpoint_prefix: api_model.endpoint_prefix,
Expand Down
7 changes: 6 additions & 1 deletion crates/connector_configs/src/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ impl DashboardRequestPayload {
(Connector::Zen, GooglePay) | (Connector::Zen, ApplePay) => {
Some(api_models::enums::PaymentExperience::RedirectToUrl)
}
(Connector::Braintree, Paypal) | (Connector::Klarna, Klarna) => {
(Connector::Paypal, Paypal)
| (Connector::Braintree, Paypal)
| (Connector::Klarna, Klarna) => {
Some(api_models::enums::PaymentExperience::InvokeSdkClient)
}
(Connector::Globepay, AliPay)
Expand Down Expand Up @@ -194,6 +196,7 @@ impl DashboardRequestPayload {
three_ds_requestor_name: None,
three_ds_requestor_id: None,
pull_mechanism_for_external_3ds_enabled: None,
paypal_sdk: None,
};
let meta_data = match request.metadata {
Some(data) => data,
Expand All @@ -205,6 +208,7 @@ impl DashboardRequestPayload {
let merchant_id = meta_data.merchant_id.clone();
let terminal_id = meta_data.terminal_id.clone();
let endpoint_prefix = meta_data.endpoint_prefix.clone();
let paypal_sdk = meta_data.paypal_sdk;
let apple_pay = meta_data.apple_pay;
let apple_pay_combined = meta_data.apple_pay_combined;
let merchant_config_currency = meta_data.merchant_config_currency;
Expand All @@ -228,6 +232,7 @@ impl DashboardRequestPayload {
merchant_config_currency,
apple_pay_combined,
endpoint_prefix,
paypal_sdk,
mcc,
merchant_country_code,
merchant_name,
Expand Down
2 changes: 2 additions & 0 deletions crates/connector_configs/toml/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,8 @@ api_key="Client Secret"
key1="Client ID"
[paypal.connector_webhook_details]
merchant_secret="Source verification key"
[paypal.metadata.paypal_sdk]
client_id="Client ID"

[paypal_payout]
[[paypal.wallet]]
Expand Down
2 changes: 2 additions & 0 deletions crates/connector_configs/toml/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,8 @@ api_key="Client Secret"
key1="Client ID"
[paypal.connector_webhook_details]
merchant_secret="Source verification key"
[paypal.metadata.paypal_sdk]
client_id="Client ID"

[payu]
[[payu.credit]]
Expand Down
2 changes: 2 additions & 0 deletions crates/connector_configs/toml/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,8 @@ api_key="Client Secret"
key1="Client ID"
[paypal.connector_webhook_details]
merchant_secret="Source verification key"
[paypal.metadata.paypal_sdk]
client_id="Client ID"

[paypal_payout]
[[paypal.wallet]]
Expand Down
2 changes: 2 additions & 0 deletions crates/euclid/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ pub enum MandateAcceptanceType {
pub enum PaymentType {
SetupMandate,
NonMandate,
NewMandate,
UpdateMandate,
}

#[derive(
Expand Down
1 change: 1 addition & 0 deletions crates/openapi/src/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::ApplepaySessionTokenResponse,
api_models::payments::SdkNextAction,
api_models::payments::NextActionCall,
api_models::payments::SdkNextActionData,
api_models::payments::SamsungPayWalletData,
api_models::payments::WeChatPay,
api_models::payments::GpayTokenizationData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,9 @@ pub enum StripeNextAction {
display_from_timestamp: i128,
display_to_timestamp: Option<i128>,
},
InvokeSdkClient {
next_action_data: payments::SdkNextActionData,
},
}

pub(crate) fn into_stripe_next_action(
Expand Down Expand Up @@ -880,6 +883,9 @@ pub(crate) fn into_stripe_next_action(
url: None,
},
},
payments::NextActionData::InvokeSdkClient { next_action_data } => {
StripeNextAction::InvokeSdkClient { next_action_data }
}
})
}

Expand Down
6 changes: 6 additions & 0 deletions crates/router/src/compatibility/stripe/setup_intents/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ pub enum StripeNextAction {
display_from_timestamp: i128,
display_to_timestamp: Option<i128>,
},
InvokeSdkClient {
next_action_data: payments::SdkNextActionData,
},
}

pub(crate) fn into_stripe_next_action(
Expand Down Expand Up @@ -443,6 +446,9 @@ pub(crate) fn into_stripe_next_action(
url: None,
},
},
payments::NextActionData::InvokeSdkClient { next_action_data } => {
StripeNextAction::InvokeSdkClient { next_action_data }
}
})
}

Expand Down
Loading

0 comments on commit 1df258f

Please sign in to comment.