Skip to content

Commit 17bd60c

Browse files
committed
resolve comments
1 parent ab46d80 commit 17bd60c

File tree

8 files changed

+85
-47
lines changed

8 files changed

+85
-47
lines changed

crates/connector_configs/toml/development.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,12 +2260,35 @@ type="Text"
22602260
payment_method_type = "CartesBancaires"
22612261
[[novalnet.debit]]
22622262
payment_method_type = "UnionPay"
2263+
[[novalnet.wallet]]
2264+
payment_method_type = "google_pay"
2265+
[[novalnet.wallet]]
2266+
payment_method_type = "paypal"
22632267
[novalnet.connector_auth.SignatureKey]
22642268
api_key="Product Activation Key"
22652269
key1="Payment Access Key"
22662270
api_secret="Tariff ID"
22672271
[novalnet.connector_webhook_details]
22682272
merchant_secret="Source verification key"
2273+
placeholder="Enter Payment Access Key"
2274+
[[novalnet.metadata.google_pay]]
2275+
name="merchant_name"
2276+
label="Google Pay Merchant Name"
2277+
placeholder="Enter Google Pay Merchant Name"
2278+
required=true
2279+
type="Text"
2280+
[[novalnet.metadata.google_pay]]
2281+
name="merchant_id"
2282+
label="Google Pay Merchant Id"
2283+
placeholder="Enter Google Pay Merchant Id"
2284+
required=true
2285+
type="Text"
2286+
[[novalnet.metadata.google_pay]]
2287+
name="gateway_merchant_id"
2288+
label="Google Pay Merchant Key"
2289+
placeholder="Enter Google Pay Merchant Key"
2290+
required=true
2291+
type="Text"
22692292

22702293
[nuvei]
22712294
[[nuvei.credit]]

crates/connector_configs/toml/production.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,12 +1782,35 @@ merchant_secret="Source verification key"
17821782
payment_method_type = "CartesBancaires"
17831783
[[novalnet.debit]]
17841784
payment_method_type = "UnionPay"
1785+
[[novalnet.wallet]]
1786+
payment_method_type = "google_pay"
1787+
[[novalnet.wallet]]
1788+
payment_method_type = "paypal"
17851789
[novalnet.connector_auth.SignatureKey]
17861790
api_key="Product Activation Key"
17871791
key1="Payment Access Key"
17881792
api_secret="Tariff ID"
17891793
[novalnet.connector_webhook_details]
17901794
merchant_secret="Source verification key"
1795+
placeholder="Enter Payment Access Key"
1796+
[[novalnet.metadata.google_pay]]
1797+
name="merchant_name"
1798+
label="Google Pay Merchant Name"
1799+
placeholder="Enter Google Pay Merchant Name"
1800+
required=true
1801+
type="Text"
1802+
[[novalnet.metadata.google_pay]]
1803+
name="merchant_id"
1804+
label="Google Pay Merchant Id"
1805+
placeholder="Enter Google Pay Merchant Id"
1806+
required=true
1807+
type="Text"
1808+
[[novalnet.metadata.google_pay]]
1809+
name="gateway_merchant_id"
1810+
label="Google Pay Merchant Key"
1811+
placeholder="Enter Google Pay Merchant Key"
1812+
required=true
1813+
type="Text"
17911814

17921815
[nuvei]
17931816
[[nuvei.credit]]

