Skip to content

Commit

Permalink
refactor(router): new separate routes for applepay merchant verificat…
Browse files Browse the repository at this point in the history
…ion (#2083)
  • Loading branch information
prajjwalkumar17 authored Sep 5, 2023
1 parent e5d3180 commit dc908f6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ recon_admin_api_key = "recon_test_admin"
merchant_cert_key = "MERCHANT CERTIFICATE KEY"
merchant_cert = "MERCHANT CERTIFICATE"
common_merchant_identifier = "COMMON MERCHANT IDENTIFIER"
applepay_endpoint = "DOMAIN SPECIFIC ENDPOINT"

[locker]
host = ""
Expand Down
1 change: 1 addition & 0 deletions crates/router/src/configs/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ pub struct ApplepayMerchantConfigs {
pub merchant_cert: String,
pub merchant_cert_key: String,
pub common_merchant_identifier: String,
pub applepay_endpoint: String,
}

#[derive(Debug, Deserialize, Clone, Default)]
Expand Down
5 changes: 2 additions & 3 deletions crates/router/src/utils/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use crate::{
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";

pub async fn verify_merchant_creds_for_applepay(
Expand All @@ -31,6 +29,7 @@ pub async fn verify_merchant_creds_for_applepay(
.common_merchant_identifier;
let encrypted_cert = &state.conf.applepay_merchant_configs.merchant_cert;
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)
.await
Expand Down Expand Up @@ -66,7 +65,7 @@ pub async fn verify_merchant_creds_for_applepay(

let apple_pay_merch_verification_req = services::RequestBuilder::new()
.method(services::Method::Post)
.url(APPLEPAY_MERCHANT_VERIFICATION_URL)
.url(applepay_endpoint)
.attach_default_headers()
.headers(vec![(
headers::CONTENT_TYPE.to_string(),
Expand Down

0 comments on commit dc908f6

Please sign in to comment.