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

View File

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

View File

@ -5504,8 +5504,8 @@ pub enum SamsungPayProtocolType {
pub struct SamsungPayMerchantPaymentInformation { pub struct SamsungPayMerchantPaymentInformation {
/// Merchant name, this will be displayed on the Samsung Pay screen /// Merchant name, this will be displayed on the Samsung Pay screen
pub name: String, pub name: String,
/// Merchant domain that process payments /// Merchant domain that process payments, required for web payments
pub url: String, pub url: Option<String>,
/// Merchant country code /// Merchant country code
#[schema(value_type = CountryAlpha2, example = "US")] #[schema(value_type = CountryAlpha2, example = "US")]
pub country_code: api_enums::CountryAlpha2, 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(), message: "Failed to convert amount to string major unit for Samsung Pay".to_string(),
})?; })?;
let merchant_domain = header_payload let merchant_domain = match header_payload.x_client_platform {
.x_merchant_domain Some(common_enums::ClientPlatform::Web) => Some(
.get_required_value("samsung pay domain") header_payload
.attach_printable("Failed to get domain for samsung pay session call")?; .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 { let samsung_pay_wallet_details = match samsung_pay_session_token_data.data {
payment_types::SamsungPayCombinedMetadata::MerchantCredentials( payment_types::SamsungPayCombinedMetadata::MerchantCredentials(