crates/connector_configs/toml/sandbox.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,12 +2256,35 @@ type="Text"
22562256
payment_method_type = "CartesBancaires"
22572257
[[novalnet.debit]]
22582258
payment_method_type = "UnionPay"
2259+
[[novalnet.wallet]]
2260+
payment_method_type = "google_pay"
2261+
[[novalnet.wallet]]
2262+
payment_method_type = "paypal"
22592263
[novalnet.connector_auth.SignatureKey]
22602264
api_key="Product Activation Key"
22612265
key1="Payment Access Key"
22622266
api_secret="Tariff ID"
22632267
[novalnet.connector_webhook_details]
22642268
merchant_secret="Source verification key"
2269+
placeholder="Enter Payment Access Key"
2270+
[[novalnet.metadata.google_pay]]
2271+
name="merchant_name"
2272+
label="Google Pay Merchant Name"
2273+
placeholder="Enter Google Pay Merchant Name"
2274+
required=true
2275+
type="Text"
2276+
[[novalnet.metadata.google_pay]]
2277+
name="merchant_id"
2278+
label="Google Pay Merchant Id"
2279+
placeholder="Enter Google Pay Merchant Id"
2280+
required=true
2281+
type="Text"
2282+
[[novalnet.metadata.google_pay]]
2283+
name="gateway_merchant_id"
2284+
label="Google Pay Merchant Key"
2285+
placeholder="Enter Google Pay Merchant Key"
2286+
required=true
2287+
type="Text"
22652288

22662289
[nuvei]
22672290
[[nuvei.credit]]

crates/hyperswitch_connectors/src/connectors/novalnet.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -818,15 +818,8 @@ impl webhooks::IncomingWebhook for Novalnet {
818818
};
819819

