Skip to content

Commit

Permalink
Merge branch 'main' into payu
Browse files Browse the repository at this point in the history
  • Loading branch information
vinfinity7 authored Mar 27, 2024
2 parents 0a652da + 6587472 commit 24fa586
Show file tree
Hide file tree
Showing 64 changed files with 1,737 additions and 286 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@ All notable changes to HyperSwitch will be documented here.

- - -

## 2024.03.27.0

### Bug Fixes

- **connector:**
- [Trustpay] fix deserialization error for incoming webhook response for trustpay and add error code mapping '800.100.203' ([#4199](https://github.com/juspay/hyperswitch/pull/4199)) ([`84bef25`](https://github.com/juspay/hyperswitch/commit/84bef251480a77027b43c3dc91353a0cb40d5ff1))
- [CRYPTOPAY] Skip metadata serialization if none ([#4205](https://github.com/juspay/hyperswitch/pull/4205)) ([`0429399`](https://github.com/juspay/hyperswitch/commit/0429399c29f76c97bf2096bbe9e9b429c025e56b))
- **core:** Make eci in AuthenticationData optional ([#4187](https://github.com/juspay/hyperswitch/pull/4187)) ([`4f0c788`](https://github.com/juspay/hyperswitch/commit/4f0c788cf26907e2be784978c412081a93386d04))

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

- - -

## 2024.03.26.0

### Features

- **events:** Allow listing webhook events and webhook delivery attempts by business profile ([#4159](https://github.com/juspay/hyperswitch/pull/4159)) ([`4c8cdf1`](https://github.com/juspay/hyperswitch/commit/4c8cdf1475ac74fb2df5bea419dfa7657f26f298))
- **payouts:** Add user roles for payouts ([#4167](https://github.com/juspay/hyperswitch/pull/4167)) ([`13fe584`](https://github.com/juspay/hyperswitch/commit/13fe58450bad094fb2b4745ecf76bc2df8b96798))

### Miscellaneous Tasks

- Address Rust 1.77 clippy lints ([#4172](https://github.com/juspay/hyperswitch/pull/4172)) ([`f213c51`](https://github.com/juspay/hyperswitch/commit/f213c51b3e5c4f0b3546b35bac4dde9698818e01))

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

- - -

## 2024.03.22.0

### Features
Expand Down
1 change: 1 addition & 0 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
bambora.base_url = "https://api.na.bambora.com"
bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/"
billwerk.base_url = "https://api.reepay.com/"
bitpay.base_url = "https://test.bitpay.com"
bluesnap.base_url = "https://sandbox.bluesnap.com/"
bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/"
Expand Down
6 changes: 4 additions & 2 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ cards = [
"authorizedotnet",
"bambora",
"bankofamerica",
"billwerk",
"bitpay",
"bluesnap",
"boku",
Expand Down Expand Up @@ -165,6 +166,7 @@ applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
bambora.base_url = "https://api.na.bambora.com"
bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/"
billwerk.base_url = "https://api.reepay.com/"
bitpay.base_url = "https://test.bitpay.com"
bluesnap.base_url = "https://sandbox.bluesnap.com/"
bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/"
Expand Down Expand Up @@ -237,9 +239,9 @@ workers = 1

[cors]
max_age = 30
origins = "http://localhost:8080,http://localhost:9000"
# origins = "http://localhost:8080,http://localhost:9000"
allowed_methods = "GET,POST,PUT,DELETE"
wildcard_origin = false
wildcard_origin = true

[email]
sender_email = "[email protected]"
Expand Down
6 changes: 4 additions & 2 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ max_feed_count = 200

[cors]
max_age = 30
origins = "http://localhost:8080,http://localhost:9000"
# origins = "http://localhost:8080,http://localhost:9000"
allowed_methods = "GET,POST,PUT,DELETE"
wildcard_origin = false
wildcard_origin = true

[refund]
max_attempts = 10
Expand All @@ -104,6 +104,7 @@ applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
bambora.base_url = "https://api.na.bambora.com"
bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/"
billwerk.base_url = "https://api.reepay.com/"
bitpay.base_url = "https://test.bitpay.com"
bluesnap.base_url = "https://sandbox.bluesnap.com/"
bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/"
Expand Down Expand Up @@ -176,6 +177,7 @@ cards = [
"authorizedotnet",
"bambora",
"bankofamerica",
"billwerk",
"bitpay",
"bluesnap",
"boku",
Expand Down
3 changes: 3 additions & 0 deletions crates/api_models/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub enum Connector {
Authorizedotnet,
Bambora,
Bankofamerica,
// Billwerk, Added as template code for future usage
Bitpay,
Bluesnap,
Boku,
Expand Down Expand Up @@ -165,6 +166,7 @@ impl Connector {
| Self::Authorizedotnet
| Self::Bambora
| Self::Bankofamerica
// | Self::Billwerk Added as template code for future usage
| Self::Bitpay
| Self::Bluesnap
| Self::Boku
Expand Down Expand Up @@ -221,6 +223,7 @@ impl Connector {
| Self::Authorizedotnet
| Self::Bambora
| Self::Bankofamerica
// | Self::Billwerk Added as template for future usage
| Self::Bitpay
| Self::Bluesnap
| Self::Boku
Expand Down
1 change: 1 addition & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ pub enum RoutableConnectors {
Airwallex,
Authorizedotnet,
Bankofamerica,
// Billwerk, Added as template code for future usage
Bitpay,
Bambora,
Bluesnap,
Expand Down
7 changes: 0 additions & 7 deletions crates/common_utils/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ macro_rules! newtype {
};
}

#[macro_export]
macro_rules! async_spawn {
($t:block) => {
tokio::spawn(async move { $t });
};
}

/// Use this to ensure that the corresponding
/// openapi route has been implemented in the openapi crate
#[macro_export]
Expand Down
10 changes: 10 additions & 0 deletions crates/connector_configs/src/common_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ pub struct ApiModelMetaData {
pub apple_pay: Option<ApplePayData>,
pub apple_pay_combined: Option<ApplePayData>,
pub endpoint_prefix: Option<String>,
pub mcc: Option<String>,
pub merchant_country_code: Option<String>,
pub merchant_name: Option<String>,
pub acquirer_bin: Option<String>,
pub acquirer_merchant_id: Option<String>,
}

#[serde_with::skip_serializing_none]
Expand Down Expand Up @@ -175,4 +180,9 @@ pub struct DashboardMetaData {
pub apple_pay: Option<ApplePayData>,
pub apple_pay_combined: Option<ApplePayData>,
pub endpoint_prefix: Option<String>,
pub mcc: Option<String>,
pub merchant_country_code: Option<String>,
pub merchant_name: Option<String>,
pub acquirer_bin: Option<String>,
pub acquirer_merchant_id: Option<String>,
}
2 changes: 2 additions & 0 deletions crates/connector_configs/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pub struct ConnectorConfig {
pub airwallex: Option<ConnectorTomlConfig>,
pub authorizedotnet: Option<ConnectorTomlConfig>,
pub bankofamerica: Option<ConnectorTomlConfig>,
pub billwerk: Option<ConnectorTomlConfig>,
pub bitpay: Option<ConnectorTomlConfig>,
pub bluesnap: Option<ConnectorTomlConfig>,
pub boku: Option<ConnectorTomlConfig>,
Expand Down Expand Up @@ -227,6 +228,7 @@ impl ConnectorConfig {
Connector::Airwallex => Ok(connector_data.airwallex),
Connector::Authorizedotnet => Ok(connector_data.authorizedotnet),
Connector::Bankofamerica => Ok(connector_data.bankofamerica),
// Connector::Billwerk => Ok(connector_data.billwerk), Added as template code for future usage
Connector::Bitpay => Ok(connector_data.bitpay),
Connector::Bluesnap => Ok(connector_data.bluesnap),
Connector::Boku => Ok(connector_data.boku),
Expand Down
121 changes: 47 additions & 74 deletions crates/connector_configs/src/response_modifier.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::common_config::{
CardProvider, ConnectorApiIntegrationPayload, DashboardMetaData, DashboardPaymentMethodPayload,
DashboardRequestPayload, GoogleApiModelData, GooglePayData, GpayDashboardPayLoad, Provider,
ApiModelMetaData, CardProvider, ConnectorApiIntegrationPayload, DashboardMetaData,
DashboardPaymentMethodPayload, DashboardRequestPayload, GoogleApiModelData, GooglePayData,
GpayDashboardPayLoad, Provider,
};

impl ConnectorApiIntegrationPayload {
Expand Down Expand Up @@ -275,52 +276,7 @@ impl ConnectorApiIntegrationPayload {
card_provider: Some(credit_details),
};

let google_pay = Self::get_google_pay_metadata_response(response.clone());
let account_name = match response.metadata.clone() {
Some(meta_data) => meta_data.account_name,
_ => None,
};

let merchant_account_id = match response.metadata.clone() {
Some(meta_data) => meta_data.merchant_account_id,
_ => None,
};
let merchant_id = match response.metadata.clone() {
Some(meta_data) => meta_data.merchant_id,
_ => None,
};
let terminal_id = match response.metadata.clone() {
Some(meta_data) => meta_data.terminal_id,
_ => None,
};
let endpoint_prefix = match response.metadata.clone() {
Some(meta_data) => meta_data.endpoint_prefix,
_ => None,
};
let apple_pay = match response.metadata.clone() {
Some(meta_data) => meta_data.apple_pay,
_ => None,
};
let apple_pay_combined = match response.metadata.clone() {
Some(meta_data) => meta_data.apple_pay_combined,
_ => None,
};
let merchant_config_currency = match response.metadata.clone() {
Some(meta_data) => meta_data.merchant_config_currency,
_ => None,
};

let meta_data = DashboardMetaData {
merchant_config_currency,
merchant_account_id,
apple_pay,
apple_pay_combined,
google_pay,
account_name,
terminal_id,
merchant_id,
endpoint_prefix,
};
let meta_data = response.metadata.map(DashboardMetaData::from);

DashboardRequestPayload {
connector: response.connector_name,
Expand All @@ -339,35 +295,52 @@ impl ConnectorApiIntegrationPayload {
credit_details,
gift_card,
]),
metadata: Some(meta_data),
metadata: meta_data,
}
}
}

pub fn get_google_pay_metadata_response(response: Self) -> Option<GooglePayData> {
match response.metadata {
Some(meta_data) => {
match meta_data.google_pay {
Some(google_pay) => match google_pay {
GoogleApiModelData::Standard(standard_data) => {
let data = standard_data.allowed_payment_methods.first().map(
|allowed_pm| {
allowed_pm.tokenization_specification.parameters.clone()
},
)?;
Some(GooglePayData::Standard(GpayDashboardPayLoad {
gateway_merchant_id: data.gateway_merchant_id,
stripe_version: data.stripe_version,
stripe_publishable_key: data.stripe_publishable_key,
merchant_name: standard_data.merchant_info.merchant_name,
merchant_id: standard_data.merchant_info.merchant_id,
}))
}
GoogleApiModelData::Zen(data) => Some(GooglePayData::Zen(data)),
},
None => None,
}
}
None => None,
impl From<ApiModelMetaData> for DashboardMetaData {
fn from(api_model: ApiModelMetaData) -> Self {
Self {
merchant_config_currency: api_model.merchant_config_currency,
merchant_account_id: api_model.merchant_account_id,
account_name: api_model.account_name,
terminal_id: api_model.terminal_id,
merchant_id: api_model.merchant_id,
google_pay: get_google_pay_metadata_response(api_model.google_pay),
apple_pay: api_model.apple_pay,
apple_pay_combined: api_model.apple_pay_combined,
endpoint_prefix: api_model.endpoint_prefix,
mcc: api_model.mcc,
merchant_country_code: api_model.merchant_country_code,
merchant_name: api_model.merchant_name,
acquirer_bin: api_model.acquirer_bin,
acquirer_merchant_id: api_model.acquirer_merchant_id,
}
}
}

pub fn get_google_pay_metadata_response(
google_pay_data: Option<GoogleApiModelData>,
) -> Option<GooglePayData> {
match google_pay_data {
Some(google_pay) => match google_pay {
GoogleApiModelData::Standard(standard_data) => {
let data = standard_data
.allowed_payment_methods
.first()
.map(|allowed_pm| allowed_pm.tokenization_specification.parameters.clone())?;
Some(GooglePayData::Standard(GpayDashboardPayLoad {
gateway_merchant_id: data.gateway_merchant_id,
stripe_version: data.stripe_version,
stripe_publishable_key: data.stripe_publishable_key,
merchant_name: standard_data.merchant_info.merchant_name,
merchant_id: standard_data.merchant_info.merchant_id,
}))
}
GoogleApiModelData::Zen(data) => Some(GooglePayData::Zen(data)),
},
None => None,
}
}
16 changes: 16 additions & 0 deletions crates/connector_configs/src/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ impl DashboardRequestPayload {
merchant_id: None,
merchant_config_currency: None,
endpoint_prefix: None,
mcc: None,
merchant_country_code: None,
merchant_name: None,
acquirer_bin: None,
acquirer_merchant_id: None,
};
let meta_data = match request.metadata {
Some(data) => data,
Expand All @@ -201,6 +206,12 @@ impl DashboardRequestPayload {
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;
let mcc = meta_data.mcc;
let merchant_country_code = meta_data.merchant_country_code;
let merchant_name = meta_data.merchant_name;
let acquirer_bin = meta_data.acquirer_bin;
let acquirer_merchant_id = meta_data.acquirer_merchant_id;

Some(ApiModelMetaData {
google_pay,
apple_pay,
Expand All @@ -211,6 +222,11 @@ impl DashboardRequestPayload {
merchant_config_currency,
apple_pay_combined,
endpoint_prefix,
mcc,
merchant_country_code,
merchant_name,
acquirer_bin,
acquirer_merchant_id,
})
}

Expand Down
1 change: 0 additions & 1 deletion crates/diesel_models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub mod gsm;
#[cfg(feature = "kv_store")]
pub mod kv;
pub mod locker_mock_up;
pub mod macros;
pub mod mandate;
pub mod merchant_account;
pub mod merchant_connector_account;
Expand Down
6 changes: 0 additions & 6 deletions crates/diesel_models/src/macros.rs

This file was deleted.

Loading

0 comments on commit 24fa586

Please sign in to comment.