fix(router): make x_merchant_domain as required value only for session call done on web (#6362)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Shankar Singh C
2024-10-19 19:27:34 +05:30
committed by GitHub
parent 0bda934aca
commit ba6f7a817b
4 changed files with 15 additions and 10 deletions

View File

@ -19162,7 +19162,6 @@
"type": "object",
"required": [
"name",
"url",
"country_code"
],
"properties": {
@ -19172,7 +19171,8 @@
},
"url": {
"type": "string",
"description": "Merchant domain that process payments"
"description": "Merchant domain that process payments, required for web payments",
"nullable": true
},
"country_code": {
"$ref": "#/components/schemas/CountryAlpha2"

View File

@ -22960,7 +22960,6 @@
"type": "object",
"required": [
"name",
"url",
"country_code"
],
"properties": {
@ -22970,7 +22969,8 @@
},
"url": {
"type": "string",
"description": "Merchant domain that process payments"
"description": "Merchant domain that process payments, required for web payments",
"nullable": true
},
"country_code": {
"$ref": "#/components/schemas/CountryAlpha2"

View File

@ -5504,8 +5504,8 @@ pub enum SamsungPayProtocolType {
pub struct SamsungPayMerchantPaymentInformation {
/// Merchant name, this will be displayed on the Samsung Pay screen
pub name: String,
/// Merchant domain that process payments
pub url: String,
/// Merchant domain that process payments, required for web payments
pub url: Option<String>,
/// Merchant country code
#[schema(value_type = CountryAlpha2, example = "US")]
pub country_code: api_enums::CountryAlpha2,

View File

@ -550,10 +550,15 @@ fn create_samsung_pay_session_token(
message: "Failed to convert amount to string major unit for Samsung Pay".to_string(),
})?;
let merchant_domain = header_payload
.x_merchant_domain
.get_required_value("samsung pay domain")
.attach_printable("Failed to get domain for samsung pay session call")?;
let merchant_domain = match header_payload.x_client_platform {
Some(common_enums::ClientPlatform::Web) => Some(
header_payload
.x_merchant_domain
.get_required_value("samsung pay domain")
.attach_printable("Failed to get domain for samsung pay session call")?,
),
_ => None,
};
let samsung_pay_wallet_details = match samsung_pay_session_token_data.data {
payment_types::SamsungPayCombinedMetadata::MerchantCredentials(