820820
if novalnet::is_refund_event(&notif.event.event_type) {
821-
let parent_tid =
822-
notif
823-
.event
824-
.parent_tid
825-
.ok_or(errors::ConnectorError::MissingRequiredField {
826-
field_name: "parent_tid",
827-
})?;
828821
Ok(api_models::webhooks::ObjectReferenceId::RefundId(
829-
api_models::webhooks::RefundIdType::ConnectorRefundId(parent_tid.to_string()),
822+
api_models::webhooks::RefundIdType::ConnectorRefundId(notif.event.tid.to_string()),
830823
))
831824
} else {
832825
match transaction_order_no {

crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
352352
})
353353
}
354354
WalletDataPaymentMethod::PaypalSdk(_)
355+
| WalletDataPaymentMethod::Paze(_)
355356
| WalletDataPaymentMethod::SamsungPay(_)
356357
| WalletDataPaymentMethod::TwintRedirect {}
357358
| WalletDataPaymentMethod::VippsRedirect {}
@@ -573,7 +574,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, NovalnetPaymentsResponse, T, PaymentsRe
573574
let transaction_status = item
574575
.response
575576
.transaction
576-
.clone()
577+
.as_ref()
577578
.and_then(|transaction_data| transaction_data.status)
578579
.unwrap_or(if redirection_data.is_some() {
579580
NovalnetTransactionStatus::Progress
@@ -868,7 +869,7 @@ impl TryFrom<RefundsResponseRouterData<Execute, NovalnetRefundResponse>>
868869
.response
869870
.transaction
870871
.clone()
871-
.and_then(|data| data.tid.map(|tid| tid.expose().to_string()))
872+
.and_then(|data| data.refund.tid.map(|tid| tid.expose().to_string()))
872873
.ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
873874

874875
let transaction_status = item

crates/hyperswitch_connectors/src/utils.rs

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -917,41 +917,12 @@ pub trait AccessTokenRequestInfo {
917917
fn get_request_id(&self) -> Result<Secret<String>, Error>;
918918
}
919919

920-
impl WalletData for hyperswitch_domain_models::payment_method_data::WalletData {
921-
fn get_wallet_token(&self) -> Result<Secret<String>, Error> {
922-
match self {
923-
Self::GooglePay(data) => Ok(Secret::new(data.tokenization_data.token.clone())),
924-
Self::ApplePay(data) => Ok(data.get_applepay_decoded_payment_data()?),
925-
Self::PaypalSdk(data) => Ok(Secret::new(data.token.clone())),
926-
_ => Err(errors::ConnectorError::InvalidWallet.into()),
927-
}
928-
}
929-
fn get_wallet_token_as_json<T>(&self, wallet_name: String) -> Result<T, Error>
930-
where
931-
T: serde::de::DeserializeOwned,
932-
{
933-
serde_json::from_str::<T>(self.get_wallet_token()?.peek())
934-
.change_context(errors::ConnectorError::InvalidWalletToken { wallet_name })
935-
}
936-
}
937-
938-
pub trait ApplePay {
939-
fn get_applepay_decoded_payment_data(&self) -> Result<Secret<String>, Error>;
940-
}
941-
942-
impl ApplePay for ApplePayWalletData {
943-
fn get_applepay_decoded_payment_data(&self) -> Result<Secret<String>, Error> {
944-
let token = Secret::new(
945-
String::from_utf8(BASE64_ENGINE.decode(&self.payment_data).change_context(
946-
errors::ConnectorError::InvalidWalletToken {
947-
wallet_name: "Apple Pay".to_string(),
948-
},
949-
)?)
950-
.change_context(errors::ConnectorError::InvalidWalletToken {
951-
wallet_name: "Apple Pay".to_string(),
952-
})?,
953-
);
954-
Ok(token)
920+
impl AccessTokenRequestInfo for RefreshTokenRouterData {
921+
fn get_request_id(&self) -> Result<Secret<String>, Error> {
922+
self.request
923+
.id
924+
.clone()
925+
.ok_or_else(missing_field_err("request.id"))
955926
}
956927
}
957928

@@ -1844,6 +1815,7 @@ pub enum PaymentMethodDataType {
18441815
MobilePayRedirect,
18451816
PaypalRedirect,
18461817
PaypalSdk,
1818+
Paze,
18471819
SamsungPay,
18481820
TwintRedirect,
18491821
VippsRedirect,
@@ -1923,13 +1895,15 @@ pub enum PaymentMethodDataType {
19231895
VietQr,
19241896
OpenBanking,
19251897
NetworkToken,
1898+
NetworkTransactionIdAndCardDetails,
19261899
}
19271900

19281901
impl From<PaymentMethodData> for PaymentMethodDataType {
19291902
fn from(pm_data: PaymentMethodData) -> Self {
19301903
match pm_data {
19311904
PaymentMethodData::Card(_) => Self::Card,
19321905
PaymentMethodData::NetworkToken(_) => Self::NetworkToken,
1906+
PaymentMethodData::CardDetailsForNetworkTransactionId(_) => Self::NetworkTransactionIdAndCardDetails,
19331907
PaymentMethodData::CardRedirect(card_redirect_data) => {
19341908
match card_redirect_data {
19351909
hyperswitch_domain_models::payment_method_data::CardRedirectData::Knet {} => Self::Knet,
@@ -1961,6 +1935,7 @@ impl From<PaymentMethodData> for PaymentMethodDataType {
19611935
hyperswitch_domain_models::payment_method_data::WalletData::MobilePayRedirect(_) => Self::MobilePayRedirect,
19621936
hyperswitch_domain_models::payment_method_data::WalletData::PaypalRedirect(_) => Self::PaypalRedirect,
19631937
hyperswitch_domain_models::payment_method_data::WalletData::PaypalSdk(_) => Self::PaypalSdk,
1938+
hyperswitch_domain_models::payment_method_data::WalletData::Paze(_) => Self::Paze,
19641939
hyperswitch_domain_models::payment_method_data::WalletData::SamsungPay(_) => Self::SamsungPay,
19651940
hyperswitch_domain_models::payment_method_data::WalletData::TwintRedirect {} => Self::TwintRedirect,
19661941
hyperswitch_domain_models::payment_method_data::WalletData::VippsRedirect {} => Self::VippsRedirect,

crates/router/src/core/payments/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ pub fn create_authorize_url(
11951195
pub fn create_webhook_url(
11961196
router_base_url: &String,
11971197
merchant_id: &id_type::MerchantId,
1198-
connector_name: &String,
1198+
connector_name: impl std::fmt::Display,
11991199
) -> String {
12001200
format!(
12011201
"{}/webhooks/{}/{}",

crates/router/src/core/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub async fn construct_refund_router_data<'a, F>(
290290
let webhook_url = Some(helpers::create_webhook_url(
291291
&state.base_url.clone(),
292292
merchant_account.get_id(),
293-
&connector_id.to_string(),
293+
connector_id,
294294
));
295295
let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
296296

0 commit comments

Comments
 (0)