refactor(router): new separate routes for applepay merchant verification (#2083)

This commit is contained in:
Prajjwal Kumar
2023-09-05 18:15:30 +05:30
committed by GitHub
parent e5d31801ec
commit dc908f6902
3 changed files with 4 additions and 3 deletions

View File

@ -44,6 +44,7 @@ recon_admin_api_key = "recon_test_admin"
merchant_cert_key = "MERCHANT CERTIFICATE KEY" merchant_cert_key = "MERCHANT CERTIFICATE KEY"
merchant_cert = "MERCHANT CERTIFICATE" merchant_cert = "MERCHANT CERTIFICATE"
common_merchant_identifier = "COMMON MERCHANT IDENTIFIER" common_merchant_identifier = "COMMON MERCHANT IDENTIFIER"
applepay_endpoint = "DOMAIN SPECIFIC ENDPOINT"
[locker] [locker]
host = "" host = ""

View File

@ -104,6 +104,7 @@ pub struct ApplepayMerchantConfigs {
pub merchant_cert: String, pub merchant_cert: String,
pub merchant_cert_key: String, pub merchant_cert_key: String,
pub common_merchant_identifier: String, pub common_merchant_identifier: String,
pub applepay_endpoint: String,
} }
#[derive(Debug, Deserialize, Clone, Default)] #[derive(Debug, Deserialize, Clone, Default)]

View File

@ -12,8 +12,6 @@ use crate::{
services, types, utils, services, types, utils,
}; };
const APPLEPAY_MERCHANT_VERIFICATION_URL: &str =
"https://apple-pay-gateway.apple.com/paymentservices/registerMerchant";
const APPLEPAY_INTERNAL_MERCHANT_NAME: &str = "Applepay_merchant"; const APPLEPAY_INTERNAL_MERCHANT_NAME: &str = "Applepay_merchant";
pub async fn verify_merchant_creds_for_applepay( pub async fn verify_merchant_creds_for_applepay(
@ -31,6 +29,7 @@ pub async fn verify_merchant_creds_for_applepay(
.common_merchant_identifier; .common_merchant_identifier;
let encrypted_cert = &state.conf.applepay_merchant_configs.merchant_cert; let encrypted_cert = &state.conf.applepay_merchant_configs.merchant_cert;
let encrypted_key = &state.conf.applepay_merchant_configs.merchant_cert_key; let encrypted_key = &state.conf.applepay_merchant_configs.merchant_cert_key;
let applepay_endpoint = &state.conf.applepay_merchant_configs.applepay_endpoint;
let applepay_internal_merchant_identifier = kms::get_kms_client(kms_config) let applepay_internal_merchant_identifier = kms::get_kms_client(kms_config)
.await .await
@ -66,7 +65,7 @@ pub async fn verify_merchant_creds_for_applepay(
let apple_pay_merch_verification_req = services::RequestBuilder::new() let apple_pay_merch_verification_req = services::RequestBuilder::new()
.method(services::Method::Post) .method(services::Method::Post)
.url(APPLEPAY_MERCHANT_VERIFICATION_URL) .url(applepay_endpoint)
.attach_default_headers() .attach_default_headers()
.headers(vec![( .headers(vec![(
headers::CONTENT_TYPE.to_string(), headers::CONTENT_TYPE.to_string(),